{"record":{"id":"4ce154a6b5b96bf4","repo":"nautechsystems/nautilus_trader","slug":"binance-futures-ticker-custom-data-requires-binanc","errorCode":null,"errorMessage":"Binance Futures ticker custom data requires BINANCE venue instrument, received {instrument_id}","messagePattern":"Binance Futures ticker custom data requires BINANCE venue instrument, received (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/data.rs","lineNumber":3150,"sourceCode":"                \"{}@bookTicker\",\n                format_binance_stream_symbol(&instrument_id)\n            );\n            self.spawn_ws(\n                async move {\n                    ws.unsubscribe(vec![stream])\n                        .await\n                        .context(\"top-of-book unsubscribe\")\n                },\n                \"top-of-book unsubscribe\",\n            );\n        }\n    }\n}\n\nfn subscribe_ticker(client: &BinanceFuturesDataClient, data_type: &DataType) -> anyhow::Result<()> {\n    let instrument_id = BinanceFuturesDataClient::required_instrument_id_metadata(data_type)?;\n    if instrument_id.venue != client.venue() {\n        anyhow::bail!(\n            \"Binance Futures ticker custom data requires BINANCE venue instrument, received {instrument_id}\"\n        );\n    }\n\n    let should_subscribe = {\n        let prev = client\n            .ticker_refs\n            .load()\n            .get(&instrument_id)\n            .copied()\n            .unwrap_or(0);\n        client.ticker_refs.rcu(|m| {\n            let count = m.entry(instrument_id).or_insert(0);\n            *count += 1;\n        });\n        prev == 0\n    };\n","sourceCodeStart":3132,"sourceCodeEnd":3168,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/futures/data.rs#L3132-L3168","documentation":"subscribe_ticker for BinanceFuturesTicker custom data requires the instrument embedded in the DataType metadata to belong to the client's venue (BINANCE). The guard fires when instrument_id.venue differs from client.venue(), meaning the subscription was routed to the wrong adapter. It is the subscribe-side twin of the identical check in unsubscribe_ticker (data.rs:3191).","triggerScenarios":"Subscribing to a BinanceFuturesTicker DataType whose instrument id is e.g. BTCUSDT.BYBIT or BTCUSDT.OKX while the Binance Futures client handles the call; typically caused by a routing table entry keyed only on data type name, or a venue suffix typo in a config string.","commonSituations":"Multi-venue nodes where the DataEngine routes custom ticker types without matching venue; instrument ids parsed from user config with the wrong venue suffix; subscribe/unsubscribe bookkeeping left inconsistent after a prior venue error.","solutions":["Ensure the instrument id venue matches the client, e.g. BTCUSDT-PERP.BINANCE","Fix the routing configuration so BINANCE-venue custom ticker types reach the Binance Futures client","Subscribe to the ticker on the venue-matching client instead of forcing it onto the Binance futures one"],"exampleFix":"// before\nlet instrument_id = InstrumentId::from_str(\"BTCUSDT.BYBIT\")?;\nclient.subscribe_data(DataType::new::<BinanceFuturesTicker>(instrument_id.metadata()))?;\n\n// after\nlet instrument_id = InstrumentId::from_str(\"BTCUSDT-PERP.BINANCE\")?;\nclient.subscribe_data(DataType::new::<BinanceFuturesTicker>(instrument_id.metadata()))?;","handlingStrategy":"validation","validationCode":"use nautilus_model::identifiers::{InstrumentId, Venue};\n\nlet instrument_id = InstrumentId::from_str(&cfg_symbol)?;\nanyhow::ensure!(\n    instrument_id.venue == Venue::new(\"BINANCE\"),\n    \"wrong routing: {instrument_id} is not a BINANCE instrument\"\n);\n// then subscribe_data for the BinanceFuturesTicker type","typeGuard":"fn matches_client_venue(instrument_id: &InstrumentId, client_venue: &Venue) -> bool {\n    instrument_id.venue == *client_venue\n}","tryCatchPattern":null,"preventionTips":["Route subscriptions by instrument venue, not by data type name alone","Derive instrument ids from venue config, never hand-typed suffixes","In multi-venue nodes, assert one venue per custom-data client at startup"],"tags":["binance-futures","ticker","custom-data","venue","routing","rust"],"backgroundTag":"venue-instrument-mismatch","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}