修复日线投影成交量限制基数

This commit is contained in:
boris
2026-07-05 22:59:28 +08:00
parent 72c667d790
commit 74105f0fde
@@ -1573,7 +1573,12 @@ impl PlatformExprStrategy {
} }
if constraints.volume_limit_enabled { if constraints.volume_limit_enabled {
if market.minute_volume == 0 { let volume_basis = match quote {
Some(quote) => quote.volume_delta,
None if market.minute_volume > 0 => market.minute_volume,
None => market.volume,
};
if volume_basis == 0 {
return None; return None;
} }
let consumed_turnover = execution_state let consumed_turnover = execution_state
@@ -1582,8 +1587,7 @@ impl PlatformExprStrategy {
.copied() .copied()
.unwrap_or(0) .unwrap_or(0)
.saturating_add(current_fill_quantity); .saturating_add(current_fill_quantity);
let raw_limit = ((market.minute_volume as f64) * constraints.volume_percent).floor() let raw_limit = ((volume_basis as f64) * constraints.volume_percent).floor() as i64
as i64
- consumed_turnover as i64; - consumed_turnover as i64;
if raw_limit <= 0 { if raw_limit <= 0 {
return None; return None;
@@ -9558,7 +9562,7 @@ mod tests {
ask1: last_price, ask1: last_price,
prev_close: 10.0, prev_close: 10.0,
volume: 1_000_000, volume: 1_000_000,
minute_volume: 10_000, minute_volume: 0,
bid1_volume: 10_000, bid1_volume: 10_000,
ask1_volume: 10_000, ask1_volume: 10_000,
trading_phase: Some("continuous".to_string()), trading_phase: Some("continuous".to_string()),