nautechsystems/nautilus_trader · error

Unsupported Kraken OHLC interval: {interval}

Error message

Unsupported Kraken OHLC interval: {interval}

What it means

Kraken's OHLC WebSocket channel emits candles at fixed minute intervals (1, 5, 15, 30, 60, 240, 1440, 10080, 21600 minutes). interval_to_bar_spec maps each supported interval to a Nautilus BarSpecification; any interval outside this table cannot be expressed and the parser fails.

Source

Thrown at crates/adapters/kraken/src/websocket/spot_v2/parse.rs:334

    let close_time = ohlc.interval_begin + jiff::SignedDuration::from_secs(interval_secs);
    let ts_event = UnixNanos::from(u64::try_from(close_time.as_nanosecond()).unwrap_or(0));

    Bar::new_checked(bar_type, open, high, low, close, volume, ts_event, ts_init)
}

/// Converts a Kraken OHLC interval (minutes) to a Nautilus bar specification.
fn interval_to_bar_spec(interval: u32) -> anyhow::Result<BarSpecification> {
    let (step, aggregation) = match interval {
        1 => (1, BarAggregation::Minute),
        5 => (5, BarAggregation::Minute),
        15 => (15, BarAggregation::Minute),
        30 => (30, BarAggregation::Minute),
        60 => (1, BarAggregation::Hour),
        240 => (4, BarAggregation::Hour),
        1440 => (1, BarAggregation::Day),
        10080 => (1, BarAggregation::Week),
        21600 => (15, BarAggregation::Day), // 21600 min = 360 hours = 15 days
        _ => anyhow::bail!("Unsupported Kraken OHLC interval: {interval}"),
    };

    Ok(BarSpecification::new(step, aggregation, PriceType::Last))
}

/// Parses Kraken execution type and order status to Nautilus order status.
fn parse_order_status(
    exec_type: KrakenExecType,
    order_status: Option<KrakenWsOrderStatus>,
) -> OrderStatus {
    match exec_type {
        KrakenExecType::Canceled => return OrderStatus::Canceled,
        KrakenExecType::Expired => return OrderStatus::Expired,
        KrakenExecType::Filled => return OrderStatus::Filled,
        KrakenExecType::Trade => {
            return match order_status {
                Some(KrakenWsOrderStatus::Filled) => OrderStatus::Filled,
                Some(KrakenWsOrderStatus::PartiallyFilled) | None => OrderStatus::PartiallyFilled,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Use only Kraken-supported intervals: 1, 5, 15, 30 min; 1 h (60); 4 h (240); 1 day (1440); 1 week (10080); 15 days (21600).
  2. Derive unsupported intervals client-side by aggregating from a supported finer interval (e.g. build 2-min bars from 1-min).
  3. Upgrade the adapter if Kraken introduced a new interval you need.
  4. Double-check the unit: interval is in minutes, not seconds.

Example fix

// before
interval = 720  // 12h, unsupported
// after
interval = 240  // 4h, supported (or aggregate 720-min bars locally from finer data)
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_INTERVALS: &[u64] = &[1, 5, 15, 30, 60, 240, 1440, 10080, 21600];
if !SUPPORTED_INTERVALS.contains(&interval) {
    return Err(format!("interval {interval} not supported by Kraken OHLC"));
}

Try / catch

match parse_ws_bar(msg) {
    Err(e) if e.to_string().contains("Unsupported Kraken OHLC interval") => {
        // skip the message or resubscribe with a supported interval
    }
    r => r?,
}

Prevention

When it happens

Trigger: Subscribing to or parsing an OHLC WS message with interval value not in {1,5,15,30,60,240,1440,10080,21600} — raised inside interval_to_bar_spec, reached via parse_ws_bar when Kraken sends or the user requests an unmapped interval.

Common situations: Configuring a bar subscription with an interval Kraken doesn't publish (e.g. 2-minute or 12-hour bars); Kraken adding a new interval that an older adapter version doesn't map; passing seconds instead of minutes as the interval value.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/e5fe27974e5852b5. Report an issue: GitHub.