SPARK-2347 - badge mutliple orders to iterate over root orders, not orders

This commit is contained in:
Jake Norbut committed 2019-04-30 10:43:45 -05:00
1 parent 01dc0c004b
commit 11faa6ca36
1 file changed
+6 -6
@@ -42,7 +42,7 @@ namespace mbts.spark {
LadderSettings.BadgeStyle _current_badge_style;
int _n_active_price_change_ops = 0;
double _real_price = double.NaN, _phantom_price = double.NaN;
uint filled, quantity;
uint filled, quantity, num_root_orders;
int working_quantity;
LadderModel model => _parent.model;
@@ -98,10 +98,10 @@ namespace mbts.spark {
background = buy_sell_background_fill_color;
hoverbackground = mkbrush(dark, _darkbg, 0);
filled = 0;
filled = quantity = num_root_orders = 0;
working_quantity = 0;
quantity = 0;
foreach(var n in _root_nodes()) {
num_root_orders++;
filled += n.filled();
working_quantity += n.working_quantity();
quantity += n.quantity();
@@ -109,8 +109,8 @@ namespace mbts.spark {
// if this badge only represents a single order, then is_exchange_order and the border (= algo color)
// should be set appropriately
if (_orders.Count == 1) {
var single_order = _orders.Values.First();
if (num_root_orders == 1) {
var single_order = _root_nodes().First();
var single_order_metadata = _parent.model.order_gateway.factory.get_metadata(single_order);
border = single_order_metadata.Color.rgb_brush();
if (single_order.order_type().is_bts_algo_type()) {
@@ -122,7 +122,7 @@ namespace mbts.spark {
} else {
border = new SolidColorBrush(color);
}
has_multiple_orders_at_same_level = _orders.Count > 1;
has_multiple_orders_at_same_level = num_root_orders > 1;
is_hedge_order = _orders.Any(o => o.Value.sub_type() == OrderSubType.HedgingLeg);
if (_orders.Any()) {