{"record":{"id":"17f976013f88f25c","repo":"nautechsystems/nautilus_trader","slug":"binance-us-market-data-requires-spot-market-data-m","errorCode":null,"errorMessage":"Binance US market data requires spot_market_data_mode=Json","messagePattern":"Binance US market data requires spot_market_data_mode=Json","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/config.rs","lineNumber":265,"sourceCode":"    /// 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 {\n    fn as_any(&self) -> &dyn Any {\n        self\n    }\n}\n\n/// Configuration for Binance execution client.\n///\n/// Global execution uses WebSocket API authentication with Ed25519 credentials.","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/config.rs#L247-L283","documentation":"Binance US market data is only supported via the JSON (REST/polling) feed, not the WebSocket SOR/futures stream modes. validate() throws this error when `us` is true but spot_market_data_mode is not BinanceSpotMarketDataMode::Json.","triggerScenarios":"Constructing BinanceDataClientConfig with us=true and spot_market_data_mode set to a non-Json mode (e.g. WebSocket/Sbe), then calling validate().","commonSituations":"Enabling the lower-latency websocket market data mode for performance and also setting us=true; copying a global-Binance config optimized for websocket data into a Binance US deployment.","solutions":["Set spot_market_data_mode = BinanceSpotMarketDataMode::Json when us = true.","Set us = false if websocket market data mode is required and you have Binance global access."],"exampleFix":"// before\nlet config = BinanceDataClientConfig { us: true, spot_market_data_mode: BinanceSpotMarketDataMode::WebSocket, .. };\n// after\nlet config = BinanceDataClientConfig { us: true, spot_market_data_mode: BinanceSpotMarketDataMode::Json, .. };","handlingStrategy":"validation","validationCode":"fn us_md_ok(us: bool, mode: BinanceSpotMarketDataMode) -> bool {\n    !us || mode == BinanceSpotMarketDataMode::Json\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default spot_market_data_mode to Json for Binance US environments.","Keep performance-tuned websocket configs separate from Binance US configs.","Validate config before node start to fail fast."],"tags":["config","binance-us","market-data","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"}