nautechsystems/nautilus_trader · error
Unsupported bar aggregation for Kraken Spot: {other:?}
Error message
Unsupported bar aggregation for Kraken Spot: {other:?} What it means
Kraken Spot OHLC data only supports Minute, Hour, and Day bar aggregations; these map to Kraken's interval (1, 60, 1440) multiplied by the bar step. Any other BarAggregation (Tick, Volume, Second, Week, Month, etc.) is rejected by bar_type_to_spot_interval.
Source
Thrown at crates/adapters/kraken/src/common/parse.rs:1177
avg_px_open,
})
}
/// Converts a Nautilus BarType to Kraken Spot API interval (in minutes).
///
/// # Errors
///
/// Returns an error if:
/// - Bar aggregation type is not supported (only Minute, Hour, Day are valid).
/// - Bar step is not supported for the aggregation type.
pub fn bar_type_to_spot_interval(bar_type: BarType) -> anyhow::Result<u32> {
let step = bar_type.spec().step.get() as u32;
let base_interval = match bar_type.spec().aggregation {
BarAggregation::Minute => 1,
BarAggregation::Hour => 60,
BarAggregation::Day => 1440,
other => {
anyhow::bail!("Unsupported bar aggregation for Kraken Spot: {other:?}");
}
};
Ok(base_interval * step)
}
/// Converts a Nautilus BarType to Kraken Futures API resolution string.
///
/// Supported resolutions: 1m, 5m, 15m, 1h, 4h, 12h, 1d, 1w
///
/// # Errors
///
/// Returns an error if:
/// - Bar aggregation type is not supported.
/// - Bar step is not supported for the aggregation type.
pub fn bar_type_to_futures_resolution(bar_type: BarType) -> anyhow::Result<&'static str> {
let step = bar_type.spec().step.get() as u32;
match bar_type.spec().aggregation {
BarAggregation::Minute => match step {View on GitHub (pinned to 18893faf8b)
Solutions
- Request Minute, Hour, or Day bars only, adjusting the step (step multiplies the base interval).
- Aggregate finer/different data client-side (e.g. request 1-minute bars and aggregate to seconds/volume locally).
- Switch the bar spec: e.g. Minute with step 5 for 5m bars instead of unsupported aggregations.
Example fix
// before let bar_type = BarType::new(instrument_id, BarSpec::new(BarAggregation::Second, 30)); // after let bar_type = BarType::new(instrument_id, BarSpec::new(BarAggregation::Minute, 1));
Defensive patterns
Strategy: validation
Validate before calling
const SPOT_AGGREGATIONS: [BarAggregation; 3] =
[BarAggregation::Minute, BarAggregation::Hour, BarAggregation::Day];
if !SPOT_AGGREGATIONS.contains(&bar_type.spec().aggregation) {
eprintln!("Kraken Spot supports only Minute/Hour/Day bars");
} Try / catch
match bar_type_to_spot_interval(&bar_type) {
Ok(interval) => request_bars(interval),
Err(e) if e.to_string().contains("Unsupported bar aggregation") => {
fallback_to_1m_and_aggregate(&bar_type)?;
}
Err(e) => return Err(e),
} Prevention
- Encode per-venue allowed bar specs in strategy config.
- Prefer Minute/Hour/Day specs for Kraken Spot history requests.
- Build custom aggregations locally from 1m bars instead of requesting them from the venue.
When it happens
Trigger: request_bars calls bar_type_to_spot_interval with a BarType whose spec aggregation is not Minute, Hour, or Day — e.g. second-based bars or volume bars on a Kraken Spot venue.
Common situations: Configuring bar aggregations generically across venues without checking Kraken Spot's supported intervals; requesting 1-second or tick bars from historical data endpoints.
Related errors
- Binance Futures does not support {a:?} aggregation
- Deribit does not support {a:?} aggregation
- OKX does not support {a:?} aggregation
- Aggregation not time based
- Aggregation type {} not supported for time bars
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/dcc40eddde4acda1.
Report an issue: GitHub.