nautechsystems/nautilus_trader · error

Unsupported day interval: {step}d

Error message

Unsupported day interval: {step}d

What it means

bar_spec_to_binance_interval supports day steps 1 and 3 only, matching the venue's 1d and 3d kline intervals. Other day steps (2, 7, 14...) have no native interval and bail with this message; 7 days should be expressed as 1-WEEK.

Source

Thrown at crates/adapters/binance/src/common/parse.rs:1459

            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)
}

pub(crate) fn quote_to_l1_deltas(quote: QuoteTick, sequence: u64) -> OrderBookDeltas {
    let bid_action = if quote.bid_size.is_zero() {
        BookAction::Delete

View on GitHub (pinned to a4b06ed870)

Solutions

  1. Remap the step: 7-DAY becomes 1-WEEK; 2-DAY/14-DAY can be composed from 1-DAY bars.
  2. Or use INTERNAL aggregation (e.g. 2-DAY-LAST-INTERNAL) to keep the exact step locally.
  3. Validate BarType strings in config before startup.

Example fix

// before
// let bar_type = BarType::from("7-DAY-LAST-EXTERNAL");
// -> Unsupported day interval: 7d

// after
// let bar_type = BarType::from("1-WEEK-LAST-EXTERNAL"); // same span, native interval
Defensive patterns

Strategy: validation

Validate before calling

fn supported_day_step(step: u32) -> bool {
    matches!(step, 1 | 3)
}

Type guard

fn is_supported_day_bar(step: u32) -> bool {
    matches!(step, 1 | 3)
}

Try / catch

let bar_type = BarType::from("7-DAY-LAST-EXTERNAL");
if let Err(e) = data_client.subscribe_bars(bar_type) {
    if e.to_string().contains("Unsupported day interval") {
        // fall back: 1-WEEK external (same span) or 7-DAY-LAST-INTERNAL
    } else {
        return Err(e);
    }
}

Prevention

When it happens

Trigger: Requesting Binance bars with a day step outside {1, 3} — commonly 7-DAY or 2-DAY specifications.

Common situations: Weekly strategies written as 7-DAY instead of 1-WEEK; configs ported from venues with arbitrary daily klines; bi-weekly 14-DAY requests.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@a4b06ed870 (2026-08-16). Data as JSON: /api/errors/66f5659f2b4686cb. Report an issue: GitHub.