Fixing completion since returning the a double will not really work summing over multiple ordres (0 screws it up); also, no more Opacity

This commit is contained in:
Jake Norbut committed 2018-05-30 16:26:33 -05:00
1 parent 7990c97921
commit 8cdbf873cd
3 files changed
+15 -3

No files matched your search

@@ -20,6 +20,20 @@ namespace mbts.spark {
return double.NaN;
}
public static uint fill_ratio_numerator(OrderRecordImmutable order) {
if (order.HasState) {
return order.State.FilledQuantity;
}
return 0u;
}
public static double fill_ratio_denominator(OrderRecordImmutable order) {
if (order.HasState) {
return order.State.Quantity;
}
return double.NaN;
}
public static int working_quantity(this OrderRecordImmutable order) =>
order.HasState ? (int)order.State.Quantity - (int)order.State.FilledQuantity : 0;
@@ -80,7 +80,7 @@ namespace mbts.spark {
if (side == Side.Sell) color = BTSColors.MarketData.ask;
var darker = BTSColor.darken2(color.R, color.G, color.B, 0.75);
Color dark = new Color() { A = 255, R = darker.r, G = darker.g, B = darker.b };
var completion = _orders.Values.Sum(order => OrderUtils.fill_ratio(order));
var completion = _parent_and_child_not_sharing_slot().Sum(order => OrderUtils.fill_ratio_numerator(order)) / _parent_and_child_not_sharing_slot().Sum(order => OrderUtils.fill_ratio_denominator(order));
background = mkbrush(color, _colorbg, completion);
hoverbackground = mkbrush(dark, _darkbg, completion);
border = new SolidColorBrush(color);
@@ -197,7 +197,6 @@ namespace mbts.spark {
public Brush hoverbackground { get; private set; }
public Brush header_brush => _orders.Values.FirstOrDefault().Def.Side == Side.Buy ? BTSColors.MarketData.bid : BTSColors.MarketData.ask;
public Brush border { get; private set; }
public double opacity => has_parent ? 0.5 : 1.0;
public IEnumerable<OrderRecordImmutable> orders => _orders.Values;
void _cancel_order() {
@@ -431,7 +431,6 @@
<Setter Property="Margin" Value="4,0,0,0" />
<Setter Property="ToolTip" Value="{Binding description}" />
<Setter Property="CornerRadius" Value="1" />
<Setter Property="Opacity" Value="{Binding opacity}" />
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="ContextMenu">
<Setter.Value>