{"record":{"id":"38d81b9ac30465e7","repo":"nautechsystems/nautilus_trader","slug":"binance-futures-does-not-support-second-level-klin-38d81b","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":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/http/client.rs","lineNumber":2984,"sourceCode":"    /// Returns an error if the bar type is not supported, instrument is not cached,\n    /// or the request fails.\n    pub async fn request_binance_bars(\n        &self,\n        bar_type: BarType,\n        start: Option<Timestamp>,\n        end: Option<Timestamp>,\n        limit: Option<u32>,\n    ) -> anyhow::Result<Vec<BinanceBar>> {\n        anyhow::ensure!(\n            bar_type.aggregation_source() == AggregationSource::External,\n            \"Only EXTERNAL aggregation is supported\"\n        );\n\n        let spec = bar_type.spec();\n        let step = spec.step.get();\n        let interval = match spec.aggregation {\n            BarAggregation::Second => {\n                anyhow::bail!(\"Binance Futures does not support second-level kline intervals\")\n            }\n            BarAggregation::Minute => format!(\"{step}m\"),\n            BarAggregation::Hour => format!(\"{step}h\"),\n            BarAggregation::Day => format!(\"{step}d\"),\n            BarAggregation::Week => format!(\"{step}w\"),\n            BarAggregation::Month => format!(\"{step}M\"),\n            a => anyhow::bail!(\"Binance Futures does not support {a:?} aggregation\"),\n        };\n\n        let instrument_id = bar_type.instrument_id();\n        let (symbol, price_precision, size_precision) =\n            self.cached_precisions_by_id(instrument_id)?;\n\n        let params = BinanceKlinesParams {\n            symbol,\n            interval,\n            start_time: start.map(|dt| dt.as_millisecond()),\n            end_time: end.map(|dt| dt.as_millisecond()),","sourceCodeStart":2966,"sourceCodeEnd":3002,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/futures/http/client.rs#L2966-L3002","documentation":"Thrown inside request_binance_bars when the BarAggregation is Second. Binance's futures kline endpoint has no sub-minute interval (its smallest interval is 1m), so any second-level bar request cannot be mapped to a venue interval string and the match arm bails immediately with this fixed message.","triggerScenarios":"Passing a BarType like 'BTCUSDT.BINANCE_PERP-1-SECOND-LAST-EXTERNAL' to request_binance_bars; generic multi-timeframe loaders that enumerate 1s/5s/15s bars and forward them all to the venue; porting strategies from venues that do support second klines (e.g. some spot APIs or other exchanges).","commonSituations":"Sub-minute strategies (market making, latency-sensitive signals) requesting venue history; the aggregation step mapping second bars to the interval formatter; users assuming spot and futures kline granularity are identical.","solutions":["Use Minute (or coarser) aggregation for venue kline requests","For second bars, fetch 1-minute klines or aggTrades and aggregate down locally","Filter second-level bar types out of batch historical loaders with a skip-and-log instead of failing the whole run"],"exampleFix":"// before\nlet bar_type: BarType = \"BTCUSDT.BINANCE_PERP-1-SECOND-LAST-EXTERNAL\".parse()?;\nlet bars = client.request_binance_bars(bar_type, start, end, None).await?;\n\n// after\nlet bar_type: BarType = \"BTCUSDT.BINANCE_PERP-1-MINUTE-LAST-EXTERNAL\".parse()?;\nlet bars = client.request_binance_bars(bar_type, start, end, None).await?;","handlingStrategy":"type-guard","validationCode":"use nautilus_model::data::bar::BarAggregation;\nif bar_type.spec().aggregation == BarAggregation::Second {\n    log::warn!(\"second bars unsupported on futures; skipping {bar_type}\");\n}","typeGuard":"fn is_supported_kline_aggregation(bar_type: &BarType) -> bool {\n    !matches!(\n        bar_type.spec().aggregation,\n        BarAggregation::Second | BarAggregation::Tick | BarAggregation::Volume | BarAggregation::Value\n    )\n}","tryCatchPattern":"Filter second-level bar types out of batch loaders before calling; on error for a single request, skip and continue the batch.","preventionTips":["Restrict venue kline requests to Minute..Month","Build second bars locally from trades","Skip-and-log unsupported aggregations in generic loaders"],"tags":["binance","futures","bars","klines","aggregation","rust","nautilustrader"],"backgroundTag":"unsupported-bar-aggregation","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}