{"record":{"id":"4190b194d7d3c3a1","repo":"nautechsystems/nautilus_trader","slug":"binance-futures-does-not-support-second-level-klin","errorCode":null,"errorMessage":"Binance Futures does not support second-level kline intervals","messagePattern":"Binance Futures does not support second-level kline intervals","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/data.rs","lineNumber":2079,"sourceCode":"        // Binance Futures uses aggTrade for aggregate trades\n        let stream = format!(\"{}@aggTrade\", format_binance_stream_symbol(&instrument_id));\n\n        self.spawn_ws(\n            async move {\n                ws.subscribe(vec![stream])\n                    .await\n                    .context(\"trades subscription\")\n            },\n            \"trade subscription\",\n        );\n        Ok(())\n    }\n\n    fn subscribe_bars(&mut self, cmd: SubscribeBars) -> anyhow::Result<()> {\n        let bar_type = cmd.bar_type;\n        let ws = self.ws_client.clone();\n        let interval = bar_spec_to_binance_interval(bar_type.spec())?;\n        anyhow::ensure!(\n            interval != crate::common::enums::BinanceKlineInterval::Second1,\n            \"Binance Futures does not support second-level kline intervals\"\n        );\n\n        let stream = format!(\n            \"{}@kline_{}\",\n            format_binance_stream_symbol(&bar_type.instrument_id()),\n            interval.as_str()\n        );\n\n        self.spawn_ws(\n            async move {\n                ws.subscribe(vec![stream])\n                    .await\n                    .context(\"bars subscription\")\n            },\n            \"bar subscription\",\n        );","sourceCodeStart":2061,"sourceCodeEnd":2097,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/futures/data.rs#L2061-L2097","documentation":"Binance Futures kline streams do not support second-level intervals; the smallest supported kline interval is one minute. The handler converts the bar spec to a BinanceKlineInterval and rejects Second1 before building the kline_ stream name.","triggerScenarios":"Calling SubscribeBars with a bar_type whose spec aggregates on 1-second intervals (e.g. 1-SECOND-LAST) on the Binance Futures data client.","commonSituations":"High-frequency bar configs copied from venues that support sub-minute bars; generic bar-subscription loops that pass through any bar spec unchanged; users assuming Binance spot (which may differ) behavior applies to futures.","solutions":["Use a 1-minute or larger interval for external Binance Futures bars","Request second bars with AggregationSource::Internal so the node aggregates from trade ticks instead of using Binance klines","Change the bar aggregation spec in the strategy config to MINUTE or higher"],"exampleFix":"// before\nBarType::from_spec(BarSpecification::new(1, BarAggregation::Second, PriceType::Last))\n// after\nBarType::from_spec(BarSpecification::new(1, BarAggregation::Minute, PriceType::Last))","handlingStrategy":"validation","validationCode":"fn supports_futures_interval(spec: &BarSpecification) -> bool {\n    !(spec.aggregation == BarAggregation::Second)\n}","typeGuard":"fn is_external_minute_plus(bar_type: &BarType) -> bool {\n    bar_type.aggregation_source() == AggregationSource::External\n        && !matches!(bar_type.spec().aggregation, BarAggregation::Second)\n}","tryCatchPattern":"match client.subscribe_bars(cmd) {\n    Err(e) if e.to_string().contains(\"second-level kline\") => {\n        log::warn!(\"falling back to internal aggregation for {}\", cmd.bar_type);\n        subscribe_internally_aggregated(cmd.bar_type)?;\n    }\n    r => r?,\n}","preventionTips":["Use SECOND aggregation only with AggregationSource::Internal on Binance Futures","Validate bar specs against venue interval limits at config load time","Note that Binance Futures klines start at 1m — plan HFT bars around tick data"],"tags":["validation","bars","interval","binance-futures"],"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"}