SPARK-2062 Unify NetChange enums in UI

This commit is contained in:
Eric Harding committed 2019-02-22 17:15:52 -05:00
1 parent 78b6169750
commit e64567f8ad
6 files changed
+8 -49

No files matched your search

@@ -377,8 +377,6 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock VerticalAlignment="Center" IsEnabled="{TemplateBinding IsNew}">Name</TextBlock>
<TextBox
@@ -407,24 +405,14 @@
SelectedTickFactors="{Binding TickFactors, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
Visibility="{Binding LegTuples.Count, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource IntNotZeroVisibilityConverter}}"
/>
<TextBlock Grid.Column="4" VerticalAlignment="Center" Margin="{StaticResource Margin.LHeaderPanelItem}">MD Calculation</TextBlock>
<TextBlock Grid.Column="4" VerticalAlignment="Center" Margin="{StaticResource Margin.LHeaderPanelItem}" IsEnabled="{TemplateBinding IsNew}" >Pricing</TextBlock>
<ComboBox
Grid.Column="5"
Margin="{StaticResource Margin.LHeaderPanelItem}"
Width="91"
HorizontalAlignment="Stretch"
ItemsSource="{Binding md_calc_types}"
ItemTemplate="{StaticResource EnumDescriptionTemplate}"
SelectedItem="{Binding selected_md_calc_type}"
/>
<TextBlock Grid.Column="6" VerticalAlignment="Center" Margin="{StaticResource Margin.LHeaderPanelItem}">Pricing</TextBlock>
<ComboBox
Grid.Column="7"
Margin="{StaticResource Margin.LHeaderPanelItem}"
Width="90"
IsEnabled="False"
IsEnabled="{TemplateBinding IsNew}"
ItemsSource="{x:Static usp:ExecutionStrategyEditor.PriceCalcItems}"
SelectedItem="{Binding PriceCalc, RelativeSource={RelativeSource TemplatedParent}}"
SelectedItem="{Binding price_calc}"
>
<ComboBox.ItemTemplate>
<DataTemplate>
@@ -432,7 +420,7 @@
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<c:HelpButton Grid.Column="8" Margin="3,0,0,0"/>
<c:HelpButton Grid.Column="8" Margin="3,0,0,0" ManPage="bts_spark/spreader/#creating-a-synthetic" />
</Grid>
<c:DataGridEx
x:Name="PART_DataGrid"
@@ -99,7 +99,7 @@ namespace mbts.ui.spark {
#region PriceCalc
public static readonly DependencyProperty PriceCalcProperty = DependencyProperty.Register("PriceCalc", typeof(SyntheticContract.Types.PriceCalc), typeof(ExecutionStrategyEditor),
new FrameworkPropertyMetadata(SyntheticContract.Types.PriceCalc.Diff, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
new FrameworkPropertyMetadata(SyntheticContract.Types.PriceCalc.Standard, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
public SyntheticContract.Types.PriceCalc PriceCalc { get => (SyntheticContract.Types.PriceCalc)GetValue(PriceCalcProperty); set => SetValue(PriceCalcProperty, value); }
public static readonly IEnumerable<SyntheticContract.Types.PriceCalc> PriceCalcItems = EnumHelper.get_values<SyntheticContract.Types.PriceCalc>();
@@ -314,7 +314,6 @@ namespace mbts.ui.spark {
else if (t == typeof(uint)) return UIntTemplate;
else if (t == typeof(QuantityMeasure)) return QuantityMeasureTemplate;
else if (t == typeof(LegSpreaderParams.Types.MarketDataType)) return MarketDataTypeTemplate;
else if (t == typeof(LegSpreaderParams.Types.LegMarketDataCalculation)) return MarketDataCalculationTemplate;
else if (t == typeof(ConditionalQuoting.Types.PriceType)) return ConditionalPriceTypeTemplate;
else return null;
}
@@ -1,18 +0,0 @@
using mbts.ui.spark;
using LegMarketDataCalculation = bts.spark.LegSpreaderParams.Types.LegMarketDataCalculation;
namespace mbts.spark {
partial class SyntheticEditorVM {
class MarketDataCalculationModel : RowModelBase<LegMarketDataCalculation> {
public override string display_name { get; } = "Market Data Calculation";
public override string help_text { get; }
public override string man_page { get; } = string.Empty;
public override LegMarketDataCalculation get_value(LegSpreaderParamsTuple leg_tup) =>
leg_tup.leg_params.LegMdCalc;
public override void set_value(LegSpreaderParamsTuple leg_tup, LegMarketDataCalculation value) =>
leg_tup.leg_params.LegMdCalc = value;
}
}
}
@@ -26,7 +26,7 @@ namespace mbts.spark {
readonly PriceMultiplierModel _price_mult_model;
readonly List<IDisposable> _resources = new List<IDisposable>();
readonly Property<bool> _has_working_orders, _can_add_leg;
LegSpreaderParams.Types.LegMarketDataCalculation _selected_md_calc_type;
Security _synthetic;
bool _set_name_automatically, _set_ticks_automatically, _set_quantities_automatically, _set_price_mults_automatically, _is_setting_quantities, _is_setting_price_mults;
TickFactors _tick_factors;
@@ -208,7 +208,6 @@ namespace mbts.spark {
//new MinLeanQtyModel(), //TAHA_SPREADER
//new QuoteHiddenModel(),
new MarketDataTypeModel(),
//new MarketDataCalculationModel(),
new QuoteThrottleEnabledModel(quote_throttle_inside_ticks, quote_throttle_outside_ticks),
quote_throttle_inside_ticks,
quote_throttle_outside_ticks,
@@ -266,8 +265,6 @@ namespace mbts.spark {
public bool is_new_leg_popup_open { get; set; }
public bool can_add_leg => _can_add_leg.Value;
public SyntheticContract.Types.PriceCalc price_calc { get => _synthetic.Synthetic.PriceCalc; set => _synthetic.Synthetic.PriceCalc = value; }
public LegSpreaderParams.Types.LegMarketDataCalculation selected_md_calc_type { get => _selected_md_calc_type; set => Set(ref _selected_md_calc_type, value); }
public IEnumerable<LegSpreaderParams.Types.LegMarketDataCalculation> md_calc_types { get; } = EnumHelper.get_values<LegSpreaderParams.Types.LegMarketDataCalculation>();
public ObservableCollection<LegSpreaderParamsTuple> leg_tuples { get; } = new ObservableCollection<LegSpreaderParamsTuple>();
public int leg_count => leg_tuples.Count;
public IReadOnlyCollection<RowVM> rows { get; }
@@ -279,7 +276,6 @@ namespace mbts.spark {
var mutable_strategy = _strategy.CloneToMutable();
mutable_strategy.LegParamsMap.Clear();
foreach (var lt in leg_tuples) {
lt.leg_params.LegMdCalc = selected_md_calc_type;
mutable_strategy.LegParamsMap.Add(lt.leg.Security.Id, lt.leg_params);
}
return new ExecutionStrategyImmutable(mutable_strategy);
@@ -290,9 +286,6 @@ namespace mbts.spark {
_synthetic.Exchange = Venue.Bts;
_strategy = strategy;
leg_tuples.SetItems(_get_legs(_synthetic, strategy));
if (leg_tuples.Count > 0) {
Set(ref _selected_md_calc_type, leg_tuples[0].leg_params.LegMdCalc, nameof(selected_md_calc_type));
}
RaisePropertyChanged(nameof(name), nameof(tick_factors));
}
@@ -9,10 +9,7 @@ namespace mbts.ui.converters {
class SyntheticPriceCalcDisplayTextConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
if (value is SyntheticContract.Types.PriceCalc price_calc) {
switch (price_calc) {
case SyntheticContract.Types.PriceCalc.Diff: return "Standard";
default: return DisplayNameHelper.camel_to_title_case(value.ToString());
}
return DisplayNameHelper.camel_to_title_case(value.ToString());
} else return value != null ? value.ToString() : string.Empty;
}
@@ -40,7 +40,7 @@ namespace bts {
Currency = Currency.Usd,
Synthetic = new SyntheticContract {
Name = "Synthetic1",
PriceCalc = SyntheticContract.Types.PriceCalc.Ratio,
PriceCalc = SyntheticContract.Types.PriceCalc.Standard,
Legs = {
new ContractLeg {
Security = new Security {