{"record":{"id":"4d91f649b3ec18a3","repo":"nautechsystems/nautilus_trader","slug":"binancefutureswebsocketclient-requires-usdm-or-coi","errorCode":null,"errorMessage":"BinanceFuturesWebSocketClient requires UsdM or CoinM product type, was {product_type:?}","messagePattern":"BinanceFuturesWebSocketClient requires UsdM or CoinM product type, was (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/websocket/streams/client.rs","lineNumber":148,"sourceCode":"    ///\n    /// # Errors\n    ///\n    /// Returns an error if:\n    /// - `product_type` is not a futures type (UsdM or CoinM).\n    /// - Credential creation fails.\n    pub fn new(\n        product_type: BinanceProductType,\n        environment: BinanceEnvironment,\n        api_key: Option<String>,\n        api_secret: Option<String>,\n        url_override: Option<String>,\n        heartbeat: Option<u64>,\n        transport_backend: TransportBackend,\n    ) -> anyhow::Result<Self> {\n        match product_type {\n            BinanceProductType::UsdM | BinanceProductType::CoinM => {}\n            _ => {\n                anyhow::bail!(\n                    \"BinanceFuturesWebSocketClient requires UsdM or CoinM product type, was {product_type:?}\"\n                );\n            }\n        }\n\n        let url = SecretString::from(\n            url_override.unwrap_or_else(|| get_ws_base_url(product_type, environment).to_string()),\n        );\n\n        let credential = match (api_key, api_secret) {\n            (Some(key), Some(secret)) => Some(Arc::new(SigningCredential::new(key, secret))),\n            _ => None,\n        };\n\n        Ok(Self {\n            url,\n            product_type,\n            credential,","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/futures/websocket/streams/client.rs#L130-L166","documentation":"BinanceFuturesWebSocketClient::new only supports BinanceProductType::UsdM and CoinM, since the futures websocket endpoint only serves those. Any other product type (Spot, Options, etc.) is rejected before building the connection URL.","triggerScenarios":"Constructing BinanceFuturesWebSocketClient::new(...) with product_type set to BinanceProductType::Spot, Options, or any variant other than UsdM/CoinM.","commonSituations":"Sharing one product-type constant across spot and futures clients; a config file that names the wrong product type; copying a spot client setup into a futures context.","solutions":["Pass BinanceProductType::UsdM for USD-M futures or BinanceProductType::CoinM for COIN-M futures.","Use the spot adapter/client instead if you intend spot trading.","Fix the product_type in your configuration source."],"exampleFix":"// before\nlet client = BinanceFuturesWebSocketClient::new(BinanceProductType::Spot, ...);\n// after\nlet client = BinanceFuturesWebSocketClient::new(BinanceProductType::UsdM, ...);","handlingStrategy":"validation","validationCode":"fn futures_ws_product(pt: BinanceProductType) -> bool {\n    matches!(pt, BinanceProductType::UsdM | BinanceProductType::CoinM)\n}\nassert!(futures_ws_product(pt), \"futures websocket requires UsdM or CoinM\");","typeGuard":"fn is_futures_product(pt: &BinanceProductType) -> bool {\n    matches!(pt, BinanceProductType::UsdM | BinanceProductType::CoinM)\n}","tryCatchPattern":null,"preventionTips":["Keep separate config constants for spot and futures product types.","Validate product type at config load time.","Use the spot adapter for spot markets instead of the futures client."],"tags":["configuration","product-type","websocket","binance-futures"],"backgroundTag":"invalid-config-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}