nautechsystems/nautilus_trader · error · anyhow::Error
Binance US supports Spot clients only
Error message
Binance US supports Spot clients only
What it means
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.
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.
Example fix
// before
let config = BinanceDataClientConfig { us: true, product_type: BinanceProductType::UsdM, .. };
// after
let config = BinanceDataClientConfig { us: true, product_type: BinanceProductType::Spot, .. }; Defensive patterns
Strategy: validation
Validate before calling
fn us_config_ok(us: bool, product_type: BinanceProductType) -> bool {
!us || product_type == BinanceProductType::Spot
} Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- Binance US market data requires spot_market_data_mode=Json
- Binance US supports the Live environment only
- Allowed token pair -> is not fully pinned by the deployment…
- Binance instrument filter
- Binance load_ids value
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/bdfbdc48c493d01d.
Report an issue: GitHub.
Appendix: source
Thrown at crates/adapters/binance/src/config.rs:257
impl Default for BinanceDataClientConfig {
fn default() -> Self {
Self::builder().build()
}
}
impl BinanceDataClientConfig {
/// Validates Binance data client configuration.
///
/// # Errors
///
/// Returns an error for invalid receive-window, provider, or Binance US settings.
pub fn validate(&self) -> anyhow::Result<()> {
validate_recv_window(self.recv_window_ms)?;
self.instrument_provider.validate(self.product_type)?;
if self.us {
anyhow::ensure!(
self.product_type == BinanceProductType::Spot,
"Binance US supports Spot clients only"
);
anyhow::ensure!(
self.environment == BinanceEnvironment::Live,
"Binance US supports the Live environment only"
);
anyhow::ensure!(
self.spot_market_data_mode == BinanceSpotMarketDataMode::Json,
"Binance US market data requires spot_market_data_mode=Json"
);
}
Ok(())
}
}
impl ClientConfig for BinanceDataClientConfig {View on GitHub (pinned to 18893faf8b)