{"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":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/config.rs","lineNumber":262,"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":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/config.rs#L244-L280","documentation":"binance.us does not serve the Protobuf market-data stream variant the global exchange offers, so with us=True the spot market data mode must be Json. BinanceDataClientConfig.validate enforces spot_market_data_mode == Json as one of the three US constraints.","triggerScenarios":"BinanceDataClientConfig(us=True, spot_market_data_mode='PROTOBUF' or 'PROTO') — e.g. a config tuned for max throughput on the global exchange reused unchanged for the US venue.","commonSituations":"Performance-tuned templates that default spot_market_data_mode to Protobuf; upgrading a config written before the us flag existed; copying a global spot config and only setting us=True.","solutions":["Set spot_market_data_mode='JSON' for the binance.us client.","Keep Protobuf mode only for us=False (global exchange) configs.","Leave the field at its default when targeting binance.us — Json is the default."],"exampleFix":"# before\nBinanceDataClientConfig(us=True, spot_market_data_mode=BinanceSpotMarketDataMode.PROTOBUF)\n\n# after\nBinanceDataClientConfig(us=True, spot_market_data_mode=BinanceSpotMarketDataMode.JSON)","handlingStrategy":"validation","validationCode":"if config.us:\n    assert config.spot_market_data_mode == BinanceSpotMarketDataMode.JSON\nconfig.validate()","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Leave spot_market_data_mode at its default (JSON) for binance.us.","Only enable Protobuf mode on us=False configs for the global exchange.","Review performance-tuned templates before reusing them for the US venue."],"tags":["binance","config","binance-us","market-data-mode","validation"],"backgroundTag":"config-validation-failed","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}