LadderSettingsView - add 'Auto Clear' value checkbox, minor style tweaks

This commit is contained in:
John Colvin committed 2019-06-18 18:00:18 -05:00
1 parent 1f8b0bf1e6
commit c66dfdaf27
2 files changed
+24 -9

No files matched your search

@@ -40,6 +40,7 @@ namespace mbts.spark {
TimeInForce _default_time_in_force;
LadderSettings.NetChangeTerms _price_format;
double _order_entry_panel_width, _zoom_factor;
bool _auto_clear;
LadderSettings _current;
LadderColumnSettingsVM
_orders = new OrdersColumnSettingsVM(),
@@ -168,6 +169,10 @@ namespace mbts.spark {
// algo
public AlgoDefinitionVM default_algo { get => _default_algo.Value; set => _default_algo.Value = value; }
public IReadOnlyObservableCollection<AlgoDefinitionVM> algo_definitions => _algo_definitions;
// left-panel (components)
public bool auto_clear { get => _auto_clear; set => Set(ref _auto_clear, value); }
public double order_entry_panel_width { get => _order_entry_panel_width; set => Set(ref _order_entry_panel_width, value); }
public double zoom_factor { get => _zoom_factor; set => Set(ref _zoom_factor, value); }
// favorites
public FavoriteAlgosVM favorite_algos_vm { get; }
@@ -211,8 +216,6 @@ namespace mbts.spark {
}
}
public double order_entry_panel_width { get => _order_entry_panel_width; set => Set(ref _order_entry_panel_width, value); }
public double zoom_factor { get => _zoom_factor; set => Set(ref _zoom_factor, value); }
public IEnumerable<OrderEntryPanelItemVisibilityVM> order_entry_panel_items {
get {
yield return _zoom_slider_visbility;
@@ -313,9 +316,11 @@ namespace mbts.spark {
// - algo
_desired_algo = settings.default_algo;
_try_select_desired_algo(true);
// left-panel (components)
// - components
auto_clear = settings.auto_clear;
order_entry_panel_width = settings.order_entry_panel_initial_width;
zoom_factor = settings.zoom_factor;
// left-panel (show/hide)
_zoom_slider_visbility.show = settings.zoom_slider_visible;
_day_visibility.show = settings.day_visible;
_high_visibility.show = settings.high_visible;
@@ -362,12 +367,18 @@ namespace mbts.spark {
clone.session_high_line = _session_high_mkt_line.get_settings();
clone.session_range_fill = _session_range_fill.get_settings();
// left-panel (defaults)
clone.default_time_in_force = default_time_in_force;
// - account
if (default_account.HasValue)
clone.default_account = default_account.Value.id;
clone.default_time_in_force = default_time_in_force;
// - algo
clone.default_algo = default_algo != null ?
AlgoID.from_algo_key(default_algo.key, _model.dynamic_helper.dynamic_type_index) :
(_desired_algo ?? LadderSettings.Default.default_algo);
// - components
clone.auto_clear = auto_clear;
clone.order_entry_panel_initial_width = _order_entry_panel_width;
clone.zoom_factor = zoom_factor;
// left-panel (components)
clone.day_visible = _day_visibility.show;
clone.high_visible = _high_visibility.show;
@@ -386,9 +397,7 @@ namespace mbts.spark {
clone.cancel_buys_visible = _cancel_buys_visibility.show;
clone.cancel_sells_visible = _cancel_sells_visibility.show;
clone.cancel_all_visible = _cancel_all_visibility.show;
clone.order_entry_panel_initial_width = _order_entry_panel_width;
clone.zoom_slider_visible = _zoom_slider_visbility.show;
clone.zoom_factor = zoom_factor;
clone.net_change = price_format;
return clone;
}
@@ -850,7 +850,7 @@
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="{Binding Source={StaticResource VerticalPush}}"/>
<RowDefinition Height="{Binding Source={StaticResource VerticalSplit}}"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@@ -860,7 +860,7 @@
</Grid.ColumnDefinitions>
<!-- Another TabControl Quirk! (the first 'Focusable' element automatically receives focus when tab is selected)
The Grid below is 'Focusable' so it can capture the focus, instead of letting it fall to the TickUpDown (the latter results in the TickUpDown's TextBox being highlighted) -->
<GroupBox Header="Width/Zoom Factor" Padding="8,6">
<GroupBox Header="Width/Component Defaults" Padding="8,6,8,4">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
@@ -873,6 +873,8 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="{Binding Source={StaticResource VerticalPush}}"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="{Binding Source={StaticResource VerticalPush}}"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!--Left Panel Width-->
<TextBlock VerticalAlignment="Center">Left Panel Width</TextBlock>
@@ -882,6 +884,10 @@
<TextBlock Grid.Row="2" VerticalAlignment="Center">Zoom Factor</TextBlock>
<Slider Grid.Row="2" Grid.Column="2" Minimum="{x:Static sp:LadderView.MinZoomFactor}" Maximum="{x:Static sp:LadderView.MaxZoomFactor}" Value="{Binding zoom_factor}"/>
<TextBlock Grid.Row="2" Grid.Column="4" VerticalAlignment="Center" Text="{Binding zoom_factor, StringFormat='0.00'}"/>
<!--Auto Clear-->
<CheckBox Grid.Row="4" Grid.ColumnSpan="5" HorizontalAlignment="Left" VerticalAlignment="Top" VerticalContentAlignment="Top" Margin="0,2,0,0" IsChecked="{Binding auto_clear}">
Auto Clear
</CheckBox>
</Grid>
</GroupBox>
<GroupBox Grid.Column="2" Header="Default Order Params" Padding="8,6">
@@ -923,7 +929,7 @@
</ComboBox>
</Grid>
</GroupBox>
<GroupBox Grid.Row="2" Header="Components" Padding="8,4">
<GroupBox Grid.Row="2" Header="Components (Show/Hide)" Padding="8,4">
<ItemsControl Grid.IsSharedSizeScope="True" ItemsSource="{Binding order_entry_panel_items}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>