From d76c2a30ceb4a9d1cf53227929eee176a862fc50 Mon Sep 17 00:00:00 2001 From: Jake Norbut Date: Tue, 16 Apr 2019 10:32:54 -0500 Subject: [PATCH] price_vs_piq property on LadderVM; appropriate changes for LadderOrderVM constructor --- src/client/spark/view/Spark/Ladder/LadderVM.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/client/spark/view/Spark/Ladder/LadderVM.cs b/src/client/spark/view/Spark/Ladder/LadderVM.cs index 5be07f911..0bf612489 100644 --- a/src/client/spark/view/Spark/Ladder/LadderVM.cs +++ b/src/client/spark/view/Spark/Ladder/LadderVM.cs @@ -26,7 +26,7 @@ namespace mbts.spark { readonly LadderModel _model; readonly Property _high, _low, _change, _open, _settlement, _position, _left_panel_width, _zoom_factor; //readonly Property _window_width, _window_height; - readonly Property _orders_column_width, _bid_column_width, _price_column_width, _ask_column_width, _last_column_width, _volume_column_width; + readonly Property _orders_column_width, _bid_column_width, _price_column_width, _ask_column_width, _last_column_width, _volume_column_width, _piq_column_width; readonly Property _volume; readonly Property _auto_clear, _show_day, _show_high, _show_low, _show_open, _show_settle, _show_volume, _show_account, _show_tif, _show_order_type, _show_account_position, _show_size_preset, _show_auto_clear, _show_clear, _show_cancel_buys, @@ -58,6 +58,7 @@ namespace mbts.spark { _price_column_width = backing(nameof(price_column_width), ws.price_column_width); _ask_column_width = backing(nameof(ask_column_width), ws.ask_column_width); _last_column_width = backing(nameof(last_column_width), ws.last_column_width); + _piq_column_width = backing(nameof(piq_column_width), ws.piq_column_width); _volume_column_width = backing(nameof(volume_column_width), ws.volume_column_width); _left_panel_width = backing(nameof(left_panel_width), ws.order_entry_panel_width); _zoom_factor = backing(nameof(zoom_factor), ws.zoom_factor); @@ -157,9 +158,9 @@ namespace mbts.spark { } if (_slot_price_vs_orders.TryGetValue(slot_price_target, out LadderOrderVM slot_vm)) { - slot_vm.add_order(wo); + slot_vm.add_order((wo, osec.piq)); } else { - slot_vm = new LadderOrderVM(wo, slot_price_target, this, _bus, _settings_manager.subscribe_current().Select(s => s.badge_style)); + slot_vm = new LadderOrderVM((wo, osec.piq), slot_price_target, this, _bus, _settings_manager.subscribe_current().Select(s => s.badge_style)); _slot_price_vs_orders[slot_price_target] = slot_vm; } @@ -232,6 +233,7 @@ namespace mbts.spark { public event Action on_tick; public MDConsumerHandle md => _model.md; + public IEnumerable<(double, uint)> price_vs_piq => _slot_price_vs_orders.Values.Where(result => result.min_piq.HasValue).Select(o => (o.price, o.min_piq.Value)); public bool is_synthetic => _model.security.ContractCase == Security.ContractOneofCase.Synthetic; Property _status; @@ -306,13 +308,14 @@ namespace mbts.spark { public uint price_column_width { get => _price_column_width.Value; set => _price_column_width.set(value); } public uint ask_column_width { get => _ask_column_width.Value; set => _ask_column_width.set(value); } public uint last_column_width { get => _last_column_width.Value; set => _last_column_width.set(value); } + public uint piq_column_width { get => _piq_column_width.Value; set => _piq_column_width.set(value); } public uint volume_column_width { get => _volume_column_width.Value; set => _volume_column_width.set(value); } internal LadderModel model => _model; internal IObservable settings => _settings_manager.subscribe_current(); public LadderSettings get_save_state() { var state = _settings_manager.current_settings(); - state = state.with_window_specifics(new LadderSettings.WindowSpecifics(left_panel_width, orders_column_width, bid_column_width, price_column_width, ask_column_width, last_column_width, volume_column_width, zoom_factor)); + state = state.with_window_specifics(new LadderSettings.WindowSpecifics(left_panel_width, orders_column_width, bid_column_width, price_column_width, ask_column_width, last_column_width, volume_column_width, zoom_factor, piq_column_width)); state.use_defaults = _settings_manager.instance_settings == null; return state; }