修复盘中收盘撮合盘口限制覆盖
This commit is contained in:
@@ -1337,7 +1337,13 @@ fn apply_flat_risk_overrides(
|
||||
|
||||
fn sync_quote_quantity_limit(cfg: &mut PlatformExprStrategyConfig) {
|
||||
cfg.quote_quantity_limit = cfg.risk_config.trading_constraints.liquidity_limit_enabled
|
||||
|| cfg.matching_type != MatchingType::MinuteLast;
|
||||
|| matches!(
|
||||
cfg.matching_type,
|
||||
MatchingType::MinuteBestOwn
|
||||
| MatchingType::MinuteBestCounterparty
|
||||
| MatchingType::Vwap
|
||||
| MatchingType::Twap
|
||||
);
|
||||
}
|
||||
|
||||
fn apply_risk_policy_overrides(
|
||||
@@ -3685,6 +3691,24 @@ mod tests {
|
||||
assert!(!cfg.quote_quantity_limit);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn current_close_respects_explicitly_disabled_liquidity_limit() {
|
||||
let spec = serde_json::json!({
|
||||
"execution": {
|
||||
"matchingType": "current_bar_close",
|
||||
"volumeLimit": true,
|
||||
"liquidityLimit": false,
|
||||
"volumePercent": 0.25
|
||||
}
|
||||
});
|
||||
|
||||
let cfg = platform_expr_config_from_value("", "", &spec).expect("config");
|
||||
|
||||
assert!(cfg.risk_config.trading_constraints.volume_limit_enabled);
|
||||
assert!(!cfg.risk_config.trading_constraints.liquidity_limit_enabled);
|
||||
assert!(!cfg.quote_quantity_limit);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_st_and_star_st_risk_policy_switches_into_platform_config() {
|
||||
let spec = serde_json::json!({
|
||||
|
||||
Reference in New Issue
Block a user