diff --git a/crates/fidc-core/src/platform_strategy_spec.rs b/crates/fidc-core/src/platform_strategy_spec.rs index 2e026e1..e244c16 100644 --- a/crates/fidc-core/src/platform_strategy_spec.rs +++ b/crates/fidc-core/src/platform_strategy_spec.rs @@ -420,14 +420,9 @@ fn normalize_model_name(value: &str) -> String { fn parse_matching_type(value: Option<&str>) -> Option { match normalize_model_name(value?).as_str() { - "open_auction" => Some(MatchingType::OpenAuction), "current_bar_close" => Some(MatchingType::CurrentBarClose), "next_bar_open" => Some(MatchingType::NextBarOpen), "minute_last" => Some(MatchingType::MinuteLast), - "minute_best_own" => Some(MatchingType::MinuteBestOwn), - "minute_best_counterparty" => Some(MatchingType::MinuteBestCounterparty), - "vwap" => Some(MatchingType::Vwap), - "twap" => Some(MatchingType::Twap), _ => None, } } @@ -1675,6 +1670,48 @@ mod tests { assert!(cfg.strict_value_budget); } + #[test] + fn platform_spec_accepts_only_supported_matching_types() { + for (raw, expected) in [ + ("current_bar_close", MatchingType::CurrentBarClose), + ("next_bar_open", MatchingType::NextBarOpen), + ("minute_last", MatchingType::MinuteLast), + ] { + let spec = serde_json::json!({ + "execution": { + "matchingType": raw + } + }); + + let cfg = platform_expr_config_from_value("", "", &spec).expect("config"); + + assert_eq!(cfg.matching_type, expected); + } + + for raw in [ + "open_auction", + "minute_best_own", + "minute_best_counterparty", + "vwap", + "twap", + "current_close", + "next_open", + ] { + let spec = serde_json::json!({ + "execution": { + "matchingType": raw + }, + "engineConfig": { + "matchingType": "current_bar_close" + } + }); + + let cfg = platform_expr_config_from_value("", "", &spec).expect("config"); + + assert_eq!(cfg.matching_type, MatchingType::CurrentBarClose); + } + } + #[test] fn parses_dynamic_slippage_into_platform_config() { let spec = serde_json::json!({