{"record":{"id":"da3587af8d438e6b","repo":"nautechsystems/nautilus_trader","slug":"binance-us-supports-the-live-environment-only","errorCode":null,"errorMessage":"Binance US supports the Live environment only","messagePattern":"Binance US supports the Live environment only","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/config.rs","lineNumber":261,"sourceCode":"    }\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 {\n    fn as_any(&self) -> &dyn Any {\n        self\n    }\n}","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/config.rs#L243-L279","documentation":"Binance US is only reachable in the Live environment; the adapter does not support Testnet/demo environments for Binance US. validate() throws this error when `us` is true but `environment` is anything other than BinanceEnvironment::Live.","triggerScenarios":"Constructing BinanceDataClientConfig with us=true and environment set to a non-Live value (e.g. Testnet or Demo), then calling validate().","commonSituations":"Trying to paper-trade against testnet with a Binance US account; copy-pasting a global-Binance testnet config and adding us=true.","solutions":["Set environment = BinanceEnvironment::Live when us = true.","Set us = false and use Binance global Testnet if you need a sandbox environment.","Test against Binance US Live with small size instead of testnet."],"exampleFix":"// before\nlet config = BinanceDataClientConfig { us: true, environment: BinanceEnvironment::Testnet, .. };\n// after\nlet config = BinanceDataClientConfig { us: true, environment: BinanceEnvironment::Live, .. };","handlingStrategy":"validation","validationCode":"fn us_env_ok(us: bool, environment: BinanceEnvironment) -> bool {\n    !us || environment == BinanceEnvironment::Live\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Document that Binance US has no testnet; plan testing accordingly.","Gate testnet configs on us=false in your deployment tooling.","Call config.validate() at startup before connecting."],"tags":["config","binance-us","environment","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"}