ui: Add cash-per-point col to mview

This commit is contained in:
John Colvin committed 2025-06-16 15:52:09 +00:00
1 parent efce01d28e
commit a4e39afbb9
5 files changed
+12 -1

No files matched your search

@@ -38,6 +38,7 @@ namespace mbts.spark {
Vega,
Theta,
Rho,
Currency
Currency,
CashPerPoint,
}
}
@@ -128,6 +128,8 @@ namespace bts.shell.market_view {
public DoubleMinMaxState theta { get; set; }
[ProtoMember(36)]
public DoubleMinMaxState rho { get; set; }
[ProtoMember(39)]
public DoubleMinMaxState cash_per_point { get; set; }
public Func<MarketViewVM.Row, bool> build_predicate() {
var pb = new ColumnPredicateBuilder<MarketViewVM.Row>();
@@ -185,6 +187,7 @@ namespace bts.shell.market_view {
pb.add_numeric(vega, r => r.vega);
pb.add_numeric(theta, r => r.theta);
pb.add_numeric(rho, r => r.rho);
pb.add_numeric(cash_per_point, r => r.cash_per_point);
return pb.to_predicate();
}
}
@@ -209,6 +209,7 @@ namespace mbts.spark {
public bts.api.Venue venue => security_md.security.Exchange;
public uint security_key => security_md.security.Id;
public string currency => security_md.security.Currency;
public double cash_per_point => security_md.security.ContractSpec.CashPerPoint;
public bool inside_bids => _inside_bids.value;
public bool inside_asks => _inside_asks.value;
@@ -146,6 +146,7 @@ namespace bts.shell.market_view {
public static GridColumnSettings vega => _mk(Columns.Vega, "Vega", ColWidth.Greeks, false);
public static GridColumnSettings theta => _mk(Columns.Theta, "Theta", ColWidth.Greeks, false);
public static GridColumnSettings rho => _mk(Columns.Rho, "Rho", ColWidth.Greeks, false);
public static GridColumnSettings cash_per_point => _mk(Columns.CashPerPoint, "CPP", ColWidth.Greeks, false);
public static IEnumerable<SortingCriteria> default_sorting_criteria {
get {
@@ -198,6 +198,7 @@ namespace mbts.spark {
add_col(ColKey.Vega, r => fmt_greek(r.vega), nameof(Row.vega), vega_filter, FilterType.DoubleMinMax, ColWidth.Greeks);
add_col(ColKey.Theta, r => fmt_greek(r.theta), nameof(Row.theta), theta_filter, FilterType.DoubleMinMax, ColWidth.Greeks);
add_col(ColKey.Rho, r => fmt_greek(r.rho), nameof(Row.rho), rho_filter, FilterType.DoubleMinMax, ColWidth.Greeks);
add_col(ColKey.CashPerPoint, r => r.cash_per_point.ToString("0.00#####"), nameof(Row.cash_per_point), currency_filter, FilterType.DoubleMinMax, ColWidth.Greeks);
// row vm filter
// Althoguh securities are filtered at the row 'model' level (SecurityMD), the column base filters have to be applied at the row vm level,
@@ -436,6 +437,7 @@ namespace mbts.spark {
public IDataGridColumnPersistentFilter<Row, DoubleMinMaxState> gamma_filter { get; } = new DoubleMinMax<Row>(r => r.gamma, nameof(Row.gamma));
public IDataGridColumnPersistentFilter<Row, DoubleMinMaxState> theta_filter { get; } = new DoubleMinMax<Row>(r => r.theta, nameof(Row.theta));
public IDataGridColumnPersistentFilter<Row, DoubleMinMaxState> rho_filter { get; } = new DoubleMinMax<Row>(r => r.rho, nameof(Row.rho));
public IDataGridColumnPersistentFilter<Row, DoubleMinMaxState> cash_per_point_filter { get; } = new DoubleMinMax<Row>(r => r.cash_per_point, nameof(Row.cash_per_point));
IEnumerable<IDataGridColumnFilter<Row>> _all_filters =>
_filter_getters.Select(g => g(this));
@@ -477,6 +479,7 @@ namespace mbts.spark {
ColKey.Vega => wrap(r => r.vega),
ColKey.Theta => wrap(r => r.theta),
ColKey.Rho => wrap(r => r.rho),
ColKey.CashPerPoint => wrap(r => r.cash_per_point),
_ => null,
};
@@ -583,6 +586,7 @@ namespace mbts.spark {
vega = vega_filter.get_state(),
theta = theta_filter.get_state(),
rho = rho_filter.get_state(),
cash_per_point = cash_per_point_filter.get_state(),
};
public void load_filters(MarketViewFilterStates filters) {
@@ -625,6 +629,7 @@ namespace mbts.spark {
vega_filter.load_state(filters.vega);
theta_filter.load_state(filters.theta);
rho_filter.load_state(filters.rho);
cash_per_point_filter.load_state(filters.cash_per_point);
}
static (string desc, Color fg) _fills_title(ColKey key) =>