{"record":{"id":"d89e59d4dabefd2a","repo":"nautechsystems/nautilus_trader","slug":"binance-does-not-support-a-aggregation","errorCode":null,"errorMessage":"Binance does not support {a:?} aggregation","messagePattern":"Binance does not support (.+?) aggregation","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/http/client.rs","lineNumber":2986,"sourceCode":"    ) -> anyhow::Result<Vec<crate::common::bar::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 if step == 1 => \"1s\".to_string(),\n            BarAggregation::Second => {\n                anyhow::bail!(\"Binance Spot supports only the 1s kline interval\")\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 does not support {a:?} aggregation\"),\n        };\n\n        let instrument_id = bar_type.instrument_id();\n        let symbol = instrument_id.symbol;\n        let instrument = self.instrument_from_cache_by_id(instrument_id)?;\n        let klines = self\n            .inner\n            .klines(\n                symbol.as_str(),\n                &interval,\n                start.map(|dt| dt.as_millisecond()),\n                end.map(|dt| dt.as_millisecond()),\n                limit,\n            )\n            .await\n            .map_err(|e| anyhow::anyhow!(e))?;\n\n        let mut bars =","sourceCodeStart":2968,"sourceCodeEnd":3004,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/spot/http/client.rs#L2968-L3004","documentation":"Catch-all in the kline interval mapping: any BarAggregation other than Second, Minute, Hour, Day, Week, or Month (e.g. Tick or Volume aggregation) cannot be mapped to a Binance kline interval and bails with the unsupported aggregation name.","triggerScenarios":"Requesting bars from the Binance Spot HTTP client with a BarType whose aggregation is TICK or VOLUME (or any non-time aggregation), e.g. \"BTCUSDT.BINANCE-TICK-100-INTERNAL\".","commonSituations":"Strategies subscribing to tick/volume bars assuming the venue provider builds them; reusing a generic bar request config across adapters that do support synthetic aggregations; aggregating tick data on Binance without a local aggregator.","solutions":["Use a time-based aggregation (Second/Minute/Hour/Day/Week/Month) for Binance Spot bar requests","Build tick/volume bars locally with Nautilus' internal aggregators from trade ticks instead of requesting them from Binance","Route the request to a data provider that supports the requested aggregation"],"exampleFix":"// before\nlet bar_type = BarType::from_str(\"BTCUSDT.BINANCE-VOLUME-100-INTERNAL\")?;\n// after\nlet bar_type = BarType::from_str(\"BTCUSDT.BINANCE-MINUTE-1-INTERNAL\")?;","handlingStrategy":"validation","validationCode":"fn is_binance_bar_aggregation(a: BarAggregation) -> bool {\n    matches!(a, BarAggregation::Second | BarAggregation::Minute | BarAggregation::Hour | BarAggregation::Day | BarAggregation::Week | BarAggregation::Month)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only request time-based bars from Binance","Aggregate tick/volume bars locally from trade data","Keep venue-specific bar specs out of shared config templates"],"tags":["binance","spot","klines","aggregation","bars"],"backgroundTag":"unsupported-operation","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}