{"record":{"id":"a84cf2fc760cb1eb","repo":"nautechsystems/nautilus_trader","slug":"invalid-price-match-value-s","errorCode":null,"errorMessage":"Invalid price_match value: {s:?}","messagePattern":"Invalid price_match value: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/common/enums.rs","lineNumber":505,"sourceCode":"    #[serde(rename = \"QUEUE_20\")]\n    Queue20,\n    /// Unknown or undocumented value.\n    #[serde(other)]\n    Unknown,\n}\n\nimpl BinancePriceMatch {\n    /// Parses a price match mode from a string param value.\n    ///\n    /// Accepts uppercase Binance API values like `\"OPPONENT\"`, `\"OPPONENT_5\"`, `\"QUEUE_10\"`.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the value is not a recognized price match mode.\n    pub fn from_param(s: &str) -> anyhow::Result<Self> {\n        let value = s.to_uppercase();\n        serde_json::from_value(serde_json::Value::String(value))\n            .map_err(|_| anyhow::anyhow!(\"Invalid price_match value: {s:?}\"))\n            .and_then(|pm: Self| {\n                if pm == Self::None || pm == Self::Unknown {\n                    anyhow::bail!(\"Invalid price_match value: {s:?}\")\n                }\n                Ok(pm)\n            })\n    }\n}\n\n/// Self-trade prevention mode.\n#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]\n#[serde(rename_all = \"SCREAMING_SNAKE_CASE\")]\npub enum BinanceSelfTradePreventionMode {\n    /// No self-trade prevention.\n    None,\n    /// Expire maker orders on self-trade.\n    ExpireMaker,\n    /// Expire taker orders on self-trade.","sourceCodeStart":487,"sourceCodeEnd":523,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/common/enums.rs#L487-L523","documentation":"BinancePriceMatch::from_param parses a price match mode from a config string; the first branch fires when the (uppercased) value does not deserialize into any BinancePriceMatch variant at all - it is not a recognized Binance price match mode string.","triggerScenarios":"Passing a price_match parameter whose value is not one of OPPONENT, OPPONENT_5, OPPONENT_10, OPPONENT_20, QUEUE, QUEUE_5, QUEUE_10, QUEUE_20 (case-insensitive) - e.g. \"OPPONENT_7\", \"OPPONENT-5\", or \"oponnent\".","commonSituations":"Hand-typed futures config with a typo in the mode or tick-offset suffix; values copied from a different Binance API section; stale config from when the feature set differed.","solutions":["Use one of the exact eight modes: OPPONENT, OPPONENT_5, OPPONENT_10, OPPONENT_20, QUEUE, QUEUE_5, QUEUE_10, QUEUE_20 (any case)","Check the offset suffix - only 5, 10 and 20 ticks exist, and the separator is an underscore","Copy the value verbatim from the Binance price match documentation for your endpoint"],"exampleFix":"# before\nprice_match = \"OPPONENT_7\"\n\n# after\nprice_match = \"OPPONENT_10\"","handlingStrategy":"validation","validationCode":"const VALID_PRICE_MATCH: &[&str] = &[\"OPPONENT\",\"OPPONENT_5\",\"OPPONENT_10\",\"OPPONENT_20\",\"QUEUE\",\"QUEUE_5\",\"QUEUE_10\",\"QUEUE_20\"];\nfn is_valid_price_match(s: &str) -> bool {\n    VALID_PRICE_MATCH.contains(&s.to_uppercase().as_str())\n}","typeGuard":"fn is_valid_price_match_param(s: &str) -> bool {\n    let v = s.to_uppercase();\n    matches!(v.as_str(), \"OPPONENT\"|\"OPPONENT_5\"|\"OPPONENT_10\"|\"OPPONENT_20\"|\"QUEUE\"|\"QUEUE_5\"|\"QUEUE_10\"|\"QUEUE_20\")\n}","tryCatchPattern":"if let Err(e) = BinancePriceMatch::from_param(&cfg.price_match) {\n    return Err(config_error(format!(\"invalid price_match '{}': {e}\", cfg.price_match)));\n}","preventionTips":["Validate price_match at config load with the fixed allow-list, not at order time","Copy the mode strings verbatim from Binance docs (underscore separators, offsets 5/10/20 only)","Add a config lint step to CI for futures venue configs"],"tags":["binance","futures","price-match","configuration","enum-parsing"],"backgroundTag":"invalid-parameter-value","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}