From 082a241bb9bff07b6ba97063177002d00fae8ca5 Mon Sep 17 00:00:00 2001 From: Jake Norbut Date: Mon, 20 May 2019 12:48:14 -0500 Subject: [PATCH] passing the OrdersModel, from where the PositionUnit will be published from, down the line --- src/client/spark/Modules/Trading/PAndLWindowFactory.cs | 6 ++++-- src/client/spark/Modules/Trading/TradingShellModule.cs | 2 +- src/client/spark/view/Spark/PAndL/PAndLWindow.cs | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/client/spark/Modules/Trading/PAndLWindowFactory.cs b/src/client/spark/Modules/Trading/PAndLWindowFactory.cs index 486e261a9..a0d936236 100644 --- a/src/client/spark/Modules/Trading/PAndLWindowFactory.cs +++ b/src/client/spark/Modules/Trading/PAndLWindowFactory.cs @@ -20,11 +20,13 @@ namespace bts.shell { internal class PAndLWindowFactory : ShellWindowFactory { readonly IBus _bus; readonly PAndLModel _model; + readonly OrdersModel _orders_model; readonly UserSettingsHub _settings_hub; - public PAndLWindowFactory(IShellModule owner, IBus bus, UserSettingsHub settings_hub, PAndLModel model) : base(owner, "SparkPAndL") { + public PAndLWindowFactory(IShellModule owner, IBus bus, UserSettingsHub settings_hub, PAndLModel model, OrdersModel orders_model) : base(owner, "SparkPAndL") { _bus = bus; _model = model; + _orders_model = orders_model; _settings_hub = settings_hub; _dispose = bus.subscribe(SparkTags.ShowPAndLTag).OnDispatcher().Subscribe(show); } @@ -45,7 +47,7 @@ namespace bts.shell { state.grid, get: us => us.pnl_grid, set: (us, gs) => us.with(provided_pnl_gridsettings: gs)); - return new PAndLWindow(_model, this, _bus, state, SparkCommands.ShowPAndL.icon, settings_manager); + return new PAndLWindow(_model, _orders_model, this, _bus, state, SparkCommands.ShowPAndL.icon, settings_manager); } [ProtoContract] diff --git a/src/client/spark/Modules/Trading/TradingShellModule.cs b/src/client/spark/Modules/Trading/TradingShellModule.cs index b8e4fa1cf..f0ffaffe7 100644 --- a/src/client/spark/Modules/Trading/TradingShellModule.cs +++ b/src/client/spark/Modules/Trading/TradingShellModule.cs @@ -28,7 +28,7 @@ namespace bts.shell { _lwf = new LadderWindowFactory(this, bus, wm, settings_hub, orders_model); _obwf = new OrderBookWindowFactory(this, bus, notification_service, notification_service_data_cache, orders_model, settings_hub); _fwf = new FillsWindowFactory(this, bus, settings_hub, orders_model); - _plwf = new PAndLWindowFactory(this, bus, settings_hub, pandl_model); + _plwf = new PAndLWindowFactory(this, bus, settings_hub, pandl_model, orders_model); _aswf = new AlgoStudioWindowFactory(this, bus, orders_model, error_reporter); _mfwf = new ManualFillsWindowFactory(this, bus, orders_model); } diff --git a/src/client/spark/view/Spark/PAndL/PAndLWindow.cs b/src/client/spark/view/Spark/PAndL/PAndLWindow.cs index e2aa7e95b..e82ebebf6 100644 --- a/src/client/spark/view/Spark/PAndL/PAndLWindow.cs +++ b/src/client/spark/view/Spark/PAndL/PAndLWindow.cs @@ -18,13 +18,15 @@ namespace mbts.spark { readonly IWindowSettingsManager _settings_manager; PAndLWindowFactory.PAndLStartupData _startup_data; PAndLModel _model; + OrdersModel _orders_model; PAndLView _view; PAndLVM _vm; PAndLWindowFactory _factory; IReadOnlyList _commands; - public PAndLWindow(PAndLModel model, PAndLWindowFactory factory, IBus bus, PAndLWindowFactory.PAndLStartupData startup_data, ImageSource Icon, WindowSettingsManager settings_manager) : base("P&L", bus, factory, SparkCommands.ShowPAndL.icon) { + public PAndLWindow(PAndLModel model, OrdersModel orders_model, PAndLWindowFactory factory, IBus bus, PAndLWindowFactory.PAndLStartupData startup_data, ImageSource Icon, WindowSettingsManager settings_manager) : base("P&L", bus, factory, SparkCommands.ShowPAndL.icon) { _model = model; + _orders_model = orders_model; _factory = factory; _startup_data = startup_data; _settings_manager = settings_manager; @@ -52,7 +54,7 @@ namespace mbts.spark { public string thread_id { get; } public void thread_init() { - _vm = new PAndLVM(_bus, _model, _startup_data, _settings_manager); + _vm = new PAndLVM(_bus, _model, _orders_model, _startup_data, _settings_manager); _view = new PAndLView(_vm); _view.DataContext = _vm; _commands = new List {