nautechsystems/nautilus_trader · error

Binance Futures custom data requires BINANCE venue…

Error message

Binance Futures custom data requires BINANCE venue instrument, received {instrument_id}

What it means

Binance Futures custom data requests must target an instrument on the venue this data client serves. `required_instrument_id_metadata` parses the ID, then request_data bails if its venue does not match self.venue().

Solutions

  1. Route the request to the data client matching the instrument's venue (COIN-M client for COIN-M instruments, etc.)
  2. Correct the instrument_id's venue suffix in configuration
  3. Check request routing logic that selects the data client by venue

Example fix

// before
instrument_id: "BTCUSD_PERP.BINANCE_COINM" // routed to USDT-M client
// after
instrument_id: "BTCUSDT-PERP.BINANCE"
Defensive patterns

Strategy: validation

Validate before calling

let id: InstrumentId = InstrumentId::from_str(meta.get("instrument_id").unwrap().as_str().unwrap())?;
assert_eq!(id.venue, client_venue, "request venue must match data client venue");

Type guard

fn venue_matches(id: &InstrumentId, client_venue: &Venue) -> bool {
    &id.venue == client_venue
}

Try / catch

match client.request_data(data_type).await {
    Err(e) if e.to_string().contains("requires BINANCE venue instrument") => return Err(anyhow::anyhow!("route request to correct venue client: {e}")),
    other => other,
}

Prevention

When it happens

Trigger: request_data for any Binance Futures custom data type where metadata instrument_id parses successfully but has a different venue (e.g. BINANCE_COINM instrument sent to a USDT-M futures data client).

Common situations: Multi-venue setups where requests are routed to the wrong data client instance, or instrument ids hardcoded with the wrong venue suffix in config.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at crates/adapters/binance/src/futures/data.rs:2737

                        }
                    }
                    Err(e) => log::error!("BinanceBar request failed for {bar_type}: {e:?}"),
                }
            });
            return Ok(());
        }

        if data_type_name != "BinanceFuturesOpenInterest"
            && data_type_name != "BinanceFuturesOpenInterestHist"
        {
            log::warn!("Unsupported custom data request: {data_type_name}");
            return Ok(());
        }

        let instrument_id = Self::required_instrument_id_metadata(&data_type)?;

        if instrument_id.venue != self.venue() {
            anyhow::bail!(
                "Binance Futures custom data requires BINANCE venue instrument, received {instrument_id}"
            );
        }

        let period = if data_type_name == "BinanceFuturesOpenInterestHist" {
            Some(Self::required_period_metadata(&data_type)?)
        } else {
            None
        };

        let http = self.http_client.clone();
        let sender = self.data_sender.clone();
        let request_id = request.request_id;
        let client_id = request.client_id;
        let params = request.params;
        let clock = self.clock;
        let venue = self.venue();
        let limit = request.limit.map(|n| n.get() as u32);

View on GitHub (pinned to 18893faf8b)