{"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":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/data.rs","lineNumber":3219,"sourceCode":"#[derive(Debug, Clone)]\nstruct BookBuffer {\n    updates: Vec<BufferedDepthUpdate>,\n    epoch: u64,\n}\n\nimpl BookBuffer {\n    fn new(epoch: u64) -> Self {\n        Self {\n            updates: Vec::new(),\n            epoch,\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":3201,"sourceCodeEnd":3237,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/futures/data.rs#L3201-L3237","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Check the InstrumentId venue before subscribing: ensure it equals Venue::BINANCE (e.g. 'BTCUSDT-PERP.BINANCE').","Parse the instrument ID from a string that includes the .BINANCE suffix.","Ensure the instrument was registered via the correct Binance adapter so the cache holds a BINANCE instrument."],"exampleFix":"// before\nlet data_type = DataType::new(&topic, Some(instrument_id)); // instrument_id = \"BTCUSDT-PERP.BINANCE_PERP\"\n// after\nlet instrument_id = InstrumentId::parse(\"BTCUSDT-PERP.BINANCE\")?;\nassert_eq!(instrument_id.venue, Venue::new(\"BINANCE\"));\nlet data_type = DataType::new(&topic, Some(instrument_id));","handlingStrategy":"validation","validationCode":"let instrument_id = BinanceFuturesDataClient::required_instrument_id_metadata(&data_type)?;\nif instrument_id.venue != Venue::new(\"BINANCE\") {\n    return Err(anyhow::anyhow!(\"cannot subscribe ticker for non-BINANCE instrument {instrument_id}\"));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always parse instrument IDs with an explicit .BINANCE suffix.","Centralize instrument creation so venue is set in one place.","Add a startup assertion that all configured instruments are BINANCE-venue."],"tags":["binance","futures","ticker","venue-validation","subscription"],"backgroundTag":"invalid-argument-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}