nautechsystems/nautilus_trader · error
Unsupported month interval
Error message
Unsupported month interval: {step}M What it means
Validation branch in bar_spec_to_binance_interval rejecting BarAggregation::Month steps other than 1: Binance klines have no month intervals beyond 1M, so a monthly bar spec with step > 1 cannot be mapped to a Binance interval.
Solutions
- Change the bar spec to 1-MONTH
- Aggregate 1M (or 1d) bars internally to construct quarter bars
- Use another data provider that supports multi-month intervals
Example fix
// before BarSpec::new(instrument_id, BAR_SPEC_3_MONTH, PriceType::Last) // after BarSpec::new(instrument_id, BAR_SPEC_1_MONTH, PriceType::Last)
Defensive patterns
Strategy: validation
Validate before calling
fn is_supported_month_step(step: u64) -> bool { step == 1 }
assert!(is_supported_month_step(bar_spec.aggregation_step), "Binance supports only 1M bars"); Type guard
fn is_supported_month_step(step: u64) -> bool { step == 1 } Try / catch
match client.subscribe_bars(bar_spec) {
Err(e) if e.to_string().contains("Unsupported month interval") => {
log::warn!("subscribing 1M and aggregating quarters internally");
}
r => r?,
} Prevention
- Use step 1 for all monthly bar specs on Binance
- Derive quarterly/annual bars via internal aggregation of 1M or 1d bars
- Document the Binance interval matrix in your project's config guide
When it happens
Trigger: subscribe_bars or unsubscribe_bars with BarAggregation::Month and step != 1, e.g. a 3-MONTH or 6-MONTH bar spec.
Common situations: Requesting quarterly or semi-annual bars from Binance for long-horizon backtests or reporting.
Related errors
- Unsupported bar aggregation for Binance
- Unsupported day interval
- Unsupported hour interval
- Unsupported week interval
- Binance load_ids value
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/dc9be10c7a993d90.
Report an issue: GitHub.
Appendix: source
Thrown at crates/adapters/binance/src/common/parse.rs:1461
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)
}
pub(crate) fn quote_to_l1_deltas(quote: QuoteTick, sequence: u64) -> OrderBookDeltas {
let bid_action = if quote.bid_size.is_zero() {
BookAction::Delete
} else {
BookAction::Update
};
let ask_action = if quote.ask_size.is_zero() {
BookAction::Delete
} else {
BookAction::Update
};View on GitHub (pinned to 18893faf8b)