nautechsystems/nautilus_trader · error

Binance Futures ticker custom data requires BINANCE venue…

Error message

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

What it means

subscribe_ticker validates that the instrument embedded in the custom-data DataType's metadata is a Binance-venue instrument before subscribing. The adapter only manages Binance symbols, so a ticker subscription whose InstrumentId resolves to a different venue is rejected with anyhow::bail.

Solutions

  1. Check the InstrumentId venue before subscribing: ensure it equals Venue::BINANCE (e.g. 'BTCUSDT-PERP.BINANCE').
  2. Parse the instrument ID from a string that includes the .BINANCE suffix.
  3. Ensure the instrument was registered via the correct Binance adapter so the cache holds a BINANCE instrument.

Example fix

// before
let data_type = DataType::new(&topic, Some(instrument_id)); // instrument_id = "BTCUSDT-PERP.BINANCE_PERP"
// after
let instrument_id = InstrumentId::parse("BTCUSDT-PERP.BINANCE")?;
assert_eq!(instrument_id.venue, Venue::new("BINANCE"));
let data_type = DataType::new(&topic, Some(instrument_id));
Defensive patterns

Strategy: validation

Validate before calling

let instrument_id = BinanceFuturesDataClient::required_instrument_id_metadata(&data_type)?;
if instrument_id.venue != Venue::new("BINANCE") {
    return Err(anyhow::anyhow!("cannot subscribe ticker for non-BINANCE instrument {instrument_id}"));
}

Prevention

When it happens

Trigger: Calling subscribe on BinanceFuturesDataClient with a DataType whose metadata instrument_id has a venue other than BINANCE (e.g. an instrument from another adapter was passed).

Common situations: Mixing instruments across venues in a data engine config, building custom data types with instrument IDs parsed from the wrong venue string, or copy-pasting subscription code between adapters without re-parsing the instrument ID.

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/4ce154a6b5b96bf4. Report an issue: GitHub.

Appendix: source

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

#[derive(Debug, Clone)]
struct BookBuffer {
    updates: Vec<BufferedDepthUpdate>,
    epoch: u64,
}

impl BookBuffer {
    fn new(epoch: u64) -> Self {
        Self {
            updates: Vec::new(),
            epoch,
        }
    }
}

fn subscribe_ticker(client: &BinanceFuturesDataClient, data_type: &DataType) -> anyhow::Result<()> {
    let instrument_id = BinanceFuturesDataClient::required_instrument_id_metadata(data_type)?;
    if instrument_id.venue != client.venue() {
        anyhow::bail!(
            "Binance Futures ticker custom data requires BINANCE venue instrument, received {instrument_id}"
        );
    }

    let should_subscribe = {
        let prev = client
            .ticker_refs
            .load()
            .get(&instrument_id)
            .copied()
            .unwrap_or(0);
        client.ticker_refs.rcu(|m| {
            let count = m.entry(instrument_id).or_insert(0);
            *count += 1;
        });
        prev == 0
    };

View on GitHub (pinned to 18893faf8b)