nautechsystems/nautilus_trader · error

Derive does not support

Error message

Derive does not support {aggregation:?} bars

What it means

bar_spec_to_derive_period only implements Minute/Hour/Day/Week aggregations for the Derive adapter; any other NautilusTrader BarAggregation (e.g. Second, Tick, Volume) has no Derive interval mapping and is rejected with this bail.

Solutions

  1. Use Minute, Hour, Day, or Week aggregation in the BarSpecification
  2. Use second-based bars only with an adapter that supports them
  3. Check Derive's supported intervals before configuring bar subscriptions

Example fix

// before
let spec = BarSpecification::new(15.into(), BarAggregation::Second, PriceType::Last);
// after
let spec = BarSpecification::new(15.into(), BarAggregation::Minute, PriceType::Last);
Defensive patterns

Strategy: validation

Validate before calling

const DERIVE_AGGREGATIONS: &[BarAggregation] = &[BarAggregation::Minute, BarAggregation::Hour, BarAggregation::Day, BarAggregation::Week];
fn is_derive_aggregation_supported(agg: BarAggregation) -> bool {
    DERIVE_AGGREGATIONS.contains(&agg)
}

Prevention

When it happens

Trigger: Calling request_bars with a BarSpecification whose aggregation is not Minute, Hour, Day, or Week — e.g. BarAggregation::Second, Tick, Volume, or Dollar based bars.

Common situations: Reusing a bar spec written for a tick/volume-capable adapter with the Derive adapter; defaulting specs that use second-based aggregation for intraday strategies.

Related errors


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

Appendix: source

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

        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.
///
/// # Errors
///
/// Returns an error when the ticker timestamp is negative or overflows.
pub fn parse_option_greeks(

View on GitHub (pinned to 18893faf8b)