修复日线投影成交量限制基数
This commit is contained in:
@@ -1573,7 +1573,12 @@ impl PlatformExprStrategy {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
let consumed_turnover = execution_state
|
||||
@@ -1582,8 +1587,7 @@ impl PlatformExprStrategy {
|
||||
.copied()
|
||||
.unwrap_or(0)
|
||||
.saturating_add(current_fill_quantity);
|
||||
let raw_limit = ((market.minute_volume as f64) * constraints.volume_percent).floor()
|
||||
as i64
|
||||
let raw_limit = ((volume_basis as f64) * constraints.volume_percent).floor() as i64
|
||||
- consumed_turnover as i64;
|
||||
if raw_limit <= 0 {
|
||||
return None;
|
||||
@@ -9558,7 +9562,7 @@ mod tests {
|
||||
ask1: last_price,
|
||||
prev_close: 10.0,
|
||||
volume: 1_000_000,
|
||||
minute_volume: 10_000,
|
||||
minute_volume: 0,
|
||||
bid1_volume: 10_000,
|
||||
ask1_volume: 10_000,
|
||||
trading_phase: Some("continuous".to_string()),
|
||||
|
||||
Reference in New Issue
Block a user