diff --git a/src/client/spark/Modules/Trading/PNL/Settings/PNLSettings.cs b/src/client/spark/Modules/Trading/PNL/Settings/PNLSettings.cs index 8758cdfdc..267071a2c 100644 --- a/src/client/spark/Modules/Trading/PNL/Settings/PNLSettings.cs +++ b/src/client/spark/Modules/Trading/PNL/Settings/PNLSettings.cs @@ -335,8 +335,9 @@ namespace bts.shell.pnl { public static GridColumnSettings account => new GridColumnSettings(nameof(Columns.Account), DefaultColumnHeaders.Account, width: Widths.Account); public static GridColumnSettings exchange => new GridColumnSettings(nameof(Columns.Exchange), DefaultColumnHeaders.Exchange, false, width: Widths.Exchange); public static GridColumnSettings symbol => new GridColumnSettings(nameof(Columns.Symbol), DefaultColumnHeaders.Symbol, width: Widths.Symbol); - public static GridColumnSettings security => new GridColumnSettings(nameof(Columns.Security), DefaultColumnHeaders.Security, width: Widths.Security); public static GridColumnSettings security_type => new GridColumnSettings(nameof(Columns.SecurityType), Headers.SecurityType, width: Widths.SecurityType); + public static GridColumnSettings security => new GridColumnSettings(nameof(Columns.Security), DefaultColumnHeaders.Security, width: Widths.Security); + public static GridColumnSettings cpp => new GridColumnSettings(nameof(Columns.CPP), "CPP", false, width: 50, horizontal_alignment: HorizontalAlignment.Right); // sod public static GridColumnSettings sod_pnl => new GridColumnSettings(nameof(Columns.SODPNL), Headers.SOD.PNL, false, width: Widths.PriceBig, horizontal_alignment: HorizontalAlignment.Right); public static GridColumnSettings sod_long_pos => new GridColumnSettings(nameof(Columns.SODLongPos), Headers.SOD.Long, false, width: Widths.Qty); @@ -351,6 +352,7 @@ namespace bts.shell.pnl { public static GridColumnSettings day_short_pos => new GridColumnSettings(nameof(Columns.DayShortPos), Headers.Day.Short, false, width: Widths.Qty); public static GridColumnSettings day_short_avg_price => new GridColumnSettings(nameof(Columns.DayShortAvgPrice), Headers.Day.ShortAvg, false, width: Widths.Price, horizontal_alignment: HorizontalAlignment.Right); public static GridColumnSettings day_net_pos => new GridColumnSettings(nameof(Columns.DayNetPos), Headers.Day.Net, width: Widths.Qty); + public static GridColumnSettings has_day_trades => new GridColumnSettings(nameof(Columns.HasDayTrades), Headers.HasDayTrades, width: Widths.HasDayTrades); // raw day public static GridColumnSettings raw_day_long_pos => new GridColumnSettings(nameof(Columns.RawDayLongPos), Headers.RawDay.Long, false, width: Widths.RawDayQty); public static GridColumnSettings raw_day_short_pos => new GridColumnSettings(nameof(Columns.RawDayShortPos), Headers.RawDay.Short, false, width: Widths.RawDayQty); @@ -375,9 +377,6 @@ namespace bts.shell.pnl { public static GridColumnSettings last_price => new GridColumnSettings(nameof(Columns.LastPrice), DefaultColumnHeaders.Last, false, width: DefaultColumnWidths.Price, horizontal_alignment: HorizontalAlignment.Right); public static GridColumnSettings settlement_price => new GridColumnSettings(nameof(Columns.SettlementPrice), DefaultColumnHeaders.Settlement, false, width: DefaultColumnWidths.Settlement, horizontal_alignment: HorizontalAlignment.Right); public static GridColumnSettings pnl_price => new GridColumnSettings(nameof(Columns.PNLPrice), DefaultColumnHeaders.PnLPrice, width: DefaultColumnWidths.Price, horizontal_alignment: HorizontalAlignment.Right); - public static GridColumnSettings cpp => new GridColumnSettings(nameof(Columns.CPP), "CPP", false, width: 50, horizontal_alignment: HorizontalAlignment.Right); - // misc - public static GridColumnSettings has_day_trades => new GridColumnSettings(nameof(Columns.HasDayTrades), Headers.HasDayTrades, width: Widths.HasDayTrades); public static IEnumerable default_sorting_criterion { get { @@ -391,8 +390,8 @@ namespace bts.shell.pnl { yield return account; yield return exchange; yield return symbol; - yield return security; yield return security_type; + yield return security; yield return total_pnl; // hidden yield return sod_pnl; diff --git a/src/client/spark/Modules/Trading/PNL/VM/PNLRowVM.cs b/src/client/spark/Modules/Trading/PNL/VM/PNLRowVM.cs index 8b0ed03de..c0f46fe14 100644 --- a/src/client/spark/Modules/Trading/PNL/VM/PNLRowVM.cs +++ b/src/client/spark/Modules/Trading/PNL/VM/PNLRowVM.cs @@ -28,10 +28,11 @@ namespace bts.shell.pnl { _animator.on_row(data); pnl_price = _cell_map.add_price_double(ColumnKeys.PNLPrice, d => d.pnl_price); account_name_cell = _cell_map.add(ColumnKeys.Account, d => d.account_name); - security_cell = _cell_map.add(ColumnKeys.Security, d => d.security, null, EqualityComparer.Default, Comparer.Default.to_nullable()); security_type_cell = _cell_map.add(ColumnKeys.SecurityType, d => d.security?.ContractCase ?? Security.ContractOneofCase.None); exchange_cell = _cell_map.add(ColumnKeys.Exchange, d => d.security?.Exchange ?? Venue.Unset); symbol_cell = _cell_map.add(ColumnKeys.Symbol, d => d.security?.Symbol ?? string.Empty); + security_cell = _cell_map.add(ColumnKeys.Security, d => d.security, null, EqualityComparer.Default, Comparer.Default.to_nullable()); + cpp = _cell_map.add(ColumnKeys.CPP, d => d.cpp); // sod sod_pnl = _cell_map.add_pnl_double(ColumnKeys.SODPNL, d => d.sod_pnl); sod_net_pos = _cell_map.add_net_pos(ColumnKeys.SODNetPos, d => d.sod_net_pos); @@ -46,6 +47,7 @@ namespace bts.shell.pnl { day_long_avg_price = _cell_map.add_long_price(ColumnKeys.DayLongAvgPrice, d => d.day_long_avg_price_raw); day_short_pos = _cell_map.add_short_pos(ColumnKeys.DayShortPos, d => d.day_short_pos); day_short_avg_price = _cell_map.add_short_price(ColumnKeys.DayShortAvgPrice, d => d.day_short_avg_price_raw); + has_day_trades = _cell_map.add(ColumnKeys.HasDayTrades, d => d.has_day_trades, _fmt_has_day_trades); // raw day raw_day_net_pos = _cell_map.add_net_pos(ColumnKeys.RawDayNetPos, d => d.raw_day_net_pos); raw_day_long_pos = _cell_map.add_long_pos(ColumnKeys.RawDayLongPos, d => d.raw_day_long_pos); @@ -69,9 +71,6 @@ namespace bts.shell.pnl { mid_price = _cell_map.add_price_double(ColumnKeys.MidPrice, d => d.mid_price); last_price = _cell_map.add_price_double(ColumnKeys.LastPrice, d => d.last_price); settlement_price = _cell_map.add_price_double(ColumnKeys.SettlementPrice, d => d.settlement_price); - // misc - has_day_trades = _cell_map.add(ColumnKeys.HasDayTrades, d => d.has_day_trades, _fmt_has_day_trades); - cpp = _cell_map.add(ColumnKeys.CPP, d => d.cpp); _cell_map.on_row(data); _cell_map.set_appearances(_animator.cell_appearances); @@ -123,16 +122,17 @@ namespace bts.shell.pnl { } // security public string account_name => data.account_name; - public SecurityImmutable? security => data.security; - public Security.ContractOneofCase security_type => security?.ContractCase ?? Security.ContractOneofCase.None; public Venue exchange => security?.Exchange ?? Venue.Unset; public string symbol => security.symbol_or_default(); + public Security.ContractOneofCase security_type => security?.ContractCase ?? Security.ContractOneofCase.None; + public SecurityImmutable? security => data.security; // cells public PNLCellVM account_name_cell { get; } - public PNLCellVM security_cell { get; } - public PNLCellVM security_type_cell { get; } public PNLCellVM exchange_cell { get; } public PNLCellVM symbol_cell { get; } + public PNLCellVM security_type_cell { get; } + public PNLCellVM security_cell { get; } + public PNLCellVM cpp { get; } // sod public PNLCellVM sod_pnl { get; } public PNLCellVM sod_net_pos { get; } @@ -140,14 +140,6 @@ namespace bts.shell.pnl { public PNLCellVM sod_long_avg_price { get; } public PNLCellVM sod_short_pos { get; } public PNLCellVM sod_short_avg_price { get; } - // (market) - public PNLCellVM bid_price { get; } - public PNLCellVM mid_price { get; } - public PNLCellVM ask_price { get; } - public PNLCellVM last_price { get; } - public PNLCellVM settlement_price { get; } - // pnl price - public PNLCellVM pnl_price { get; } // day public PNLCellVM day_pnl { get; } public PNLCellVM day_net_pos { get; } @@ -155,6 +147,7 @@ namespace bts.shell.pnl { public PNLCellVM day_long_avg_price { get; } public PNLCellVM day_short_pos { get; } public PNLCellVM day_short_avg_price { get; } + public PNLCellVM has_day_trades { get; } // raw day public PNLCellVM raw_day_net_pos { get; } public PNLCellVM raw_day_long_pos { get; } @@ -172,9 +165,13 @@ namespace bts.shell.pnl { public PNLCellVM total_long_avg_price { get; } public PNLCellVM total_short_pos { get; } public PNLCellVM total_short_avg_price { get; } - - public PNLCellVM has_day_trades { get; } - public PNLCellVM cpp { get; } + // (market) + public PNLCellVM bid_price { get; } + public PNLCellVM mid_price { get; } + public PNLCellVM ask_price { get; } + public PNLCellVM last_price { get; } + public PNLCellVM settlement_price { get; } + public PNLCellVM pnl_price { get; } public IList animations { get; private set; } public bool is_selected { diff --git a/src/client/spark/Modules/Trading/PNL/VM/PNLVM.cs b/src/client/spark/Modules/Trading/PNL/VM/PNLVM.cs index 672e8b031..bbcdf088e 100644 --- a/src/client/spark/Modules/Trading/PNL/VM/PNLVM.cs +++ b/src/client/spark/Modules/Trading/PNL/VM/PNLVM.cs @@ -167,6 +167,7 @@ namespace bts.shell.pnl { EnumHelper.get_values_except(SecurityType.Option, SecurityType.Synthetic).ToArray(), r => r.security?.ContractCase ?? SecurityType.None, nameof(PNLRowData.security)); + public IDataGridColumnPersistentFilter cpp_filter { get; } = new DoubleMinMax(r => r.cpp); /// sod public IDataGridColumnPersistentFilter sod_pnl_filter { get; } = new DoubleMinMax(r => r.sod_pnl); public IDataGridColumnPersistentFilter sod_long_pos_filter { get; } = new DoubleMinMax(r => r.sod.long_pos); @@ -181,6 +182,7 @@ namespace bts.shell.pnl { public IDataGridColumnPersistentFilter day_short_pos_filter { get; } = new DoubleMinMax(r => r.day_short_pos); public IDataGridColumnPersistentFilter day_short_avg_price_filter { get; } = new DoubleMinMax(r => r.day_short_avg_price_raw); public IDataGridColumnPersistentFilter day_net_pos_filter { get; } = new DoubleMinMax(r => r.day_net_pos); + public IDataGridColumnPersistentFilter has_day_trades_filter { get; } = DiscreteValuesFilterVM.Create(new[] { true, false }, r => r.has_day_trades); /// raw day public IDataGridColumnPersistentFilter raw_day_long_pos_filter { get; } = new DoubleMinMax(r => r.raw_day_long_pos); public IDataGridColumnPersistentFilter raw_day_short_pos_filter { get; } = new DoubleMinMax(r => r.raw_day_short_pos); @@ -205,9 +207,6 @@ namespace bts.shell.pnl { public IDataGridColumnPersistentFilter last_price_filter { get; } = new DoubleMinMax(r => r.last_price); public IDataGridColumnPersistentFilter settlement_price_filter { get; } = new DoubleMinMax(r => r.settlement_price); public IDataGridColumnPersistentFilter pnl_price_filter { get; } = new DoubleMinMax(r => r.pnl_price); - /// misc - public IDataGridColumnPersistentFilter has_day_trades_filter { get; } = DiscreteValuesFilterVM.Create(new[] { true, false }, r => r.has_day_trades); - public IDataGridColumnPersistentFilter cpp_filter { get; } = new DoubleMinMax(r => r.cpp); IEnumerable> _all_filters => _filter_getters.Select(get => get(this)); @@ -216,8 +215,8 @@ namespace bts.shell.pnl { account = account_filter.get_state(), exchange = exchange_filter.get_state(), symbol = symbol_filter.get_state(), - security = security_filter.get_state(), security_type = security_type_filter.get_state(), + security = security_filter.get_state(), /// sod sod_pnl = sod_pnl_filter.get_state(), sod_long_pos = sod_long_pos_filter.get_state(), @@ -232,6 +231,7 @@ namespace bts.shell.pnl { day_short_pos = day_short_pos_filter.get_state(), day_short_avg_price = day_short_avg_price_filter.get_state(), day_net_pos = day_net_pos_filter.get_state(), + has_day_trades = has_day_trades_filter.get_state(), /// raw day raw_day_long_pos = raw_day_long_pos_filter.get_state(), raw_day_short_pos = raw_day_short_pos_filter.get_state(), @@ -256,8 +256,6 @@ namespace bts.shell.pnl { last_price = last_price_filter.get_state(), settlement_price = settlement_price_filter.get_state(), pnl_price = pnl_price_filter.get_state(), - /// misc - has_day_trades = has_day_trades_filter.get_state() }; #endregion @@ -271,8 +269,9 @@ namespace bts.shell.pnl { account_filter.load_state(f.account); exchange_filter.load_state(f.exchange); symbol_filter.load_state(f.symbol); - security_filter.load_state(f.security); security_type_filter.load_state(f.security_type); + security_filter.load_state(f.security); + cpp_filter.load_state(f.cpp); /// sod sod_pnl_filter.load_state(f.sod_pnl); sod_long_pos_filter.load_state(f.sod_long_pos); @@ -287,6 +286,7 @@ namespace bts.shell.pnl { day_short_pos_filter.load_state(f.day_short_pos); day_short_avg_price_filter.load_state(f.day_short_avg_price); day_net_pos_filter.load_state(f.day_net_pos); + has_day_trades_filter.load_state(f.has_day_trades); /// raw day raw_day_long_pos_filter.load_state(f.raw_day_long_pos); raw_day_short_pos_filter.load_state(f.raw_day_short_pos); @@ -311,9 +311,6 @@ namespace bts.shell.pnl { last_price_filter.load_state(f.last_price); settlement_price_filter.load_state(f.settlement_price); pnl_price_filter.load_state(f.pnl_price); - /// misc - has_day_trades_filter.load_state(f.has_day_trades); - cpp_filter.load_state(f.cpp); } } anchors.sync_with(settings.anchors); @@ -660,4 +657,4 @@ namespace bts.shell.pnl { _selection_changed?.Invoke(e); } } -} \ No newline at end of file +} diff --git a/src/client/spark/Modules/Trading/PNL/View/PNLView.xaml b/src/client/spark/Modules/Trading/PNL/View/PNLView.xaml index 444b6ad3c..dba89ad23 100644 --- a/src/client/spark/Modules/Trading/PNL/View/PNLView.xaml +++ b/src/client/spark/Modules/Trading/PNL/View/PNLView.xaml @@ -677,6 +677,16 @@ sort_member_path="symbol" HeaderTemplate="{StaticResource AnchorableColumnHeaderTemplate}" /> + + - + @@ -884,6 +890,15 @@ data_member_path="day_short_pos" sort_member_path="day_short_pos" /> + + - - - - @@ -1005,8 +1005,9 @@ - + + @@ -1039,7 +1040,6 @@ - diff --git a/src/client/spark/Modules/Trading/PNL/View/PNLView.xaml.cs b/src/client/spark/Modules/Trading/PNL/View/PNLView.xaml.cs index e4362ff2e..51dbfe4e4 100644 --- a/src/client/spark/Modules/Trading/PNL/View/PNLView.xaml.cs +++ b/src/client/spark/Modules/Trading/PNL/View/PNLView.xaml.cs @@ -33,10 +33,12 @@ namespace bts.shell.pnl { partial class PNLView : UserControl { public enum Columns { Account = 1, + // Security Exchange, Symbol, - Security, SecurityType, + Security, + CPP, // SOD SODPNL, SODLongPos, @@ -52,6 +54,7 @@ namespace bts.shell.pnl { DayShortPos, DayCalcType, DayNetPos, + HasDayTrades, // Raw Day RawDayLongPos, RawDayShortPos, @@ -75,10 +78,7 @@ namespace bts.shell.pnl { AskPrice, LastPrice, SettlementPrice, - PNLPrice, - // Misc - HasDayTrades, - CPP + PNLPrice } public static readonly IValueConverter