From 69e2bcb164bdba8a476818f849ca93ccaf662124 Mon Sep 17 00:00:00 2001 From: Jake Norbut Date: Tue, 30 Apr 2019 12:51:29 -0500 Subject: [PATCH] badge - misc refactoring --- .../Trading/Ladder/VM/LadderOrderVM.cs | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/client/spark/Modules/Trading/Ladder/VM/LadderOrderVM.cs b/src/client/spark/Modules/Trading/Ladder/VM/LadderOrderVM.cs index 4adbb9dca..3dc2be13e 100644 --- a/src/client/spark/Modules/Trading/Ladder/VM/LadderOrderVM.cs +++ b/src/client/spark/Modules/Trading/Ladder/VM/LadderOrderVM.cs @@ -29,7 +29,7 @@ namespace mbts.spark { } #endregion - readonly LadderVM _parent; + readonly LadderVM _owner; readonly IBus _bus; readonly Property _font_family; readonly Property _font_weight; @@ -44,20 +44,20 @@ namespace mbts.spark { uint filled, quantity, num_root_orders; int working_quantity; - LadderModel model => _parent.model; + LadderModel model => _owner.model; Dictionary _orders = new Dictionary(); - public LadderOrderVM(OrderRecordImmutable o, double real_price, LadderVM parent, IBus bus, IObservable bs) { - _parent = parent; + public LadderOrderVM(OrderRecordImmutable o, double real_price, LadderVM owner, IBus bus, IObservable bs) { + _owner = owner; _bus = bus; _bs = bs; _real_price = real_price; // settings var fs = UserSettings.factory_defaults.ladder; - _font_family = backing(nameof(font_family), parent.settings, get_font_family, get_font_family(fs)); - _font_weight = backing(nameof(font_weight), parent.settings, get_font_weight, get_font_weight(fs)); - _font_size = backing(nameof(font_size), parent.settings, get_font_size, get_font_size(fs)); - _foreground = backing(nameof(foreground), parent.settings, get_foreground, get_foreground(fs)); + _font_family = backing(nameof(font_family), owner.settings, get_font_family, get_font_family(fs)); + _font_weight = backing(nameof(font_weight), owner.settings, get_font_weight, get_font_weight(fs)); + _font_size = backing(nameof(font_size), owner.settings, get_font_size, get_font_size(fs)); + _foreground = backing(nameof(foreground), owner.settings, get_foreground, get_foreground(fs)); _background = backing(nameof(background), _color_bg_brush); _hoverbackground = backing(nameof(hoverbackground), _color_bg_brush); _border = backing(nameof(border), _color_bg_brush); @@ -109,7 +109,7 @@ namespace mbts.spark { // should be set appropriately if (num_root_orders == 1) { var single_order = _root_nodes().First(); - var single_order_metadata = _parent.model.order_gateway.factory.get_metadata(single_order); + var single_order_metadata = _owner.model.order_gateway.factory.get_metadata(single_order); border = single_order_metadata.Color.rgb_brush(); if (single_order.order_type().is_bts_algo_type()) { algo_type = single_order.order_type(); @@ -147,7 +147,7 @@ namespace mbts.spark { // } //} - public uint security_key => _parent.security.Id; + public uint security_key => _owner.security.Id; public double price { get => double.IsNaN(_phantom_price) ? _real_price : _phantom_price; } public double real_price => _real_price; public Side side { @@ -160,7 +160,7 @@ namespace mbts.spark { } } - IEnumerable _root_nodes() => _orders.Values.Select(_parent.get_root_at_price).DistinctOn(OrderUtils.RecordKeySelector); + IEnumerable _root_nodes() => _orders.Values.Select(_owner.get_root_at_price).DistinctOn(OrderUtils.RecordKeySelector); public IReadOnlyList text_lines { get; private set; } @@ -202,7 +202,7 @@ namespace mbts.spark { _phantom_price = new_price; RaisePropertyChanged(nameof(price)); ++_n_active_price_change_ops; - if (await _parent.model.order_gateway.update_order(order, new_price, order.State.Quantity)) { + if (await _owner.model.order_gateway.update_order(order, new_price, order.State.Quantity)) { // wait 3 secs, then give up if price change still hasn't taken effect await Task.Delay(3000); } @@ -224,10 +224,10 @@ namespace mbts.spark { price_filter.minimum.value = real_price; price_filter.maximum.value = real_price; - var obvm = new OrderBookVM(null, _parent.bus, null, _parent.model.order_gateway, null, true); + var obvm = new OrderBookVM(null, _owner.bus, null, _owner.model.order_gateway, null, true); var state = new bts.shell.orderbook.OrderBookStartupData( new bts.shell.orderbook.FilterStates { - security_criteria = new SecurityCriteria(_parent.security), + security_criteria = new SecurityCriteria(_owner.security), price = price_filter, statuses = new[] { OrderStatus.Working } },