{"record":{"id":"bdfbdc48c493d01d","repo":"nautechsystems/nautilus_trader","slug":"binance-us-supports-spot-clients-only","errorCode":null,"errorMessage":"Binance US supports Spot clients only","messagePattern":"Binance US supports Spot clients only","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/config.rs","lineNumber":257,"sourceCode":"\nimpl Default for BinanceDataClientConfig {\n    fn default() -> Self {\n        Self::builder().build()\n    }\n}\n\nimpl BinanceDataClientConfig {\n    /// Validates Binance data client configuration.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error for invalid receive-window, provider, or Binance US settings.\n    pub fn validate(&self) -> anyhow::Result<()> {\n        validate_recv_window(self.recv_window_ms)?;\n        self.instrument_provider.validate(self.product_type)?;\n\n        if self.us {\n            anyhow::ensure!(\n                self.product_type == BinanceProductType::Spot,\n                \"Binance US supports Spot clients only\"\n            );\n            anyhow::ensure!(\n                self.environment == BinanceEnvironment::Live,\n                \"Binance US supports the Live environment only\"\n            );\n            anyhow::ensure!(\n                self.spot_market_data_mode == BinanceSpotMarketDataMode::Json,\n                \"Binance US market data requires spot_market_data_mode=Json\"\n            );\n        }\n\n        Ok(())\n    }\n}\n\nimpl ClientConfig for BinanceDataClientConfig {","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/config.rs#L239-L275","documentation":"When the config's `us` flag is true, the client may only use Binance US, which offers spot markets exclusively. validate() throws this error if product_type is set to any futures or margin product type (UsdM, CoinM, etc.) while `us` is enabled.","triggerScenarios":"Constructing BinanceDataClientConfig with us=true and product_type set to BinanceProductType::UsdM, CoinM, or any non-Spot type, then calling validate() (directly or via request_instruments_with_config).","commonSituations":"US-based trader enabling the `us` flag for compliance while reusing a futures config; leaving product_type at a futures default after switching to us=true.","solutions":["Set product_type = BinanceProductType::Spot when us = true.","Set us = false if you actually intend to trade futures on Binance global (requires non-US access).","Split into two configs: a Spot config for Binance US and a futures config for Binance global."],"exampleFix":"// before\nlet config = BinanceDataClientConfig { us: true, product_type: BinanceProductType::UsdM, .. };\n// after\nlet config = BinanceDataClientConfig { us: true, product_type: BinanceProductType::Spot, .. };","handlingStrategy":"validation","validationCode":"fn us_config_ok(us: bool, product_type: BinanceProductType) -> bool {\n    !us || product_type == BinanceProductType::Spot\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When us=true, hardcode product_type to Spot rather than making it configurable.","Keep separate config files for Binance US and Binance global deployments.","Call config.validate() early at startup, before creating clients."],"tags":["config","binance-us","product-type","validation"],"backgroundTag":"conflicting-config-options","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"}