{"record":{"id":"a27f4bfbcc0fefd0","repo":"nautechsystems/nautilus_trader","slug":"binancefuturesexecutionclient-requires-usdm-or-coi","errorCode":null,"errorMessage":"BinanceFuturesExecutionClient requires UsdM or CoinM product type, was {product_type:?}","messagePattern":"BinanceFuturesExecutionClient requires UsdM or CoinM product type, was (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"critical","filePath":"crates/adapters/binance/src/futures/execution.rs","lineNumber":244,"sourceCode":"    recovery_tx: Option<tokio::sync::mpsc::UnboundedSender<()>>,\n    pending_tasks: TaskHandles,\n    is_hedge_mode: AtomicBool,\n}\n\nimpl BinanceFuturesExecutionClient {\n    /// Creates a new [`BinanceFuturesExecutionClient`].\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the HTTP client fails to initialize, credentials are\n    /// missing, or the product type is not a futures type (UsdM or CoinM).\n    pub fn new(core: ExecutionClientCore, config: BinanceExecClientConfig) -> anyhow::Result<Self> {\n        config.validate()?;\n        let product_type = config.product_type;\n        match product_type {\n            BinanceProductType::UsdM | BinanceProductType::CoinM => {}\n            _ => {\n                anyhow::bail!(\n                    \"BinanceFuturesExecutionClient requires UsdM or CoinM product type, was {product_type:?}\"\n                );\n            }\n        }\n\n        let (api_key, api_secret) = resolve_credentials(\n            config.api_key.clone(),\n            config.api_secret.clone(),\n            config.environment,\n            product_type,\n        )?;\n\n        let clock = get_atomic_clock_realtime();\n\n        let http_client = BinanceFuturesHttpClient::new(\n            product_type,\n            config.environment,\n            clock,","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/futures/execution.rs#L226-L262","documentation":"BinanceFuturesExecutionClient::new rejects any product type other than UsdM and CoinM, bailing after config.validate() succeeds. The futures client drives /fapi (USD-margined) or /dapi (coin-margined) endpoints and cannot operate on spot instruments, so a Spot (or other) product type is a hard startup failure. resolve_credentials and all later wiring only run for the two futures product types.","triggerScenarios":"Constructing the futures execution client with a BinanceExecClientConfig whose product_type is Spot (including the config default), typically via a factory or node config that reused the spot adapter's settings.","commonSituations":"Copy-pasted Binance config blocks between the spot and futures sections of a node config; YAML/TOML missing the product_type override so it defaults to Spot; a routing layer mapping venue BINANCE to the futures client regardless of product type.","solutions":["Set product_type: UsdM (USDT-margined) or CoinM (coin-margined) in the futures execution client config","If spot trading is intended, use the Binance spot execution client instead of the futures one","Audit any factory/routing layer that selects the futures client by venue alone"],"exampleFix":"// before\nlet config = BinanceExecClientConfig { product_type: BinanceProductType::Spot, ..Default::default() };\nlet client = BinanceFuturesExecutionClient::new(core, config)?;\n\n// after\nlet config = BinanceExecClientConfig { product_type: BinanceProductType::UsdM, ..Default::default() };\nlet client = BinanceFuturesExecutionClient::new(core, config)?;","handlingStrategy":"validation","validationCode":"use binance common::enums::BinanceProductType; // adapter's enum\n\nlet product_type = config.product_type;\nanyhow::ensure!(\n    matches!(product_type, BinanceProductType::UsdM | BinanceProductType::CoinM),\n    \"futures client needs UsdM/CoinM, got {product_type:?}\"\n);\nlet client = BinanceFuturesExecutionClient::new(core, config)?;","typeGuard":"fn is_futures_product(p: BinanceProductType) -> bool {\n    matches!(p, BinanceProductType::UsdM | BinanceProductType::CoinM)\n}","tryCatchPattern":null,"preventionTips":["Keep spot and futures Binance config blocks in separate, explicitly-typed sections","Fail fast in config loaders on product_type/client kind mismatches before constructing clients","Add a smoke test that constructs each configured execution client at startup"],"tags":["binance-futures","execution-client","config","product-type","startup","rust"],"backgroundTag":"client-configuration-mismatch","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}