ui (mview): Add min order qty/notional value columns
This commit is contained in:
1 parent
d919ec5474
commit
3ca4cedf54
5 files changed
+29
-2
No files matched your search
@@ -40,5 +40,7 @@ namespace mbts.spark {
|
||||
Rho,
|
||||
Currency,
|
||||
CashPerPoint,
|
||||
MinOrderQuantity,
|
||||
MinOrderNotional
|
||||
}
|
||||
}
|
||||
@@ -130,6 +130,10 @@ namespace bts.shell.market_view {
|
||||
public DoubleMinMaxState rho { get; set; }
|
||||
[ProtoMember(39)]
|
||||
public DoubleMinMaxState cash_per_point { get; set; }
|
||||
[ProtoMember(40)]
|
||||
public DoubleMinMaxState min_order_quantity { get; set; }
|
||||
[ProtoMember(41)]
|
||||
public DoubleMinMaxState min_order_notional { get; set; }
|
||||
|
||||
public Func<MarketViewVM.Row, bool> build_predicate() {
|
||||
var pb = new ColumnPredicateBuilder<MarketViewVM.Row>();
|
||||
@@ -188,6 +192,8 @@ namespace bts.shell.market_view {
|
||||
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);
|
||||
pb.add_numeric(min_order_quantity, r => r.min_order_quantity);
|
||||
pb.add_numeric(min_order_notional, r => r.min_order_notional);
|
||||
return pb.to_predicate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,6 +210,12 @@ namespace mbts.spark {
|
||||
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 double min_order_quantity => _spec.QuantityInfos.TryGetFirst(out var qi)
|
||||
? qi.TickUnit.safe_divide(qi.TickBase)
|
||||
: security_md.security.tick_factors().tick_unit_frac();
|
||||
public double min_order_notional => _spec.NotionalQuantityInfos.TryGetFirst(out var qi)
|
||||
? qi.MinValue
|
||||
: security_md.security.tick_factors().tick_unit_frac();
|
||||
|
||||
public bool inside_bids => _inside_bids.value;
|
||||
public bool inside_asks => _inside_asks.value;
|
||||
@@ -345,6 +351,9 @@ namespace mbts.spark {
|
||||
TickDisplaySettingsImmutable _qty_display =>
|
||||
security_md.quantity_display;
|
||||
|
||||
ContractSpecificationImmutable _spec =>
|
||||
security_md.security.spec_or_default();
|
||||
|
||||
public string format_price(double price) =>
|
||||
security.ContractSpec.format(price);
|
||||
|
||||
@@ -448,9 +457,9 @@ namespace mbts.spark {
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, get_params(last_price, last_qty));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
OrderTicketParams get_params(double price, double quantity = 0) =>
|
||||
new(new(new() {SecurityKey = security_key }), price, quantity);
|
||||
new(new(new() { SecurityKey = security_key }), price, quantity);
|
||||
}
|
||||
|
||||
void _refresh_orders(ref bool dirty) {
|
||||
|
||||
@@ -147,6 +147,8 @@ namespace bts.shell.market_view {
|
||||
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 GridColumnSettings min_order_quantity => _mk(Columns.MinOrderQuantity, "Min Order Qty", 60, false);
|
||||
public static GridColumnSettings min_notional_value => _mk(Columns.MinOrderNotional, "Min Order Notional", 60, false);
|
||||
|
||||
public static IEnumerable<SortingCriteria> default_sorting_criteria {
|
||||
get {
|
||||
|
||||
@@ -199,6 +199,8 @@ namespace mbts.spark {
|
||||
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), cash_per_point_filter, FilterType.DoubleMinMax, ColWidth.Greeks);
|
||||
add_col(ColKey.MinOrderQuantity, r => r.min_order_quantity.ToString("0.00#####"), nameof(Row.min_order_quantity), min_order_quantity_filter, FilterType.DoubleMinMax, ColWidth.Qty);
|
||||
add_col(ColKey.MinOrderNotional, r => r.min_order_notional.ToString("0.00#####"), nameof(Row.min_order_notional), min_order_notional_filter, FilterType.DoubleMinMax, ColWidth.Qty);
|
||||
|
||||
// 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,
|
||||
@@ -438,6 +440,8 @@ namespace mbts.spark {
|
||||
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));
|
||||
public IDataGridColumnPersistentFilter<Row, DoubleMinMaxState> min_order_quantity_filter { get; } = new DoubleMinMax<Row>(r => r.min_order_quantity, nameof(Row.min_order_quantity));
|
||||
public IDataGridColumnPersistentFilter<Row, DoubleMinMaxState> min_order_notional_filter { get; } = new DoubleMinMax<Row>(r => r.min_order_notional, nameof(Row.min_order_notional));
|
||||
|
||||
IEnumerable<IDataGridColumnFilter<Row>> _all_filters =>
|
||||
_filter_getters.Select(g => g(this));
|
||||
@@ -480,6 +484,8 @@ namespace mbts.spark {
|
||||
ColKey.Theta => wrap(r => r.theta),
|
||||
ColKey.Rho => wrap(r => r.rho),
|
||||
ColKey.CashPerPoint => wrap(r => r.cash_per_point),
|
||||
ColKey.MinOrderQuantity => wrap(r => r.min_order_quantity),
|
||||
ColKey.MinOrderNotional => wrap(r => r.min_order_notional),
|
||||
_ => null,
|
||||
};
|
||||
|
||||
@@ -587,6 +593,8 @@ namespace mbts.spark {
|
||||
theta = theta_filter.get_state(),
|
||||
rho = rho_filter.get_state(),
|
||||
cash_per_point = cash_per_point_filter.get_state(),
|
||||
min_order_quantity = min_order_quantity_filter.get_state(),
|
||||
min_order_notional = min_order_notional_filter.get_state(),
|
||||
};
|
||||
|
||||
public void load_filters(MarketViewFilterStates filters) {
|
||||
|
||||
Reference in new issue
Block a user