nautechsystems/nautilus_trader · error · anyhow::Error
Binance Futures does not support
Error message
Binance Futures does not support {a:?} aggregation What it means
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.
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
Example fix
// before let bar_type = BarType::new(instrument_id, BarSpec::new(BarAggregation::Tick, 100)); // after let bar_type = BarType::new(instrument_id, BarSpec::new(BarAggregation::Minute, 1)); // or aggregate ticks locally
Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED: [BarAggregation; 5] = [BarAggregation::Minute, BarAggregation::Hour, BarAggregation::Day, BarAggregation::Week, BarAggregation::Month];
if !SUPPORTED.contains(&bar_type.spec().aggregation) { panic!("time-based aggregation required for Binance Futures bars"); } Try / catch
match client.request_bars(bar_type) { Err(e) if e.to_string().contains("does not support") => switch_to_local_tick_aggregation(), r => r } Prevention
- Only configure exchange-supported time aggregations for klines
- Use internal aggregation for tick/volume bars
- Validate bar types at startup for each adapter
When it happens
Trigger: 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).
Common situations: 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.
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 Futures does not support second-level kline…
- Aggregation not time based
- Aggregation type not supported for time bars
- bar_type.aggregation_source must be External, was
- Binance does not support
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/babf1ffdfa353027.
Report an issue: GitHub.
Appendix: source
Thrown at crates/adapters/binance/src/futures/http/client.rs:3052
limit: Option<u32>,
) -> anyhow::Result<Vec<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 => {
anyhow::bail!("Binance Futures does not support second-level kline intervals")
}
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 Futures does not support {a:?} aggregation"),
};
let instrument_id = bar_type.instrument_id();
let (symbol, price_precision, size_precision) =
self.cached_precisions_by_id(instrument_id)?;
let params = BinanceKlinesParams {
symbol,
interval,
start_time: start.map(|dt| dt.as_millisecond()),
end_time: end.map(|dt| dt.as_millisecond()),
limit,
};
let klines = self.inner.klines(¶ms).await?;
let now = self.clock.get_time_ns();
let mut result = Vec::with_capacity(klines.len());View on GitHub (pinned to 18893faf8b)