passing the OrdersModel, from where the PositionUnit will be published from, down the line

This commit is contained in:
Jake Norbut committed 2019-05-20 12:48:14 -05:00
1 parent 0057f8f080
commit 082a241bb9
3 files changed
+9 -5

No files matched your search

@@ -20,11 +20,13 @@ namespace bts.shell {
internal class PAndLWindowFactory : ShellWindowFactory<PAndLWindowFactory.PAndLStartupData> {
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]
@@ -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);
}
@@ -18,13 +18,15 @@ namespace mbts.spark {
readonly IWindowSettingsManager<GridSettings> _settings_manager;
PAndLWindowFactory.PAndLStartupData _startup_data;
PAndLModel _model;
OrdersModel _orders_model;
PAndLView _view;
PAndLVM _vm;
PAndLWindowFactory _factory;
IReadOnlyList<SparkCommand> _commands;
public PAndLWindow(PAndLModel model, PAndLWindowFactory factory, IBus bus, PAndLWindowFactory.PAndLStartupData startup_data, ImageSource Icon, WindowSettingsManager<GridSettings> 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<GridSettings> 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<SparkCommand> {