nautechsystems/nautilus_trader · error
Binance does not support {a:?} aggregation
Error message
Binance does not support {a:?} aggregation What it means
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.
Source
Thrown at crates/adapters/binance/src/spot/http/client.rs:2986
) -> anyhow::Result<Vec<crate::common::bar::BinanceBar>> {
anyhow::ensure!(
bar_type.aggregation_source() == AggregationSource::External,
"Only EXTERNAL aggregation is supported"
);
let spec = bar_type.spec();
let step = spec.step.get();
let interval = match spec.aggregation {
BarAggregation::Second if step == 1 => "1s".to_string(),
BarAggregation::Second => {
anyhow::bail!("Binance Spot supports only the 1s kline interval")
}
BarAggregation::Minute => format!("{step}m"),
BarAggregation::Hour => format!("{step}h"),
BarAggregation::Day => format!("{step}d"),
BarAggregation::Week => format!("{step}w"),
BarAggregation::Month => format!("{step}M"),
a => anyhow::bail!("Binance does not support {a:?} aggregation"),
};
let instrument_id = bar_type.instrument_id();
let symbol = instrument_id.symbol;
let instrument = self.instrument_from_cache_by_id(instrument_id)?;
let klines = self
.inner
.klines(
symbol.as_str(),
&interval,
start.map(|dt| dt.as_millisecond()),
end.map(|dt| dt.as_millisecond()),
limit,
)
.await
.map_err(|e| anyhow::anyhow!(e))?;
let mut bars =View on GitHub (pinned to 18893faf8b)
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
Example fix
// before
let bar_type = BarType::from_str("BTCUSDT.BINANCE-VOLUME-100-INTERNAL")?;
// after
let bar_type = BarType::from_str("BTCUSDT.BINANCE-MINUTE-1-INTERNAL")?; Defensive patterns
Strategy: validation
Validate before calling
fn is_binance_bar_aggregation(a: BarAggregation) -> bool {
matches!(a, BarAggregation::Second | BarAggregation::Minute | BarAggregation::Hour | BarAggregation::Day | BarAggregation::Week | BarAggregation::Month)
} Prevention
- 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
When it happens
Trigger: 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".
Common situations: 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.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Binance Spot supports only the 1s kline interval
- Binance Futures does not support second-level kline interval
- Binance Futures does not support {a:?} aggregation
- Only EXTERNAL aggregation is supported
- Aggregation not time based
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/d89e59d4dabefd2a.
Report an issue: GitHub.