diff --git a/src/client/spark/AW2/Bus/AnalyticsParametersManager.cs b/src/client/spark/AW2/Bus/AnalyticsParametersManager.cs index 397d5b9b3..16a195ba6 100644 --- a/src/client/spark/AW2/Bus/AnalyticsParametersManager.cs +++ b/src/client/spark/AW2/Bus/AnalyticsParametersManager.cs @@ -56,7 +56,7 @@ namespace mbts.spark { } break; } - _bb.sec_thread_write(SparkTags.ExpirationParametersInputTag, + _bb.post(SparkTags.ExpirationParametersInputTag, new AnalyticsExpirationParametersMap(to_publish)); } diff --git a/src/client/spark/AW2/Bus/SingleOptionDriverPricePublisher.cs b/src/client/spark/AW2/Bus/SingleOptionDriverPricePublisher.cs index 846151a9f..166d1bde5 100644 --- a/src/client/spark/AW2/Bus/SingleOptionDriverPricePublisher.cs +++ b/src/client/spark/AW2/Bus/SingleOptionDriverPricePublisher.cs @@ -74,7 +74,7 @@ namespace mbts.spark { } } OptionDriverPriceMap final_res = new OptionDriverPriceMap(_sec_tup.security_name, res); - _bb.sec_thread_write(SparkTags.OptionDriverBBOTag(_sec_tup.security_name), final_res); + _bb.post(SparkTags.OptionDriverBBOTag(_sec_tup.security_name), final_res); } } } \ No newline at end of file diff --git a/src/client/spark/AW2/Bus/SingleVolSurfaceClientTheosPublishHelper.cs b/src/client/spark/AW2/Bus/SingleVolSurfaceClientTheosPublishHelper.cs index 372f80a3e..89d44a60a 100644 --- a/src/client/spark/AW2/Bus/SingleVolSurfaceClientTheosPublishHelper.cs +++ b/src/client/spark/AW2/Bus/SingleVolSurfaceClientTheosPublishHelper.cs @@ -24,12 +24,12 @@ namespace mbts.spark { public void publish(IDictionary> exp_theo_map) { if (_n_updates == 0) /// If its the first theos send it rightaway - _bb.sec_thread_write(SparkTags.VolSurfaceLocalTheosTag(_vs_id), exp_theo_map); + _bb.post(SparkTags.VolSurfaceLocalTheosTag(_vs_id), exp_theo_map); else { if (_is_theo_acceptance_confirmation_on) - _bb.sec_thread_write(SparkTags.VolSurfaceTheoAlertTag, new VolSurfaceTheoAlertData(Guid.NewGuid().ToString(), _vs_id, exp_theo_map)); + _bb.post(SparkTags.VolSurfaceTheoAlertTag, new VolSurfaceTheoAlertData(Guid.NewGuid().ToString(), _vs_id, exp_theo_map)); else - _bb.sec_thread_write(SparkTags.VolSurfaceLocalTheosTag(_vs_id), exp_theo_map); + _bb.post(SparkTags.VolSurfaceLocalTheosTag(_vs_id), exp_theo_map); } _n_updates++; } diff --git a/src/client/spark/AW2/Bus/SingleVolSurfaceCommittedOutputRetriever.cs b/src/client/spark/AW2/Bus/SingleVolSurfaceCommittedOutputRetriever.cs index bf095c165..463dbb3d1 100644 --- a/src/client/spark/AW2/Bus/SingleVolSurfaceCommittedOutputRetriever.cs +++ b/src/client/spark/AW2/Bus/SingleVolSurfaceCommittedOutputRetriever.cs @@ -56,7 +56,7 @@ namespace mbts.spark { VolSurfaceOutput vs_output = GeneralVolSurfaceCalculator.compute(vs_input, vs_nonvol_data.contracts, aux_data_map); _timer.stop(); _logger.log(_log_id, _log_id, _timer.lastIntervalTime); - _bb.sec_thread_write(_out_bb_computed_vol_tag, vs_output); + _bb.post(_out_bb_computed_vol_tag, vs_output); } } diff --git a/src/client/spark/AW2/Bus/SingleVolSurfaceDataSource.cs b/src/client/spark/AW2/Bus/SingleVolSurfaceDataSource.cs index 30887afc0..1b051c521 100644 --- a/src/client/spark/AW2/Bus/SingleVolSurfaceDataSource.cs +++ b/src/client/spark/AW2/Bus/SingleVolSurfaceDataSource.cs @@ -80,7 +80,7 @@ namespace mbts.spark { if (_source != null) _source.Dispose(); _source = _create_func(_option_symbols); - _bb.sec_thread_write(SparkTags.AquireTag(Guid.NewGuid().ToString()), + _bb.post(SparkTags.AquireTag(Guid.NewGuid().ToString()), new SymbolResourceAllocationUnit( _option_symbols.Select(i => new mbts.SecurityTuple(SecurityType.Option, i, Venue.Unset)), this, true)); } diff --git a/src/client/spark/AW2/Bus/SingleVolSurfaceGateway.cs b/src/client/spark/AW2/Bus/SingleVolSurfaceGateway.cs index 9583cd766..fb2fa1934 100644 --- a/src/client/spark/AW2/Bus/SingleVolSurfaceGateway.cs +++ b/src/client/spark/AW2/Bus/SingleVolSurfaceGateway.cs @@ -49,7 +49,7 @@ namespace mbts.spark { all_vss = all_vss.Where(vs => vs.VsId == _volsurface_id); VolSurfaceEntryImmutable vs = all_vss.MaxElement(vs => vs.SaveTime); VolSurfaceInput vs_input = _to_vs_input(vs); - _threaded_bb.sec_thread_write( + _threaded_bb.post( SparkTags.VolSurfaceCommittedInputTag(_volsurface_id), vs_input, false); _update_publish_snapshots(all_vss); } @@ -61,7 +61,7 @@ namespace mbts.spark { _snp_shot_map.Add(vse.SaveTime, snp); } } - _threaded_bb.sec_thread_write(SparkTags.VolSurfaceInputSnapshotListTag(_volsurface_id), + _threaded_bb.post(SparkTags.VolSurfaceInputSnapshotListTag(_volsurface_id), _snp_shot_map.Values); } @@ -84,7 +84,7 @@ namespace mbts.spark { Log.Gen.info(String.Format("Time to commit volsurface {0} {1} msecs", _volsurface_id, _timer.lastIntervalTime)); } catch (Exception ex) { Log.Gen.warn(ex.ToString()); - _threaded_bb.sec_thread_write(SparkTags.MessageDisplayTag, + _threaded_bb.post(SparkTags.MessageDisplayTag, new MessageDisplayData("Vol Surface Addition", String.Format("Could not create Vol Surface, Error : {0}", ex.Message))); } diff --git a/src/client/spark/AW2/Bus/SingleVolSurfaceMarketImpliedVolSource.cs b/src/client/spark/AW2/Bus/SingleVolSurfaceMarketImpliedVolSource.cs index ff85fdbd1..c6be16188 100644 --- a/src/client/spark/AW2/Bus/SingleVolSurfaceMarketImpliedVolSource.cs +++ b/src/client/spark/AW2/Bus/SingleVolSurfaceMarketImpliedVolSource.cs @@ -138,7 +138,7 @@ namespace mbts.spark { _ignore_market_implied_vol_source_settings(_bb, _vs_id), out md_exp); _timer.stop(); _logger.log("SingleVolSurfaceMarketImpliedVolSource", "SingleVolSurfaceMarketImpliedVolSource", _timer.lastIntervalTime); - _bb.sec_thread_write(SparkTags.VolSurfaceMarketImpliedVolTag(_vs_id), + _bb.post(SparkTags.VolSurfaceMarketImpliedVolTag(_vs_id), new Dictionary>() { { orig_exp, Tuple.Create(md_exp, exp_impl_vol_map) } }); } } diff --git a/src/client/spark/AW2/Bus/SingleVolSurfaceNonVolDataSource.cs b/src/client/spark/AW2/Bus/SingleVolSurfaceNonVolDataSource.cs index fbddedd47..22ae3ae14 100644 --- a/src/client/spark/AW2/Bus/SingleVolSurfaceNonVolDataSource.cs +++ b/src/client/spark/AW2/Bus/SingleVolSurfaceNonVolDataSource.cs @@ -48,7 +48,7 @@ namespace mbts.spark { foreach (string s in _option_symbols) foreach (var kv in contract_data.get_option_strikes(s)) _sec_map[new VolSurfaceExpiration() { symbol = s, expiration = kv.Key }] = kv.Value; - _bb.sec_thread_write(_out_bb_vs_contracts_tag, new VolSurfaceStrikeMap(_sec_map)); + _bb.post(_out_bb_vs_contracts_tag, new VolSurfaceStrikeMap(_sec_map)); _recompute_and_fire(); } else if (_in_bb_vs_nonvol_input_tag.Equals(tag) || _in_bb_driver_price_tag.Equals(tag)) _recompute_and_fire(); @@ -58,7 +58,7 @@ namespace mbts.spark { VolSurfaceNonVolInput vs_nonvol_input = _bb.sec_thread_retrieve_from_cache(_in_bb_vs_nonvol_input_tag) as VolSurfaceNonVolInput; var price_map = _bb.sec_thread_retrieve_from_cache(_in_bb_driver_price_tag) as IDictionary; if (_sec_map != null && vs_nonvol_input != null && price_map != null) - _bb.sec_thread_write(_out_bb_vs_nonvol_data_tag, new VolSurfaceNonVolData(vs_nonvol_input, price_map, _sec_map)); + _bb.post(_out_bb_vs_nonvol_data_tag, new VolSurfaceNonVolData(vs_nonvol_input, price_map, _sec_map)); } #region IDisposable diff --git a/src/client/spark/AW2/Bus/SingleVolSurfaceOptionDriverSource.cs b/src/client/spark/AW2/Bus/SingleVolSurfaceOptionDriverSource.cs index 0226c92b0..a004a6f1a 100644 --- a/src/client/spark/AW2/Bus/SingleVolSurfaceOptionDriverSource.cs +++ b/src/client/spark/AW2/Bus/SingleVolSurfaceOptionDriverSource.cs @@ -61,7 +61,7 @@ namespace mbts.spark { private void _on_timer() { if (_option_driver_dirty) { _option_driver_dirty = false; - _threaded_bb.sec_thread_write(_out_bb_driver_price_tag, + _threaded_bb.post(_out_bb_driver_price_tag, new Dictionary(_option_driver_price_map)); } } diff --git a/src/client/spark/AW2/Bus/SingleVolSurfaceRequestCalculator.cs b/src/client/spark/AW2/Bus/SingleVolSurfaceRequestCalculator.cs index 98d6fb7e3..50169ed3a 100644 --- a/src/client/spark/AW2/Bus/SingleVolSurfaceRequestCalculator.cs +++ b/src/client/spark/AW2/Bus/SingleVolSurfaceRequestCalculator.cs @@ -84,7 +84,7 @@ namespace mbts.spark { effective_req.cascade_up, effective_req.cascade_down); _timer.stop(); bts.Log.Gen.info(String.Format("SingleVolSurfaceRequestCalculator. Time to compute vol for {0} exps {1} msecs", nonvol_data.contracts.Count, _timer.lastIntervalTime)); - _threaded_bb.sec_thread_write(SparkTags.VolSurfaceCalculationResponseTag(_vs_id), new VolSurfaceCalculationResponse(_last_output, effective_req.request_id)); + _threaded_bb.post(SparkTags.VolSurfaceCalculationResponseTag(_vs_id), new VolSurfaceCalculationResponse(_last_output, effective_req.request_id)); } } } diff --git a/src/client/spark/AW2/Bus/SingleVolSurfaceTheoSource.cs b/src/client/spark/AW2/Bus/SingleVolSurfaceTheoSource.cs index c3e40e320..1d26e2fb3 100644 --- a/src/client/spark/AW2/Bus/SingleVolSurfaceTheoSource.cs +++ b/src/client/spark/AW2/Bus/SingleVolSurfaceTheoSource.cs @@ -77,7 +77,7 @@ namespace mbts.spark { } var new_data = new VolSurfaceTheoData(secs, comm_theo_map, cand_theo_map, is_active_candidate); if (_is_valid_update(new_data)) - _bb.sec_thread_write(SparkTags.VolSurfaceTheoOutputTag(_volsurface_id), new_data); + _bb.post(SparkTags.VolSurfaceTheoOutputTag(_volsurface_id), new_data); } private bool _is_valid_update(VolSurfaceTheoData new_data) { diff --git a/src/client/spark/AW2/Bus/SingleVolSurfaceTimeSource.cs b/src/client/spark/AW2/Bus/SingleVolSurfaceTimeSource.cs index c889980cc..4ccd62016 100644 --- a/src/client/spark/AW2/Bus/SingleVolSurfaceTimeSource.cs +++ b/src/client/spark/AW2/Bus/SingleVolSurfaceTimeSource.cs @@ -30,7 +30,7 @@ namespace mbts.spark // r.get_datetime("server_time"), // r.get_datetime("server_time_utc")); mbts.analytics.VolSurfaceStandardTime time = new VolSurfaceStandardTime(TimeZoneInfo.Utc, DateTime.Now, DateTime.Now); - _bb.sec_thread_write(SparkTags.VolSurfaceStandardTimeTag(_vs_id), time); + _bb.post(SparkTags.VolSurfaceStandardTimeTag(_vs_id), time); } #region IDisposable diff --git a/src/client/spark/AW2/Bus/VolSurfaceBlackboardManager.cs b/src/client/spark/AW2/Bus/VolSurfaceBlackboardManager.cs index 6661a1971..ee50da516 100644 --- a/src/client/spark/AW2/Bus/VolSurfaceBlackboardManager.cs +++ b/src/client/spark/AW2/Bus/VolSurfaceBlackboardManager.cs @@ -71,7 +71,7 @@ namespace mbts.spark { foreach (VolSurfaceUsageListImmutable l in update.all) { to_write = l; } - _threaded_bb.sec_thread_write(SparkTags.VolSurfaceUsageTag, to_write); + _threaded_bb.post(SparkTags.VolSurfaceUsageTag, to_write); } void _on_vss(bts.api.core.Update update) { @@ -80,7 +80,7 @@ namespace mbts.spark { foreach (VolSurfaceEntryImmutable vs in update.all) { to_publish[vs.VsId] = vs.VsName; } - _threaded_bb.sec_thread_write(SparkTags.VolSurfaceListTag, to_publish); + _threaded_bb.post(SparkTags.VolSurfaceListTag, to_publish); _check_for_activation(to_publish.Keys); } @@ -109,13 +109,13 @@ namespace mbts.spark { _analytics_service.delete_volsurface(vs_id_w); } catch (Exception ex) { Log.Gen.error(String.Format("Vol Surface deletion failed with exception:{0}", ex.Message)); - _threaded_bb.sec_thread_write(SparkTags.MessageDisplayTag, new MessageDisplayData("Vol Surface Deletion", + _threaded_bb.post(SparkTags.MessageDisplayTag, new MessageDisplayData("Vol Surface Deletion", String.Format("Could not delete Vol Surface, Error : {0}", ex.Message))); } } else if (_in_bb_exp_params_tag.Equals(tag)) { AnalyticsExpirationParametersMap exp_param_map = data as AnalyticsExpirationParametersMap; // TODO, add whatever else is needed to AnalyticsExpirationParametersMap -> VolSurfaceNonVolInputTag - _threaded_bb.sec_thread_write(SparkTags.VolSurfaceNonVolInputTag, + _threaded_bb.post(SparkTags.VolSurfaceNonVolInputTag, new mbts.analytics.VolSurfaceNonVolInput(exp_param_map.exp_map.ToDictionary())); } } @@ -137,7 +137,7 @@ namespace mbts.spark { vs_input.surface_settings.core_settings.vol_surface_id = reply.NewId; ResultMessage res = VolSurfaceUtilityFunctions.save_volsurface(vs_input, _analytics_service); if (res.Success) { - _threaded_bb.sec_thread_write(SparkTags.VolSurfaceActivationTag(reply.NewId), true, false); + _threaded_bb.post(SparkTags.VolSurfaceActivationTag(reply.NewId), true, false); } else { err_txt = res.ErrorMessage; } @@ -146,7 +146,7 @@ namespace mbts.spark { } if (err_txt != null) { Log.Gen.error(String.Format("Vol Surface creation failed with message:{0}", err_txt)); - _threaded_bb.sec_thread_write(SparkTags.MessageDisplayTag, new MessageDisplayData("Vol Surface Addition", + _threaded_bb.post(SparkTags.MessageDisplayTag, new MessageDisplayData("Vol Surface Addition", String.Format("Could not create Vol Surface, Error : {0}", err_txt))); } } diff --git a/src/client/spark/AW2/Misc/ThreadedBlackboard.cs b/src/client/spark/AW2/Misc/ThreadedBlackboard.cs index fcffc13bc..de83a0b68 100644 --- a/src/client/spark/AW2/Misc/ThreadedBlackboard.cs +++ b/src/client/spark/AW2/Misc/ThreadedBlackboard.cs @@ -36,17 +36,12 @@ namespace mbts.spark { public Action timer_callback; #region Templatized sub/write - public void add_to_subscription_list(ITag tag) { - var observable = _bus.subscribe(tag).OnDispatcher().Subscribe( - data => _on_bus_data(tag, data)); - } - public void subscribe(ITag tag) { var observable = _bus.subscribe(tag).OnDispatcher().Subscribe( data => _on_bus_data(tag, data)); } - public void sec_thread_write(ITag tag, T data, bool block_until_written = false) { + public void post(ITag tag, T data, bool block_until_written = false) { _bus.post(tag, data); } diff --git a/src/client/spark/AW2/VolSurfaceLocalTheosManager.cs b/src/client/spark/AW2/VolSurfaceLocalTheosManager.cs index df605ed60..d328120e1 100644 --- a/src/client/spark/AW2/VolSurfaceLocalTheosManager.cs +++ b/src/client/spark/AW2/VolSurfaceLocalTheosManager.cs @@ -65,7 +65,7 @@ namespace mbts.spark { foreach (var kv in theo_map) { string option_name = kv.Key; if (_vs_usage_map.symbol_driven_by_vs(option_name, vs_id)) { - _bb.sec_thread_write(SparkTags.PrecomputedOptionTheoTag(option_name), kv.Value); + _bb.post(SparkTags.PrecomputedOptionTheoTag(option_name), kv.Value); } } }