Compare commits

..
Author SHA1 Message Date
John Colvin fda812d792 ui (dj): Reduce opacity of session range layer in ladder 2021-02-11 23:03:53 -06:00
John Colvin 1bf9d0aa4a ui (dj): Replace hand cursor with arrow in ladder bid/ask 2021-02-11 22:57:48 -06:00
John Colvin 54eec61f46 ui (dj): Make ladder look more like tt
These changes can be configured via LadderKnobs (defined in UI.proto)
2021-02-11 22:57:40 -06:00
Pete Fisher b84ba1d3f5 changed ICEMain.cpp from NonImplied to FullImplied 2021-02-03 10:26:47 -05:00
John Colvin 70bf5e0c95 fix: Correct visibility binding in ladder session high/low
The other price points visibility bindings were refactored
in a similar manner, for consistency's sake.
2021-01-14 11:06:17 -06:00
John Colvin 2bae938549 feat (DJ): Right align bid, price, and ask column text in ladder
This is hardcoded (not configurable via settings).
2021-01-14 10:12:04 -06:00
9 changed files with 230 additions and 86 deletions

No files matched your search

@@ -328,7 +328,7 @@ namespace mbts.spark {
[ProtoContract]
class LadderPanelPricePointSettings : IEquatable<LadderPanelPricePointSettings> {
public static LadderPanelPricePointSettings Default =>
public static LadderPanelPricePointSettings historic_default =>
new LadderPanelPricePointSettings {
day_change = new DaySettings {
// (neutral)
@@ -348,6 +348,18 @@ namespace mbts.spark {
volume = _default_item
};
public static LadderPanelPricePointSettings tt_default {
get {
var rv = historic_default;
rv.day_change.background_color = Color.FromRgb(113, 201, 69).rgb_color();
rv.day_change.font.font_color = Colors.Black.rgb_color();
return rv;
}
}
public static LadderPanelPricePointSettings Default => LadderSettings.mimic_tt ?
tt_default : historic_default;
[ProtoMember(1)]
public DaySettings day_change { get; set; }
[ProtoMember(2)]
@@ -466,6 +478,11 @@ namespace mbts.spark {
static readonly int _type_hash = typeof(LadderSettings).GetHashCode();
uint _ticks_per_row;
static LadderSettings() {
var knobs = config.Configuration.get<bts.config.LadderKnobs>();
mimic_tt = knobs.mimic_tt;
}
// Default proto constructor
// Added this so that when clients upgrade to a version with new settings,
// the default values are applied correctly; thx to John for this tip
@@ -496,8 +513,10 @@ namespace mbts.spark {
enforce_max_clip = _default_enforce_max_clip;
status_message_visible = true;
}
public static bool mimic_tt { get; }
public static LadderSettings Default {
public static LadderSettings historic_default {
get {
LadderColumnSettings
orders_column = LadderColumnSettings.DefaultOrderColumnSettings,
@@ -569,6 +588,22 @@ namespace mbts.spark {
return rv;
}
}
public static LadderSettings tt_default {
get {
var rv = historic_default;
rv.orders_column.background = Color.FromRgb(223, 223, 223).rgb_color();
rv.price_column.background = Color.FromRgb(166, 166, 166).rgb_color();
rv.price_column.foreground = Colors.White.rgb_color();
rv.bid_column.background = Color.FromRgb(0, 30, 160).rgb_color();
rv.ask_column.background = Color.FromRgb(160, 0, 0).rgb_color();
rv.ask_column.foreground = Colors.Black.rgb_color();
return rv;
}
}
public static LadderSettings Default => mimic_tt ?
tt_default : historic_default;
public enum BadgeStyle { Normal, Alternate }
@@ -34,9 +34,18 @@ namespace mbts.spark {
readonly Property<uint> _orders_column_width, _bid_column_width, _price_column_width, _ask_column_width, _last_column_width, _volume_column_width, _piq_column_width;
readonly Property<ulong> _volume;
readonly Property<bool> _auto_clear;
readonly PropertyAutoWrapper<LadderSettings, bool> _show_day, _show_high, _show_low, _show_open, _show_settlement, _show_volume, _show_account,
_show_tif, _show_order_type, _show_size_preset, _show_auto_clear, _show_clear, _show_cancel_buys,
_show_cancel_sells, _show_cancel_all, _show_zoom, _show_status_message;
readonly PropertyAutoWrapper<LadderSettings, bool>
_show_account,
_show_tif,
_show_order_type,
_show_size_preset,
_show_auto_clear,
_show_clear,
_show_cancel_buys,
_show_cancel_sells,
_show_cancel_all,
_show_zoom,
_show_status_message;
readonly PropertyAutoWrapper<LadderSettings, Brush> _bid_background, _bid_foreground, _ask_background, _ask_foreground;
double
_position,
@@ -109,12 +118,6 @@ namespace mbts.spark {
(_ask_background = brush_prop(nameof(ask_background), s => s.ask_column.background)).set,
(_ask_foreground = brush_prop(nameof(ask_foreground), s => s.ask_column.foreground)).set,
// bool visibility props
(_show_day = bool_prop(nameof(show_day), s => s.day_visible)).set,
(_show_high = bool_prop(nameof(show_high), s => s.high_visible)).set,
(_show_low = bool_prop(nameof(show_low), s => s.low_visible)).set,
(_show_open = bool_prop(nameof(show_open), s => s.open_visible)).set,
(_show_settlement = bool_prop(nameof(show_settlement), s => s.settle_visible)).set,
(_show_volume = bool_prop(nameof(show_volume), s => s.volume_visible)).set,
(_show_account = bool_prop(nameof(show_account), s => s.account_visible)).set,
(_show_tif = bool_prop(nameof(show_tif), s => s.tif_visible)).set,
(_show_order_type = bool_prop(nameof(show_order_type), s => s.order_type_visible)).set,
@@ -147,11 +150,23 @@ namespace mbts.spark {
_volume_column_width.set(s.volume_column.general.width);
// left panel/zoom
day_change_style.load_from(s.panel_price_point_settings.day_change);
day_change_style.show = s.day_visible;
// open
open_style.load_from(s.panel_price_point_settings.open);
open_style.show = s.open_visible;
// session low
session_low_style.load_from(s.panel_price_point_settings.session_low);
session_low_style.show = s.low_visible;
// session high
session_high_style.load_from(s.panel_price_point_settings.session_high);
session_high_style.show = s.high_visible;
// settlement
settlement_style.load_from(s.panel_price_point_settings.settlement);
settlement_style.show = s.settle_visible;
// volume
volume_style.load_from(s.panel_price_point_settings.volume);
volume_style.show = s.volume_visible;
// left panel gen display
_left_panel_width.set(s.order_entry_panel_initial_width);
_zoom_factor.set(s.zoom_factor);
RaisePropertyChanged(nameof(day_change_font_color), nameof(day_change_background_color));
@@ -325,12 +340,6 @@ namespace mbts.spark {
public Brush bid_foreground => _bid_foreground.view;
public Brush ask_background => _ask_background.view;
public Brush ask_foreground => _ask_foreground.view;
public bool show_day => _show_day.view;
public bool show_high => _show_high.view;
public bool show_low => _show_low.view;
public bool show_open => _show_open.view;
public bool show_settlement => _show_settlement.view;
public bool show_volume => _show_volume.view;
public bool show_account => _show_account.view;
public bool show_tif => _show_tif.view;
public bool show_order_type => _show_order_type.view;
@@ -29,8 +29,10 @@ using System.Windows.Media.Animation;
namespace mbts.spark {
partial class LadderGridHost : Control {
const int _min_row_count = 501, _max_row_count = 2001;
static readonly bool _show_scrollbar = config.Configuration.get<bts.config.LadderKnobs>().show_scrollbar;
static readonly bool _lighten_market_cells = config.Configuration.get<bts.config.LadderKnobs>().lighten_market_cells;
static readonly bool _show_scrollbar;
static readonly bool _lighten_market_cells;
static readonly Color? _bid_market_cell_background;
static readonly Color? _ask_market_cell_background;
int _row_count = _min_row_count;
@@ -77,6 +79,19 @@ namespace mbts.spark {
ToolTip tooltip_view = new ToolTip();
IDisposable _parameterized_order_popup;
static LadderGridHost() {
var knobs = config.Configuration.get<bts.config.LadderKnobs>();
_show_scrollbar = knobs.show_scrollbar;
_lighten_market_cells = knobs.lighten_market_cells;
// For market cell backgrounds, 0 means null. Note that the full
// range of colors can still be expressed, as zero is merely one of
// 2^24 possible representations of 'transparent.'
if (knobs.bid_market_cell_background != 0)
_bid_market_cell_background = knobs.bid_market_cell_background.argb_color();
if (knobs.ask_market_cell_background != 0)
_ask_market_cell_background = knobs.ask_market_cell_background.argb_color();
}
public LadderGridHost() {
AllowDrop = true;
UseLayoutRounding = true;
@@ -638,7 +653,9 @@ namespace mbts.spark {
if (_price_list != null) {
switch (column.column_type) {
case ColumnType.Order: _ordershost.set_col_width(column.settings.width); break;
case ColumnType.Bid: render_market_col(_bids); break;
case ColumnType.Bid:
render_market_col(_bids, _bid_market_cell_background);
break;
case ColumnType.Price:
if (_settings.net_change != LadderSettings.NetChangeTerms.None) {
LadderRender.render_prices(
@@ -663,7 +680,9 @@ namespace mbts.spark {
_settings.price_display_format);
}
break;
case ColumnType.Ask: render_market_col(_asks); break;
case ColumnType.Ask:
render_market_col(_asks, _ask_market_cell_background);
break;
case ColumnType.Volume:
_volume_container.mark_dirty();
_refresh_volume_at_price();
@@ -675,9 +694,9 @@ namespace mbts.spark {
if (_mkt_break_lines.high_render_index.HasValue)
_render_session_line(_session_high_vis, _mkt_break_lines.high_render_index.Value, _settings.session_high_line.color);
}
void render_market_col(NativePriceSize[] depth) {
void render_market_col(NativePriceSize[] depth, Color? market_cell_background) {
var mid = LadderRender.index_of(_price_list, _last_origin_price, _price_comparer);
LadderRender.render_sizes(column.visual_tup.visual, column.visual_tup.glyph_context, mid, _price_list, depth, _settings.row_height, _spec, column.settings, _fmt_mkt_depth_item, _lighten_market_cells);
LadderRender.render_sizes(column.visual_tup.visual, column.visual_tup.glyph_context, mid, _price_list, depth, _settings.row_height, _spec, column.settings, _fmt_mkt_depth_item, _lighten_market_cells, market_cell_background);
}
}
_apply_column_visual_offset();
@@ -969,8 +988,8 @@ namespace mbts.spark {
void _refresh_sizes() {
Log.assert_d(_price_list != null);
int origin_index = LadderRender.index_of(_price_list, _mkt_break_lines.origin, _price_comparer);
LadderRender.render_sizes(_bid_vis_tup.visual, _bid_vis_tup.glyph_context, origin_index, _price_list, _bids, _settings.row_height, _spec, _settings.bid_column, _fmt_mkt_depth_item, _lighten_market_cells);
LadderRender.render_sizes(_ask_vis_tup.visual, _ask_vis_tup.glyph_context, origin_index, _price_list, _asks, _settings.row_height, _spec, _settings.ask_column, _fmt_mkt_depth_item, _lighten_market_cells);
LadderRender.render_sizes(_bid_vis_tup.visual, _bid_vis_tup.glyph_context, origin_index, _price_list, _bids, _settings.row_height, _spec, _settings.bid_column, _fmt_mkt_depth_item, _lighten_market_cells, _bid_market_cell_background);
LadderRender.render_sizes(_ask_vis_tup.visual, _ask_vis_tup.glyph_context, origin_index, _price_list, _asks, _settings.row_height, _spec, _settings.ask_column, _fmt_mkt_depth_item, _lighten_market_cells, _ask_market_cell_background);
}
/// <summary>
@@ -43,7 +43,9 @@ namespace mbts.spark {
static class LadderRender {
// Note: the orders-column has a separate "row_padding" value: Badge.DefaultMargin
// (see how it is incorporated in measure_row_height() below)
public static readonly Thickness row_padding = new Thickness(6);
public static Thickness row_padding => LadderSettings.mimic_tt ?
new Thickness(4, 2, 4, 2) : new Thickness(6);
const string tick_separator_period = ".";
const string tick_separator_dash = "-";
const int GRID_LINE_HEIGHT = 1;
@@ -59,11 +61,20 @@ namespace mbts.spark {
public static int index_of(double[] prices, double price, IComparer<double> comparer) =>
Array.BinarySearch(prices, price, comparer);
public static GlyphRun format_text(string text, int row, double row_height, LadderColumnSettings settings, GlyphContext glyph_context, LadderSettings.PriceDisplayFormat price_display_format = LadderSettings.PriceDisplayFormat.Default) =>
public static GlyphRun format_text(
string text,
int row,
double row_height,
LadderColumnSettings settings,
GlyphContext glyph_context,
LadderSettings.PriceDisplayFormat price_display_format = LadderSettings.PriceDisplayFormat.Default) =>
glyph_context.get_glyph_run(
// long term there is probably a better way to get rid of the separator, such as in the TickExtensions._format_tick
price_display_format == LadderSettings.PriceDisplayFormat.Integer ? text.Replace(tick_separator_period, string.Empty).Replace(tick_separator_dash, string.Empty) : text,
settings.font_size, settings.width, row_height, HorizontalAlignment.Center, 0, VerticalAlignment.Center, row * row_height, true);
price_display_format == LadderSettings.PriceDisplayFormat.Integer ?
text.Replace(tick_separator_period, string.Empty).Replace(tick_separator_dash, string.Empty) :
text,
settings.font_size, settings.width, row_height, HorizontalAlignment.Right,
-4, VerticalAlignment.Center, row * row_height, true);
public static double[] gen_prices(double mid, int row_count, ContractSpecificationImmutable spec) {
// require odd number
@@ -172,10 +183,17 @@ namespace mbts.spark {
ContractSpecificationImmutable spec,
LadderColumnSettings settings,
Func<NativePriceSize, string> fmt,
bool lighten_market_cells) {
bool lighten_market_cells,
Color? market_cell_background) {
//var background = new SolidColorBrush(settings.background.rgb_color());
var mkt_background = lighten_market_cells ?
settings.background.rgb_color().blend_with(Colors.White).to_brush() : null;
Brush market_cell_background_brush;
if (market_cell_background.HasValue) {
market_cell_background_brush = new SolidColorBrush(market_cell_background.Value);
} else if (lighten_market_cells) {
market_cell_background_brush = settings.background.rgb_color().blend_with(Colors.White).to_brush();
} else {
market_cell_background_brush = null;
}
using (var dc = dv.RenderOpen())
using (_draw_with_clip(dc, settings, row_height, prices.Length)) {
//dc.DrawRectangle(background, null, new Rect(0, 0, settings.width, prices.Length * row_height));
@@ -205,8 +223,8 @@ namespace mbts.spark {
curr_index += tick_diff;
curr_price = price;
if (curr_index >= 0 && curr_index < prices.Length) {
if (mkt_background != null)
dc.DrawRectangle(mkt_background, null,
if (market_cell_background_brush != null)
dc.DrawRectangle(market_cell_background_brush, null,
new Rect(0, curr_index * row_height + GRID_LINE_HEIGHT,
settings.width, row_height - GRID_LINE_HEIGHT));
var gr = format_text(fmt(rung), curr_index, row_height, settings, glyph_context);
@@ -394,7 +412,7 @@ namespace mbts.spark {
public static void render_session_range(DrawingVisual dv, uint color, LadderColumnSettings settings, int low_index, int high_index, double[] prices, double row_height) {
using (var dc = dv.RenderOpen())
using (_draw_with_clip(dc, settings, row_height, prices.Length))
dc.DrawRectangle(new SolidColorBrush(color.rgb_color()) { Opacity = 0.2 }, null, new Rect(0, high_index * row_height, settings.width, (low_index - high_index) * row_height));
dc.DrawRectangle(new SolidColorBrush(color.rgb_color()) { Opacity = 0.1 }, null, new Rect(0, high_index * row_height, settings.width, (low_index - high_index) * row_height));
}
static GlyphRun[] _format_empty_prices(int row_count, double row_height, LadderColumnSettings settings, GlyphContext glyph_context) {
@@ -126,9 +126,12 @@ namespace mbts.spark {
return Cursors.Arrow;
switch (column.column_type) {
case ColumnType.Bid:
case ColumnType.Ask: return _can_send_orders ? Cursors.Hand : Cursors.No;
default: return Cursors.Arrow;
case ColumnType.Ask:
if (!_can_send_orders)
return Cursors.No;
break;
}
return Cursors.Arrow;
}
#region UI Event Handlers
@@ -141,7 +141,61 @@
<Setter Property="Margin" Value="2,0,2,5"/>
<Setter Property="Padding" Value="2"/>
</Style>
<Style x:Key="CancelAll" TargetType="Button" BasedOn="{StaticResource LadderMenuButton}">
<Setter Property="Grid.Row" Value="2" />
<Setter Property="Content">
<Setter.Value>
<TextBlock VerticalAlignment="Center">Cancel All</TextBlock>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
x:Name="Border"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{mbts:BTSColor UI.Button.normal_border}"
Background="{mbts:BTSColor UI.Button.normal_background}"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="True">
<ContentPresenter
HorizontalAlignment="Center"
VerticalAlignment="Center"
RecognizesAccessKey="True"
Name="button_content"
/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Border" Property="Background" Value="{mbts:BTSColor UI.Button.mouseover_background}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{mbts:BTSColor UI.Button.mouseover_border}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TT_CancelAll" TargetType="Button" BasedOn="{StaticResource CancelAll}">
<Setter Property="Grid.Row" Value="0"/>
</Style>
<Style x:Key="TT_CancelBuys" TargetType="Button" BasedOn="{StaticResource CancelAll}">
<Setter Property="Grid.Row" Value="1" />
<Setter Property="Content">
<Setter.Value>
<TextBlock VerticalAlignment="Center">Cancel Buys</TextBlock>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TT_CancelSells" TargetType="Button" BasedOn="{StaticResource CancelAll}">
<Setter Property="Grid.Row" Value="2" />
<Setter Property="Content">
<Setter.Value>
<TextBlock VerticalAlignment="Center">Cancel Sells</TextBlock>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="CancelBuys" TargetType="Button" BasedOn="{StaticResource LadderMenuButton}">
<Setter Property="Grid.Row" Value="0" />
<Setter Property="Content">
<Setter.Value>
<TextBlock VerticalAlignment="Center" Foreground="{Binding bid_foreground}">Cancel Buys</TextBlock>
@@ -177,6 +231,7 @@
</Style>
<Style x:Key="CancelSells" TargetType="Button" BasedOn="{StaticResource LadderMenuButton}">
<Setter Property="Background" Value="{mbts:BTSColor MarketData.ask}" />
<Setter Property="Grid.Row" Value="1" />
<Setter Property="Content">
<Setter.Value>
<TextBlock VerticalAlignment="Center" Foreground="{Binding ask_foreground}">Cancel Sells</TextBlock>
@@ -210,39 +265,6 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="CancelAll" TargetType="Button" BasedOn="{StaticResource LadderMenuButton}">
<Setter Property="Content">
<Setter.Value>
<TextBlock VerticalAlignment="Center">Cancel All</TextBlock>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
x:Name="Border"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{mbts:BTSColor UI.Button.normal_border}"
Background="{mbts:BTSColor UI.Button.normal_background}"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="True">
<ContentPresenter
HorizontalAlignment="Center"
VerticalAlignment="Center"
RecognizesAccessKey="True"
Name="button_content"
/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Border" Property="Background" Value="{mbts:BTSColor UI.Button.mouseover_background}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{mbts:BTSColor UI.Button.mouseover_border}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SettingsButton" TargetType="Button" BasedOn="{StaticResource LadderMenuButton}">
<Setter Property="Content">
<Setter.Value>
@@ -372,7 +394,7 @@
<Border
Grid.Row="0"
Background="{Binding day_change_background_color, Converter={x:Static converters:ColorToBrushConverter.Instance}}"
Visibility="{Binding show_day_change, Converter={StaticResource BooleanToVisibilityConverter}}"
Visibility="{Binding day_change_style.show, Converter={StaticResource BooleanToVisibilityConverter}}"
ToolTip="Day Change"
Style="{StaticResource LeftPanelPricePointBorder}"
>
@@ -403,7 +425,7 @@
<Border
Grid.Row="1"
Background="{Binding volume_style.background_color, Converter={x:Static converters:ColorToBrushConverter.Instance}}"
Visibility="{Binding show_volume, Converter={StaticResource BooleanToVisibilityConverter}}"
Visibility="{Binding volume_style.show, Converter={StaticResource BooleanToVisibilityConverter}}"
ToolTip="Volume"
Style="{StaticResource LeftPanelPricePointBorder}"
>
@@ -438,7 +460,7 @@
<Border
Grid.Row="2"
Background="{Binding session_high_style.background_color, Converter={x:Static converters:ColorToBrushConverter.Instance}}"
Visibility="{Binding show_session_high, Converter={StaticResource BooleanToVisibilityConverter}}"
Visibility="{Binding session_high_style.show, Converter={StaticResource BooleanToVisibilityConverter}}"
ToolTip="Session High"
Style="{StaticResource LeftPanelPricePointBorder}"
>
@@ -467,7 +489,7 @@
<Border
Grid.Row="3"
Background="{Binding session_low_style.background_color, Converter={x:Static converters:ColorToBrushConverter.Instance}}"
Visibility="{Binding show_session_low, Converter={StaticResource BooleanToVisibilityConverter}}"
Visibility="{Binding session_low_style.show, Converter={StaticResource BooleanToVisibilityConverter}}"
ToolTip="Session Low"
Style="{StaticResource LeftPanelPricePointBorder}"
>
@@ -496,7 +518,7 @@
<Border
Grid.Row="4"
Background="{Binding open_style.background_color, Converter={x:Static converters:ColorToBrushConverter.Instance}}"
Visibility="{Binding show_open, Converter={StaticResource BooleanToVisibilityConverter}}"
Visibility="{Binding open_style.show, Converter={StaticResource BooleanToVisibilityConverter}}"
ToolTip="Open"
Style="{StaticResource LeftPanelPricePointBorder}"
>
@@ -525,7 +547,7 @@
<Border
Grid.Row="5"
Background="{Binding settlement_style.background_color, Converter={x:Static converters:ColorToBrushConverter.Instance}}"
Visibility="{Binding show_settlement, Converter={StaticResource BooleanToVisibilityConverter}}"
Visibility="{Binding settlement_style.show, Converter={StaticResource BooleanToVisibilityConverter}}"
ToolTip="Settlement"
Style="{StaticResource LeftPanelPricePointBorder}"
>
@@ -669,15 +691,20 @@
</ItemsPanelTemplate>
</uag:AlgoTemplateFavoriteButtonsView.ItemsPanel>
</uag:AlgoTemplateFavoriteButtonsView>
<StackPanel Margin="0,17,0,0" VerticalAlignment="Top">
<Grid Margin="0,17,0,0" VerticalAlignment="Top">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Cancel Buttons -->
<Button Command="{Binding cancel_command}" CommandParameter="Bids" Style="{StaticResource CancelBuys}"
<Button Command="{Binding cancel_command}" CommandParameter="Bids" Style="{StaticResource {x:Static spark:LadderView.CancelBuysButtonStyleKey}}"
Visibility="{Binding show_cancel_buys, Converter={StaticResource BooleanToVisibilityConverter}}"/>
<Button Command="{Binding cancel_command}" CommandParameter="Asks" Style="{StaticResource CancelSells}"
<Button Command="{Binding cancel_command}" CommandParameter="Asks" Style="{StaticResource {x:Static spark:LadderView.CancelSellsButtonStyleKey}}"
Visibility="{Binding show_cancel_sells, Converter={StaticResource BooleanToVisibilityConverter}}"/>
<Button Command="{Binding cancel_command}" CommandParameter="All" Style="{StaticResource CancelAll}"
<Button Command="{Binding cancel_command}" CommandParameter="All" Style="{StaticResource {x:Static spark:LadderView.CancelAllButtonStyleKey}}"
Visibility="{Binding show_cancel_all, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</StackPanel>
</Grid>
<StackPanel Grid.Row="1" Margin="0,17,0,0" VerticalAlignment="Bottom">
<!-- Settings Button -->
<Button Command="{Binding settings_command}" Style="{StaticResource SettingsButton}"/>
@@ -22,6 +22,22 @@ namespace mbts.spark {
MaxLeftPanelWidth = 150,
MinZoomFactor = 0.5,
MaxZoomFactor = 1.5;
static LadderView() {
var knobs = config.Configuration.get<bts.config.LadderKnobs>();
MimicTT = knobs.mimic_tt;
}
public static bool MimicTT { get; }
public static string CancelBuysButtonStyleKey =>
MimicTT ? "TT_CancelBuys" : "CancelBuys";
public static string CancelSellsButtonStyleKey =>
MimicTT ? "TT_CancelSells" : "CancelSells";
public static string CancelAllButtonStyleKey =>
MimicTT ? "TT_CancelAll" : "CancelAll";
public static IMultiValueConverter PositionToolTipConverter =
ValueConverter.create<AccountTuple?, bool, bool, bool, string>((account, show_day_pos, show_raw_day_pos, show_total_pos) => {
@@ -253,4 +269,4 @@ namespace mbts.spark {
}
}
}
}
+18 -1
View File
@@ -76,6 +76,23 @@ message LadderKnobs {
// DJ wants bid/ask cells with markets (i.e., size > 0) to have a
// lighter background than those without markets.
optional bool lighten_market_cells = 10 [default = true];
// For market cell backgrounds, 0 means 'ignore this color setting'
// (i.e., employ the ladder's default behavior instead).
//
// Note that despite reserving the value 0 as a flag, the full range of
// colors can still be expressed. Zero is one of 2^24 representations
// of 'transparent.'
//
// The channels alpha, red, green, and blue are stored in the
// 1-4th bytes respectively. For example:
// Transparent: 0x00XXXXXX (any value with the first byte set to 0)
// Pure Red : 0xFFFF0000
// Pure Blue : 0xFF00FF00
// Pure Green : 0xFF0000FF
optional uint32 bid_market_cell_background = 11;
optional uint32 ask_market_cell_background = 12;
optional bool mimic_tt = 13 [default = true];
}
message OrderBookOptions {
@@ -182,4 +199,4 @@ message SymbolUIConfigurationItem {
message SymbolUIConfiguration {
repeated SymbolUIConfigurationItem items = 1;
}
}
@@ -74,15 +74,15 @@ onixs_ice::MarketSubscriptions market_subcription_for_channel(const ICEChannel&
onixs_ice::MarketSubscriptions subs;
for(const auto& x : chan.market_types)
{
onixs_ice::MarketSubscription futures(x, onixs_ice::MarketSubType::NonImplied, onixs_ice::SecurityType::Futures, onixs_ice::BookDepth::FOD);
onixs_ice::MarketSubscription futures(x, onixs_ice::MarketSubType::FullImplied, onixs_ice::SecurityType::Futures, onixs_ice::BookDepth::FOD);
subs.push_back(futures);
onixs_ice::MarketSubscription spreads(x, onixs_ice::MarketSubType::NonImplied, onixs_ice::SecurityType::UdsFuturesMarkets, onixs_ice::BookDepth::FOD);
onixs_ice::MarketSubscription spreads(x, onixs_ice::MarketSubType::FullImplied, onixs_ice::SecurityType::UdsFuturesMarkets, onixs_ice::BookDepth::FOD);
subs.push_back(spreads);
}
for(const auto& x : chan.uds_market_types)
{
onixs_ice::MarketSubscription spreads(x, onixs_ice::MarketSubType::NonImplied, onixs_ice::SecurityType::UdsFuturesMarkets, onixs_ice::BookDepth::FOD);
onixs_ice::MarketSubscription spreads(x, onixs_ice::MarketSubType::FullImplied, onixs_ice::SecurityType::UdsFuturesMarkets, onixs_ice::BookDepth::FOD);
subs.push_back(spreads);
}
return subs;