{"record":{"id":"bf798cb2276e08c7","repo":"nautechsystems/nautilus_trader","slug":"unsupported-bar-aggregation-for-binance-agg","errorCode":null,"errorMessage":"Unsupported bar aggregation for Binance: {agg:?}","messagePattern":"Unsupported bar aggregation for Binance: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/common/parse.rs","lineNumber":1463,"sourceCode":"            6 => BinanceKlineInterval::Hour6,\n            8 => BinanceKlineInterval::Hour8,\n            12 => BinanceKlineInterval::Hour12,\n            _ => anyhow::bail!(\"Unsupported hour interval: {step}h\"),\n        },\n        BarAggregation::Day => match step {\n            1 => BinanceKlineInterval::Day1,\n            3 => BinanceKlineInterval::Day3,\n            _ => anyhow::bail!(\"Unsupported day interval: {step}d\"),\n        },\n        BarAggregation::Week => match step {\n            1 => BinanceKlineInterval::Week1,\n            _ => anyhow::bail!(\"Unsupported week interval: {step}w\"),\n        },\n        BarAggregation::Month => match step {\n            1 => BinanceKlineInterval::Month1,\n            _ => anyhow::bail!(\"Unsupported month interval: {step}M\"),\n        },\n        agg => anyhow::bail!(\"Unsupported bar aggregation for Binance: {agg:?}\"),\n    };\n\n    Ok(interval)\n}\n\npub(crate) fn quote_to_l1_deltas(quote: QuoteTick, sequence: u64) -> OrderBookDeltas {\n    let bid_action = if quote.bid_size.is_zero() {\n        BookAction::Delete\n    } else {\n        BookAction::Update\n    };\n    let ask_action = if quote.ask_size.is_zero() {\n        BookAction::Delete\n    } else {\n        BookAction::Update\n    };\n    let bid = OrderBookDelta::new(\n        quote.instrument_id,","sourceCodeStart":1445,"sourceCodeEnd":1481,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/common/parse.rs#L1445-L1481","documentation":"The catch-all arm of bar_spec_to_binance_interval: the BarAggregation variant itself is not mapped for Binance at all (e.g. Tick or Volume aggregation), not just an unsupported step. Binance klines only exist for time-based intervals, so non-time aggregations cannot be converted.","triggerScenarios":"subscribe_bars or unsubscribe_bars with a non-time BarAggregation such as Tick or Volume, e.g. a TICK_COUNT or VOLUME bar spec sent to a Binance client.","commonSituations":"Reusing one strategy config across venues where the original venue supported tick/volume bars; accidentally wiring a Binance data client to a bar spec designed for a tick-data adapter.","solutions":["Use a time-based BarAggregation (Second, Minute, Hour, Day, Week, Month) with a supported step","Route tick/volume bar specs to a data engine configured for internal aggregation","Verify the BarSpec aggregation before handing it to the Binance factory"],"exampleFix":"// before\nBarSpec::new(instrument_id, BAR_SPEC_100_TICKS, PriceType::Last)\n// after\nBarSpec::new(instrument_id, BAR_SPEC_1_MINUTE_LAST, PriceType::Last)","handlingStrategy":"validation","validationCode":"use nautilus_model::enums::BarAggregation;\nfn is_time_based(agg: BarAggregation) -> bool {\n    matches!(agg, BarAggregation::Second | BarAggregation::Minute | BarAggregation::Hour | BarAggregation::Day | BarAggregation::Week | BarAggregation::Month)\n}","typeGuard":"fn is_time_based(agg: BarAggregation) -> bool {\n    matches!(agg, BarAggregation::Second | BarAggregation::Minute | BarAggregation::Hour | BarAggregation::Day | BarAggregation::Week | BarAggregation::Month)\n}","tryCatchPattern":"match client.subscribe_bars(bar_spec) {\n    Err(e) if e.to_string().contains(\"Unsupported bar aggregation for Binance\") => {\n        panic!(\"Binance klines are time-based only; reconfigure bar spec: {e}\");\n    }\n    r => r?,\n}","preventionTips":["Never route tick/volume bar specs to a Binance data client","Validate the aggregation enum before the client factory picks a venue","Keep per-venue bar-spec whitelists in strategy config validation"],"tags":["rust","binance","bar-aggregation","config"],"backgroundTag":"unsupported-enum-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"}