From d399f75648a44143ccd4f1b0382274f3eff62c89 Mon Sep 17 00:00:00 2001 From: Taha Afzal Date: Fri, 9 Dec 2022 16:59:08 -0500 Subject: [PATCH 1/6] Decreasing the log rate on the server --- src/lib/orderman/OrderServiceServer.cpp | 2 +- src/lib/orderman/gateways/EMExecutionGateway.cpp | 4 ---- src/lib/orderman/orders/algo/algo_orders/RegisterDorman.cpp | 5 +++-- src/lib/orderman/orders/algo/algo_orders/TaskingEyeAlgo.cpp | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/lib/orderman/OrderServiceServer.cpp b/src/lib/orderman/OrderServiceServer.cpp index f8d1d8721..3d2cf4cb1 100644 --- a/src/lib/orderman/OrderServiceServer.cpp +++ b/src/lib/orderman/OrderServiceServer.cpp @@ -522,7 +522,7 @@ void OrderServiceServer::_on_exchange_position( ret_pos.set_avg_filled_price(p.avg_filled_price.value()); ret_pos.set_position(p.position); me->exchange_pos_publisher.add_or_update(ret_pos); - LOG(OrderMan, Info, + LOG(OrderMan, Diag, "OrderServiceServer::_on_exchange_position publishing pos id: {} " "key: {} res: {} account_name: {} account_id: {} " "account_resolved: " diff --git a/src/lib/orderman/gateways/EMExecutionGateway.cpp b/src/lib/orderman/gateways/EMExecutionGateway.cpp index 991a6c381..a7f2dc7ed 100644 --- a/src/lib/orderman/gateways/EMExecutionGateway.cpp +++ b/src/lib/orderman/gateways/EMExecutionGateway.cpp @@ -619,10 +619,6 @@ void EMExecutionGateway::_process_pos_cb_and_fire( bts_account_ptr == nullptr ? std::nullopt : std::optional(bts_account_ptr->id()); - LOG(OrderMan, Info, - "EMExecutionGateway::_process_pos_cb_and_fire pos: {} bts_account: " - "{}", - pos, account_name()); me->exchange_position.total_exchange_positions.push_back( {exch_sec_desc, sec, account_name(), account_id, pos_qty, Price(pos.position.average_price.to_double())}); diff --git a/src/lib/orderman/orders/algo/algo_orders/RegisterDorman.cpp b/src/lib/orderman/orders/algo/algo_orders/RegisterDorman.cpp index 2bce7dfb3..5a42ed9ab 100644 --- a/src/lib/orderman/orders/algo/algo_orders/RegisterDorman.cpp +++ b/src/lib/orderman/orders/algo/algo_orders/RegisterDorman.cpp @@ -341,8 +341,9 @@ extern "C" void init_spark_plugin(bts::SparkServices &srv) { init_on_signal_plugin(srv); if (dyn_algo_config.enable_execution_tester()) init_on_signal_plugin(srv); - init_execution_tester_plugin(srv); - init_sniper_plugin(srv); + if (dyn_algo_config.enable_execution_tester()) + init_execution_tester_plugin(srv); + // init_sniper_plugin(srv); init_task_eye_plugin(srv); } diff --git a/src/lib/orderman/orders/algo/algo_orders/TaskingEyeAlgo.cpp b/src/lib/orderman/orders/algo/algo_orders/TaskingEyeAlgo.cpp index 874de1835..fc889d72a 100644 --- a/src/lib/orderman/orders/algo/algo_orders/TaskingEyeAlgo.cpp +++ b/src/lib/orderman/orders/algo/algo_orders/TaskingEyeAlgo.cpp @@ -402,7 +402,7 @@ bool TaskingEyeAlgo::_in_shooting_zone( } else { double ee_sell_pr = theo + me->edge; const md::PriceSize &md_bid = sec_data.sec_book.bid().at(0); - LOG(OrderMan, Info, + LOG(OrderMan, Diag, "TaskingEyeAlgo::_in_shooting_zone sec_key: {} driver: {} theo: {} " "ee_price: {} md: {}/{}", sec_key, driver, theo, ee_sell_pr, md_bid.price(), md_bid.size()); From 8e68d573ff8e0cee3c6f8f675f5487770b119746 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Fri, 9 Dec 2022 13:19:40 -0500 Subject: [PATCH 2/6] ui (volsurface): Update oxyplot to get rid of 'dummy' win --- .../Analytics/VolSurface/VolSurfaceWindow.cs | 39 +++---------------- src/client/spark/Spark.csproj | 4 +- 2 files changed, 7 insertions(+), 36 deletions(-) diff --git a/src/client/spark/Modules/Analytics/VolSurface/VolSurfaceWindow.cs b/src/client/spark/Modules/Analytics/VolSurface/VolSurfaceWindow.cs index 99f60c08b..89c23cc35 100644 --- a/src/client/spark/Modules/Analytics/VolSurface/VolSurfaceWindow.cs +++ b/src/client/spark/Modules/Analytics/VolSurface/VolSurfaceWindow.cs @@ -2,26 +2,21 @@ using bts.api; using bts.spark; - using mbts; using mbts.ui; - using mbts.ui.extensions; using mbts.ui.shell; using Spark.Core.Disposables; using System; - using System.Reactive.Linq; using System.Windows; - using System.Windows.Controls; - class VolSurfaceWindow : SparkWindow, ISharedWindow, IDummyWindow { + class VolSurfaceWindow : SparkWindow, ISharedWindow { public const string WINDOW_TYPE = "VolSurface"; readonly VolSurfaceWindowSettings _startup_data; VolSurfaceVM _vm; - UIElement _dummy_view; - Window _main_win; + VolSurfaceView _view; public VolSurfaceWindow( VolSurfaceWindowFactory factory, IBus bus, string vs_name, VolSurfaceWindowSettings startup_data) : @@ -39,37 +34,13 @@ public string vs_name { get; } public override VolSurfaceWindowSettings SaveState => _vm?.get_startup_data(); - public override UIElement Content => _dummy_view; + public override UIElement Content => _view; public void thread_init() { _vm = new VolSurfaceVM(new VolSurfaceDisplayModel(vs_id, _bus, true), vs_id, _bus, _startup_data); - var hooks = new ImmutableDisposable(); - - var dummy_view = new Border { - Background = BTSColors.UI.default_background.to_brush().frozen(), - Padding = new(8), - Child = new TextBlock { Text = "Loading ..." } + _view = new VolSurfaceView { + DataContext = _vm }; - _dummy_view = dummy_view; - - _main_win = new Window { - Content = new VolSurfaceView { - DataContext = _vm - }, - Style = Application.Current.TryFindResource("BTSWindow") as Style - }; - ui.WindowStyle.SetAllowResize(_main_win, true); - hooks += this.observe_title().OnDispatcher().Subscribe(title => _main_win.Title = title); - hooks += _main_win.SubscribeClosed((s, e) => { - Disposable.dispose(ref hooks); - _bus.post(SparkTags.hide_window, this); - }); - hooks += dummy_view.SubscribeUnloaded((s, e) => { - Disposable.dispose(ref hooks); - _main_win.Close(); - }); - - _main_win.Show(); } } } diff --git a/src/client/spark/Spark.csproj b/src/client/spark/Spark.csproj index 96ddb9b0b..218d31433 100644 --- a/src/client/spark/Spark.csproj +++ b/src/client/spark/Spark.csproj @@ -47,8 +47,8 @@ - - + + From 12716bb6e19aa42a7e0db314ee034b12e633ed0f Mon Sep 17 00:00:00 2001 From: John Colvin Date: Mon, 12 Dec 2022 10:56:10 -0500 Subject: [PATCH 3/6] fix: Add a couple null checks --- .../spark/AW2/Misc/SecurityNormalizer.cs | 24 ++++++++++--------- .../View/VolSurfaceMacroControlView.xaml | 3 ++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/client/spark/AW2/Misc/SecurityNormalizer.cs b/src/client/spark/AW2/Misc/SecurityNormalizer.cs index d76034493..9228bd5c0 100644 --- a/src/client/spark/AW2/Misc/SecurityNormalizer.cs +++ b/src/client/spark/AW2/Misc/SecurityNormalizer.cs @@ -1,14 +1,10 @@ -using System; -using System.Collections.Generic; -using mbts.analytics; -using bts.api; -using mbts.ui; -using MathNet.Numerics.Providers.FourierTransform; -using BCG; -using System.Windows.Automation; -using bts.collections; - namespace mbts.spark { + using bts.api; + + using System; + using System.Collections.Generic; + using System.Linq; + // A lot of options data (migrated from edge) is not normalized // on the sec_id, but rather on a combination of symbol, exp, strike. @@ -20,6 +16,9 @@ namespace mbts.spark { public static IDictionary normalize_drivers( OptionDriverPriceMap driver_map, SystemContractData sc_data) { + if (driver_map is null) { + return new Dictionary(0); + } Dictionary rv = new Dictionary(); foreach (var kv in driver_map.get_price_map()) { var exp = kv.Key; @@ -40,6 +39,9 @@ namespace mbts.spark { } public static IEnumerable> normalize_interp_theos( OptionTheoInterpolationData symbol_theos, SystemContractData sc_data) { + if (symbol_theos is null) { + return Enumerable.Empty>(); + } var rv = new List>(); foreach (DateTime exp in symbol_theos.get_expirations()) { Dictionary> exp_data = @@ -65,4 +67,4 @@ namespace mbts.spark { return rv; } } -} \ No newline at end of file +} diff --git a/src/client/spark/Modules/Analytics/VolSurface/View/VolSurfaceMacroControlView.xaml b/src/client/spark/Modules/Analytics/VolSurface/View/VolSurfaceMacroControlView.xaml index c621ec24b..d975d53fc 100644 --- a/src/client/spark/Modules/Analytics/VolSurface/View/VolSurfaceMacroControlView.xaml +++ b/src/client/spark/Modules/Analytics/VolSurface/View/VolSurfaceMacroControlView.xaml @@ -44,10 +44,11 @@ - - diff --git a/src/client/spark/core/FontsAndColors/BTSColors.cs b/src/client/spark/core/FontsAndColors/BTSColors.cs index 9df8881b9..a5bd3442d 100644 --- a/src/client/spark/core/FontsAndColors/BTSColors.cs +++ b/src/client/spark/core/FontsAndColors/BTSColors.cs @@ -904,11 +904,7 @@ namespace mbts.ui { public static BTSColor background => UI.default_background; public static BTSColor foreground => thumb_static;//UI.default_text; } - public static class RepeatButton { - public static BTSColor background => UI.default_background; - public static BTSColor foreground => UI.black; - public static BTSColor border => UI.default_text; - } + public static class StatusBarItem { public static BTSColor foreground => UI.default_text; } diff --git a/src/client/spark/view/Controls/TickUpDown/TickUpDown.xaml b/src/client/spark/view/Controls/TickUpDown/TickUpDown.xaml index 84616b87c..a726aa2d5 100644 --- a/src/client/spark/view/Controls/TickUpDown/TickUpDown.xaml +++ b/src/client/spark/view/Controls/TickUpDown/TickUpDown.xaml @@ -8,6 +8,7 @@ +