SPARK-1553

This commit is contained in:
Jake Norbut committed 2018-08-17 09:31:27 -05:00
1 parent 15f40805e5
commit ac182d8f83
3 files changed
+11 -11

No files matched your search

@@ -147,9 +147,9 @@ namespace mbts.spark {
}
public static string order_sub_type_display_name(OrderSubType sub_type, bool use_long_name) {
switch(sub_type) {
switch (sub_type) {
case OrderSubType.HedgingLeg:
return use_long_name ? "Hedging (H)": "H";
return use_long_name ? "Hedging (H)" : "H";
case OrderSubType.QuotingLeg:
return use_long_name ? "Quoting (Q)" : "Q";
case OrderSubType.None:
@@ -158,5 +158,11 @@ namespace mbts.spark {
return string.Empty;
}
}
public static bool is_exchange_order(this OrderRecordImmutable order) {
// testing only
// this should be merged out when the badges move to master
return true;
}
}
}
@@ -100,28 +100,23 @@ namespace mbts.spark {
parent_algo_type_brush = parent_algo_metadata.Color.rgb_brush();
var buy_sell_background_fill_color = new SolidColorBrush(color);
buy_sell_background_fill_color.Freeze();
background = buy_sell_background_fill_color; //_color_bg_brush; //mkbrush(color, _colorbg, 0);
background = buy_sell_background_fill_color;
hoverbackground = mkbrush(dark, _darkbg, 0);
border = new SolidColorBrush(color);
filled = _parent_and_child_not_sharing_slot().Select(order => OrderUtils.filled(order)).Sum();
working_quantity = _parent_and_child_not_sharing_slot().Select(order => order.working_quantity()).Sum();
quantity = _parent_and_child_not_sharing_slot().Select(order => order.State.Quantity).Sum();
// TODO: call the appropriate taha-provided function for is_exchange_order in the future
is_exchange_order = taha_function_stub();
is_exchange_order = _orders.Count == 1 ? OrderUtils.is_exchange_order(_orders.Values.First()) : false;
is_multiple_orders_at_same_level = _orders.Count > 1;
is_hedge_order = _orders.Any(o => o.Value.sub_type() == OrderSubType.HedgingLeg);
if (_orders.Count > 0)
{
if (_orders.Count > 0) {
summary = _orders.Values.Select(order => order.short_description(_parent.security.ContractSpec)).Aggregate((s1, s2) => $"{s1}{Environment.NewLine}{Environment.NewLine}{s2}");
description = _orders.Values.Select(order => order.full_description(_parent.security)).Aggregate((s1, s2) => $"{s1}{Environment.NewLine}{Environment.NewLine}{s2}");
}
_set_badge_text();
bool taha_function_stub() {
return true;
}
}
private void _set_badge_text() {
@@ -130,7 +130,6 @@ namespace mbts.spark {
var traversal_candidate = only_order;
bool exit_early = false;
while (!exit_early && traversal_candidate.ParentKey != 0) {
// TODO this needs to be a hashtable lookup
var found_parent = working.Where(o => o.Key == traversal_candidate.ParentKey);
if (found_parent.Count() == 1)
traversal_candidate = found_parent.First().Value;