nautechsystems/nautilus_trader · error

Derive only supports 1 WEEK interval bars

Error message

Derive only supports 1 WEEK interval bars

What it means

Derive's API only supports weekly candlestick intervals with a step of exactly 1; the adapter converts NautilusTrader BarSpecification values into Derive period seconds and rejects any WEEK aggregation whose step is not 1 (e.g. 2W). The bail produces an anyhow error which request_bars propagates to the caller.

Source

Thrown at crates/adapters/derive/src/websocket/parse.rs:674

            _ => anyhow::bail!(
                "Derive only supports minute intervals 1, 5, 15, 30 (use HOUR for >= 60)"
            ),
        },
        BarAggregation::Hour => match step {
            1 => Ok(3600),
            4 => Ok(14400),
            8 => Ok(28800),
            _ => anyhow::bail!("Derive only supports hour intervals 1, 4, 8"),
        },
        BarAggregation::Day => {
            if step != 1 {
                anyhow::bail!("Derive only supports 1 DAY interval bars");
            }
            Ok(86400)
        }
        BarAggregation::Week => {
            if step != 1 {
                anyhow::bail!("Derive only supports 1 WEEK interval bars");
            }
            Ok(604800)
        }
        _ => anyhow::bail!("Derive does not support {aggregation:?} bars"),
    }
}

fn timestamp_seconds_to_nanos(value: u64, field: &str) -> anyhow::Result<UnixNanos> {
    let nanos = value
        .checked_mul(NANOSECONDS_IN_SECOND)
        .with_context(|| format!("Derive {field} overflows nanoseconds"))?;
    Ok(UnixNanos::from(nanos))
}

/// Parses an option ticker payload into [`OptionGreeks`].
///
/// Returns `Ok(None)` when the ticker does not carry option pricing.
///

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Change the bar specification to BarAggregation::Week with step 1
  2. Request a larger time window of 1-week bars instead of multi-week bars
  3. Switch to a different adapter/exchange that supports multi-week aggregation

Example fix

// before
let spec = BarSpecification::new(2.into(), BarAggregation::Week, PriceType::Last);
// after
let spec = BarSpecification::new(1.into(), BarAggregation::Week, PriceType::Last);
Defensive patterns

Strategy: validation

Validate before calling

fn is_derive_bar_spec_supported(spec: &BarSpecification) -> bool {
    match spec.aggregation {
        BarAggregation::Minute | BarAggregation::Hour | BarAggregation::Day => true,
        BarAggregation::Week => spec.step.get() == 1,
        _ => false,
    }
}

Prevention

When it happens

Trigger: Calling request_bars with a BarSpecification whose aggregation is BarAggregation::Week and whose step is anything other than 1 (e.g. step=2 or 4).

Common situations: Configuring a 2-week or 4-week bar aggregation in a config file or strategy definition while using the Derive adapter for historical/data subscription.

Related errors


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