{"record":{"id":"babf1ffdfa353027","repo":"nautechsystems/nautilus_trader","slug":"binance-futures-does-not-support-a-aggregation","errorCode":null,"errorMessage":"Binance Futures does not support {a:?} aggregation","messagePattern":"Binance Futures does not support (.+?) aggregation","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/http/client.rs","lineNumber":3052,"sourceCode":"        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()),\n            limit,\n        };\n\n        let klines = self.inner.klines(&params).await?;\n        let now = self.clock.get_time_ns();\n\n        let mut result = Vec::with_capacity(klines.len());","sourceCodeStart":3034,"sourceCodeEnd":3070,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/futures/http/client.rs#L3034-L3070","documentation":"After handling Second/Minute/Hour/Day/Week/Month aggregations, this catch-all bail rejects any other aggregation (e.g. Tick or Volume) for Futures kline requests, since Binance only supports time-based kline intervals.","triggerScenarios":"Requesting/subscribing to bars with BarAggregation::Tick or BarAggregation::Volume on the Binance Futures HTTP client (e.g. 100-TICK bars or 1000-VOLUME bars).","commonSituations":"Configuring tick/volume bars thinking the exchange aggregates them; generic bar configuration shared across adapters that support tick bars (like crypto venues with local aggregation) and those that don't.","solutions":["Use a time-based aggregation (Minute/Hour/Day/Week/Month) for exchange bars","Build tick/volume bars locally from trade ticks via internal aggregation instead of requesting klines","Guard the configuration so only supported aggregations reach the Futures data client"],"exampleFix":"// before\nlet bar_type = BarType::new(instrument_id, BarSpec::new(BarAggregation::Tick, 100));\n// after\nlet bar_type = BarType::new(instrument_id, BarSpec::new(BarAggregation::Minute, 1)); // or aggregate ticks locally","handlingStrategy":"validation","validationCode":"const SUPPORTED: [BarAggregation; 5] = [BarAggregation::Minute, BarAggregation::Hour, BarAggregation::Day, BarAggregation::Week, BarAggregation::Month];\nif !SUPPORTED.contains(&bar_type.spec().aggregation) { panic!(\"time-based aggregation required for Binance Futures bars\"); }","typeGuard":null,"tryCatchPattern":"match client.request_bars(bar_type) { Err(e) if e.to_string().contains(\"does not support\") => switch_to_local_tick_aggregation(), r => r }","preventionTips":["Only configure exchange-supported time aggregations for klines","Use internal aggregation for tick/volume bars","Validate bar types at startup for each adapter"],"tags":["rust","binance","bars","aggregation","unsupported"],"backgroundTag":"unsupported-operation","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"}