{"record":{"id":"5d88068ec6508cbc","repo":"nautechsystems/nautilus_trader","slug":"binance-spot-24-hour-ticker-custom-data-requires-j","errorCode":null,"errorMessage":"Binance Spot 24-hour ticker custom data requires JSON market-data mode","messagePattern":"Binance Spot 24-hour ticker custom data requires JSON market-data mode","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/data.rs","lineNumber":1768,"sourceCode":"    }\n\n    fn is_connected(&self) -> bool {\n        self.is_connected.load(Ordering::Relaxed)\n    }\n\n    fn is_disconnected(&self) -> bool {\n        !self.is_connected()\n    }\n\n    fn subscribe(&mut self, cmd: SubscribeCustomData) -> anyhow::Result<()> {\n        if cmd.data_type.type_name() != \"BinanceSpotTicker\" {\n            log::warn!(\n                \"Unsupported custom data subscription: {}\",\n                cmd.data_type.type_name()\n            );\n            return Ok(());\n        }\n        anyhow::ensure!(\n            self.spot_market_data_mode == BinanceSpotMarketDataMode::Json,\n            \"Binance Spot 24-hour ticker custom data requires JSON market-data mode\"\n        );\n        let instrument_id = Self::required_instrument_id_metadata(&cmd.data_type)?;\n        anyhow::ensure!(\n            instrument_id.venue == self.venue(),\n            \"Spot ticker requires a BINANCE instrument\"\n        );\n        let should_subscribe = {\n            let previous = self\n                .ticker_refs\n                .load()\n                .get(&instrument_id)\n                .copied()\n                .unwrap_or(0);\n            self.ticker_refs\n                .rcu(|refs| *refs.entry(instrument_id).or_insert(0) += 1);\n            previous == 0","sourceCodeStart":1750,"sourceCodeEnd":1786,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/spot/data.rs#L1750-L1786","documentation":"BinanceSpotTicker (24-hour ticker) custom data subscriptions are implemented only on the JSON public stream; the 24h ticker has no SBE equivalent in this adapter. Subscribing while the Spot data client runs in a non-Json mode fails this hard check. Note the asymmetry: custom types other than BinanceSpotTicker only produce a warning and return Ok, but this one errors.","triggerScenarios":"subscribe (SubscribeCustomData) with a DataType whose type_name is 'BinanceSpotTicker' while spot_market_data_mode is not Json (e.g. Sbe).","commonSituations":"Enabling SBE mode for performance and later adding a 24h-ticker custom data subscription without realizing it is JSON-only; porting a Json-mode strategy config to SBE wholesale.","solutions":["Set spot_market_data_mode to Json in the Binance Spot data client config when you need 24h tickers","Or remove the BinanceSpotTicker subscription when running SBE mode"],"exampleFix":"# before\nconfig = BinanceSpotDataClientConfig(\n    spot_market_data_mode=BinanceSpotMarketDataMode.SBE,\n)\n# ... strategy subscribes to BinanceSpotTicker custom data -> error\n\n# after\nconfig = BinanceSpotDataClientConfig(\n    spot_market_data_mode=BinanceSpotMarketDataMode.JSON,\n)","handlingStrategy":"validation","validationCode":"mode = config.spot_market_data_mode\nwants_ticker = any(dt.type_name() == \"BinanceSpotTicker\" for dt in requested_custom_types)\nassert not (wants_ticker and mode != BinanceSpotMarketDataMode.JSON), (\n    \"BinanceSpotTicker requires JSON market-data mode\"\n)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Document per-mode feature support and assert config-vs-subscriptions at startup","When enabling SBE, audit subscriptions for JSON-only streams (tickers, klines)"],"tags":["binance","spot","sbe","configuration","subscription","ticker"],"backgroundTag":"market-data-mode-mismatch","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}