nautechsystems/nautilus_trader · error

Unsupported aggregation: {other}

Error message

Unsupported aggregation: {other}

What it means

`bar_type_to_granularity` only handles `Minute`, `Hour`, and `Day` aggregations. Any other `BarAggregation` (e.g. `Tick`, `Volume`, `Dollar` value bars) has no Coinbase granularity equivalent and is rejected with this error.

Source

Thrown at crates/adapters/coinbase/src/common/parse.rs:150

    match spec.aggregation {
        BarAggregation::Minute => match step {
            1 => Ok(CoinbaseGranularity::OneMinute),
            5 => Ok(CoinbaseGranularity::FiveMinute),
            15 => Ok(CoinbaseGranularity::FifteenMinute),
            30 => Ok(CoinbaseGranularity::ThirtyMinute),
            _ => anyhow::bail!("Unsupported minute step: {step}"),
        },
        BarAggregation::Hour => match step {
            1 => Ok(CoinbaseGranularity::OneHour),
            2 => Ok(CoinbaseGranularity::TwoHour),
            6 => Ok(CoinbaseGranularity::SixHour),
            _ => anyhow::bail!("Unsupported hour step: {step}"),
        },
        BarAggregation::Day => match step {
            1 => Ok(CoinbaseGranularity::OneDay),
            _ => anyhow::bail!("Unsupported day step: {step}"),
        },
        other => anyhow::bail!("Unsupported aggregation: {other}"),
    }
}

#[cfg(test)]
mod tests {
    use rstest::rstest;

    use super::*;

    #[rstest]
    #[case(
        "BTC-USD.COINBASE-1-MINUTE-LAST-EXTERNAL",
        CoinbaseGranularity::OneMinute
    )]
    #[case(
        "BTC-USD.COINBASE-5-MINUTE-LAST-EXTERNAL",
        CoinbaseGranularity::FiveMinute
    )]

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Use a time-based bar type (Minute/Hour/Day) with the Coinbase data client.
  2. Generate tick- or volume-based bars internally via Nautilus aggregators fed by trades, not via Coinbase candle requests.
  3. Validate the aggregation kind in config before constructing the bar request.

Example fix

// before
"BTC-USD.COINBASE-100-VOLUME.INTERNAL"
// after: request trades and aggregate volume bars internally
"BTC-USD.COINBASE-1-MINUTE.INTERNAL" // or use a local VolumeBar aggregator on trades
Defensive patterns

Strategy: validation

Validate before calling

match bar_type.spec().aggregation {
    BarAggregation::Minute | BarAggregation::Hour | BarAggregation::Day => {},
    other => return Err(anyhow!("Coinbase data client supports time bars only, got {other}")),
}

Try / catch

match bar_type_to_granularity(&bar_type) {
    Ok(g) => request_candles(g),
    Err(e) if e.to_string().contains("Unsupported aggregation") => {
        // route to trade-based internal aggregation instead of REST candles
        subscribe_trades_and_aggregate(&bar_type);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Passing a `BarType` with a non-time-based aggregation — such as `Tick`, `Volume`, or `Value` bars — into `request_bars` against the Coinbase data client.

Common situations: Strategies configured with tick/volume bars reused across exchanges; forgetting that REST candle endpoints can only serve time-based bars.

Related errors


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