nautechsystems/nautilus_trader · error

BinanceFuturesExecutionClient requires UsdM or CoinM…

Error message

BinanceFuturesExecutionClient requires UsdM or CoinM product type, was {product_type:?}

What it means

BinanceFuturesExecutionClient::new validates the config's product_type after running config.validate(). Only UsdM (USD-Margined) and CoinM (Coin-Margined) futures are supported by this execution client; other Binance product types (e.g. Spot or Options) are rejected.

Solutions

  1. Set product_type to BinanceProductType::UsdM for USD-M futures.
  2. Set product_type to BinanceProductType::CoinM for COIN-M futures.
  3. If you need spot, use the Binance spot execution client instead of the futures one.

Example fix

// before
let config = BinanceExecutionClientConfig { product_type: BinanceProductType::Options, .. };
// after
let config = BinanceExecutionClientConfig { product_type: BinanceProductType::UsdM, .. };
Defensive patterns

Strategy: validation

Validate before calling

match config.product_type {
    BinanceProductType::UsdM | BinanceProductType::CoinM => {},
    other => return Err(anyhow::anyhow!("unsupported product type {other:?} for futures execution client")),
}

Prevention

When it happens

Trigger: Constructing BinanceFuturesExecutionClient with a BinanceProductType other than UsdM or CoinM (e.g. Options, Spot), passed via BinanceExecutionClientConfig.

Common situations: Reusing a shared Binance config across spot/futures adapters; typo or default product type not set; swapping API endpoints without updating product_type.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/a27f4bfbcc0fefd0. Report an issue: GitHub.

Appendix: source

Thrown at crates/adapters/binance/src/futures/execution.rs:212

}

impl BinanceFuturesExecutionClient {
    /// Creates a new [`BinanceFuturesExecutionClient`].
    ///
    /// # Errors
    ///
    /// Returns an error if the HTTP client fails to initialize, credentials are
    /// missing, or the product type is not a futures type (UsdM or CoinM).
    pub fn new(
        core: ExecutionClientCore,
        config: BinanceExecutionClientConfig,
    ) -> anyhow::Result<Self> {
        config.validate()?;
        let product_type = config.product_type;
        match product_type {
            BinanceProductType::UsdM | BinanceProductType::CoinM => {}
            _ => {
                anyhow::bail!(
                    "BinanceFuturesExecutionClient requires UsdM or CoinM product type, was {product_type:?}"
                );
            }
        }

        let (api_key, api_secret) = resolve_credentials(
            config
                .api_key
                .as_ref()
                .map(|value| value.expose_secret().to_owned()),
            config
                .api_secret
                .as_ref()
                .map(|value| value.expose_secret().to_owned()),
            config.environment,
            product_type,
        )?;
        let proxy_url = config

View on GitHub (pinned to 18893faf8b)