Expose board order sizing runtime fields

This commit is contained in:
boris
2026-04-22 23:21:17 -07:00
parent 3925c0fa38
commit 2b5241c2e6
2 changed files with 21 additions and 1 deletions

View File

@@ -163,6 +163,8 @@ struct StockExpressionState {
lower_limit: f64,
price_tick: f64,
round_lot: i64,
minimum_order_quantity: i64,
order_step_size: i64,
paused: bool,
is_st: bool,
is_kcb: bool,
@@ -966,6 +968,12 @@ impl PlatformExprStrategy {
round_lot: instrument
.map(|item| item.effective_round_lot())
.unwrap_or(100) as i64,
minimum_order_quantity: instrument
.map(|item| item.minimum_order_quantity())
.unwrap_or(100) as i64,
order_step_size: instrument
.map(|item| item.order_step_size())
.unwrap_or(100) as i64,
paused: market.paused || candidate.is_paused,
is_st: candidate.is_st || self.special_name(ctx, symbol),
is_kcb: candidate.is_kcb,
@@ -1094,6 +1102,8 @@ impl PlatformExprStrategy {
scope.push("lower_limit", stock.lower_limit);
scope.push("price_tick", stock.price_tick);
scope.push("round_lot", stock.round_lot);
scope.push("minimum_order_quantity", stock.minimum_order_quantity);
scope.push("order_step_size", stock.order_step_size);
scope.push("paused", stock.paused);
scope.push("is_st", stock.is_st);
scope.push("is_kcb", stock.is_kcb);
@@ -1149,6 +1159,14 @@ impl PlatformExprStrategy {
factors.insert("lower_limit".into(), Dynamic::from(stock.lower_limit));
factors.insert("price_tick".into(), Dynamic::from(stock.price_tick));
factors.insert("round_lot".into(), Dynamic::from(stock.round_lot));
factors.insert(
"minimum_order_quantity".into(),
Dynamic::from(stock.minimum_order_quantity),
);
factors.insert(
"order_step_size".into(),
Dynamic::from(stock.order_step_size),
);
factors.insert("paused".into(), Dynamic::from(stock.paused));
factors.insert("is_st".into(), Dynamic::from(stock.is_st));
factors.insert("is_kcb".into(), Dynamic::from(stock.is_kcb));
@@ -1825,6 +1843,8 @@ impl PlatformExprStrategy {
"lower_limit" => Some(stock.lower_limit),
"price_tick" => Some(stock.price_tick),
"round_lot" => Some(stock.round_lot as f64),
"minimum_order_quantity" => Some(stock.minimum_order_quantity as f64),
"order_step_size" => Some(stock.order_step_size as f64),
"listed_days" => Some(stock.listed_days as f64),
"stock_ma_short" => Some(stock.stock_ma_short),
"stock_ma5" => Some(stock.stock_ma5),

View File

@@ -138,7 +138,7 @@ pub fn built_in_strategy_manual() -> StrategyAiManual {
ManualField { name: "market_cap/free_float_cap".to_string(), field_type: "float".to_string(), detail: "总市值、流通市值。".to_string() },
ManualField { name: "turnover_ratio/effective_turnover_ratio".to_string(), field_type: "float".to_string(), detail: "换手率、有效换手率。".to_string() },
ManualField { name: "open/close/last/last_price/prev_close".to_string(), field_type: "float".to_string(), detail: "开收盘与盘中价格。".to_string() },
ManualField { name: "upper_limit/lower_limit/price_tick/round_lot".to_string(), field_type: "float/int".to_string(), detail: "涨跌停、最小价位、整手。".to_string() },
ManualField { name: "upper_limit/lower_limit/price_tick/round_lot/minimum_order_quantity/order_step_size".to_string(), field_type: "float/int".to_string(), detail: "涨跌停、最小价位、整手、最小下单量和数量步长。KSH/BJSE 等板块可与 round_lot 不同".to_string() },
ManualField { name: "paused/is_st/is_kcb/is_one_yuan/is_new_listing".to_string(), field_type: "bool".to_string(), detail: "可交易性与板块标志。".to_string() },
ManualField { name: "allow_buy/allow_sell/at_upper_limit/at_lower_limit".to_string(), field_type: "bool".to_string(), detail: "盘中买卖与涨跌停状态。".to_string() },
ManualField { name: "touched_upper_limit/touched_lower_limit/hit_upper_limit/hit_lower_limit".to_string(), field_type: "bool".to_string(), detail: "当日 tick 曾经触达涨跌停。".to_string() },