nautechsystems/nautilus_trader · error
Unsupported hour interval: {step}h
Error message
Unsupported hour interval: {step}h What it means
bar_spec_to_binance_interval supports hour steps 1, 2, 4, 6, 8 and 12 — the exact set of Binance hourly kline intervals (1h, 2h, 4h, 6h, 8h, 12h). Other hour steps such as 3h or 24h have no native interval and bail with this message (24h should be expressed as 1-DAY).
Source
Thrown at crates/adapters/binance/src/common/parse.rs:1454
1 => BinanceKlineInterval::Second1,
_ => anyhow::bail!("Unsupported second interval: {step}s"),
},
BarAggregation::Minute => match step {
1 => BinanceKlineInterval::Minute1,
3 => BinanceKlineInterval::Minute3,
5 => BinanceKlineInterval::Minute5,
15 => BinanceKlineInterval::Minute15,
30 => BinanceKlineInterval::Minute30,
_ => anyhow::bail!("Unsupported minute interval: {step}m"),
},
BarAggregation::Hour => match step {
1 => BinanceKlineInterval::Hour1,
2 => BinanceKlineInterval::Hour2,
4 => BinanceKlineInterval::Hour4,
6 => BinanceKlineInterval::Hour6,
8 => BinanceKlineInterval::Hour8,
12 => BinanceKlineInterval::Hour12,
_ => anyhow::bail!("Unsupported hour interval: {step}h"),
},
BarAggregation::Day => match step {
1 => BinanceKlineInterval::Day1,
3 => BinanceKlineInterval::Day3,
_ => anyhow::bail!("Unsupported day interval: {step}d"),
},
BarAggregation::Week => match step {
1 => BinanceKlineInterval::Week1,
_ => anyhow::bail!("Unsupported week interval: {step}w"),
},
BarAggregation::Month => match step {
1 => BinanceKlineInterval::Month1,
_ => anyhow::bail!("Unsupported month interval: {step}M"),
},
agg => anyhow::bail!("Unsupported bar aggregation for Binance: {agg:?}"),
};
Ok(interval)View on GitHub (pinned to a4b06ed870)
Solutions
- Remap the step onto a supported interval: 24-HOUR becomes 1-DAY, 3-HOUR becomes 1-HOUR/4-HOUR.
- Or use INTERNAL aggregation (e.g. 3-HOUR-LAST-INTERNAL) to keep the exact step locally.
- Validate BarType strings in config before startup.
Example fix
// before
// let bar_type = BarType::from("3-HOUR-LAST-EXTERNAL");
// -> Unsupported hour interval: 3h
// after
// let bar_type = BarType::from("3-HOUR-LAST-INTERNAL"); // aggregated locally
// or
// let bar_type = BarType::from("4-HOUR-LAST-EXTERNAL"); // nearest venue interval Defensive patterns
Strategy: validation
Validate before calling
fn supported_hour_step(step: u32) -> bool {
matches!(step, 1 | 2 | 4 | 6 | 8 | 12)
} Type guard
fn is_supported_hour_bar(step: u32) -> bool {
matches!(step, 1 | 2 | 4 | 6 | 8 | 12)
} Try / catch
let bar_type = BarType::from("3-HOUR-LAST-EXTERNAL");
if let Err(e) = data_client.subscribe_bars(bar_type) {
if e.to_string().contains("Unsupported hour interval") {
// fall back: 4-HOUR external or 3-HOUR-LAST-INTERNAL
} else {
return Err(e);
}
} Prevention
- Validate hour steps against {1, 2, 4, 6, 8, 12}; express 24h as 1-DAY.
- Use INTERNAL aggregation for odd hour steps like 3h.
- Unit-test bar spec construction against the supported sets.
When it happens
Trigger: Requesting Binance bars with an hour step outside {1, 2, 4, 6, 8, 12} — commonly 3-HOUR or 24-HOUR specifications.
Common situations: Configs ported from venues with arbitrary hour klines; sessions defined as 3h blocks; 24-HOUR used where 1-DAY is meant.
Related errors
- Unsupported second interval: {step}s
- Unsupported minute interval: {step}m
- Unsupported day interval: {step}d
- Unsupported week interval: {step}w
- Only EXTERNAL aggregation is supported
AI-assisted analysis of nautechsystems/nautilus_trader@a4b06ed870 (2026-08-16).
Data as JSON: /api/errors/76afac300d9b74c7.
Report an issue: GitHub.