nautechsystems/nautilus_trader · error

Unsupported week interval: {step}w

Error message

Unsupported week interval: {step}w

What it means

bar_spec_to_binance_interval supports week step 1 only, matching Binance's single 1w kline interval. Multi-week steps (2-WEEK, 4-WEEK...) have no native interval and bail with this message.

Source

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

            _ => 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
    } else {
        BookAction::Update
    };
    let ask_action = if quote.ask_size.is_zero() {

View on GitHub (pinned to a4b06ed870)

Solutions

  1. Remap multi-week bars onto 1-WEEK external bars and aggregate client-side, or use 1-MONTH where the span is a month.
  2. Or use INTERNAL aggregation (e.g. 2-WEEK-LAST-INTERNAL) to keep the exact step locally.
  3. Validate BarType strings in config before startup.

Example fix

// before
// let bar_type = BarType::from("2-WEEK-LAST-EXTERNAL");
// -> Unsupported week interval: 2w

// after
// let bar_type = BarType::from("1-WEEK-LAST-EXTERNAL"); // aggregate two bars client-side
Defensive patterns

Strategy: validation

Validate before calling

fn supported_week_step(step: u32) -> bool {
    step == 1
}

Type guard

fn is_supported_week_bar(step: u32) -> bool {
    step == 1
}

Try / catch

let bar_type = BarType::from("2-WEEK-LAST-EXTERNAL");
if let Err(e) = data_client.subscribe_bars(bar_type) {
    if e.to_string().contains("Unsupported week interval") {
        // fall back: 1-WEEK external + client-side aggregation
    } else {
        return Err(e);
    }
}

Prevention

When it happens

Trigger: Requesting Binance bars with a week step greater than 1 — for example a 2-WEEK or monthly-composite bar specification expressed in weeks.

Common situations: Bi-weekly/monthly reporting strategies; configs ported from venues with 2w/4w klines; BarType strings authored by multiplying weeks.

Related errors


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