nautechsystems/nautilus_trader · error

Unsupported bar aggregation for Kraken Futures: {other:?}

Error message

Unsupported bar aggregation for Kraken Futures: {other:?}

What it means

Kraken Futures only supports a fixed set of bar aggregation steps (seconds, minutes, hours, days, and 1-week) when converting a NautilusTrader BarType into a Kraken Futures resolution string. Any other aggregation step cannot be mapped, so `bar_type_to_futures_resolution` bails with this error before a REST request is made.

Source

Thrown at crates/adapters/kraken/src/common/parse.rs:1222

            12 => Ok("12h"),
            _ => anyhow::bail!("Unsupported hour step for Kraken Futures: {step}"),
        },
        BarAggregation::Day => {
            if step == 1 {
                Ok("1d")
            } else {
                anyhow::bail!("Unsupported day step for Kraken Futures: {step}")
            }
        }
        BarAggregation::Week => {
            if step == 1 {
                Ok("1w")
            } else {
                anyhow::bail!("Unsupported week step for Kraken Futures: {step}")
            }
        }
        other => {
            anyhow::bail!("Unsupported bar aggregation for Kraken Futures: {other:?}");
        }
    }
}

/// Truncates a `ClientOrderId` for Kraken's `cl_ord_id` field.
///
/// Kraken accepts three formats:
/// - Long UUID (36 chars with hyphens): passed through
/// - Short UUID (32 hex chars): passed through
/// - Free text: max 18 chars
///
/// Sequential NautilusTrader IDs (e.g. `O202602270023210040011`) exceed the
/// 18-char free-text limit. These are truncated to 'O' + last 17 chars,
/// preserving the counter portion for maximum entropy.
pub fn truncate_cl_ord_id(client_order_id: &ClientOrderId) -> String {
    let id = client_order_id.as_str();

    if id.len() <= 18 {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Change the BarSpec aggregation/step to one Kraken Futures supports (SEC/MINUTE/HOUR/DAY steps or 1 WEEK)
  2. Inspect the match arms in crates/adapters/kraken/src/common/parse.rs to see exactly which steps are accepted
  3. Use a different venue adapter if the unsupported aggregation is required

Example fix

// before
let bar_type = BarType::from("KF-USD@Kraken-1-MONTH-LAST-INTERNAL");
client.request_bars(bar_type);
// after
let bar_type = BarType::from("KF-USD@Kraken-1-DAY-LAST-INTERNAL");
client.request_bars(bar_type);
Defensive patterns

Strategy: validation

Validate before calling

fn is_futures_supported_bar_spec(spec: &BarSpecification) -> bool {
    use Aggregation::*;
    matches!(spec.aggregation(), Second | Minute | Hour | Day)
        || (spec.aggregation() == Week && spec.step() == 1)
}
if !is_futures_supported_bar_spec(bar_type.spec()) { /* fix spec before requesting */ }

Type guard

fn is_supported_aggregation(a: Aggregation) -> bool {
    matches!(a, Aggregation::Second | Aggregation::Minute | Aggregation::Hour | Aggregation::Day | Aggregation::Week)
}

Prevention

When it happens

Trigger: Calling `request_bars` (or invoking `bar_type_to_futures_resolution` directly) with a BarType whose aggregation/step is not one of the supported mappings — e.g. MONTH aggregation or an unusual step Kraken Futures does not offer.

Common situations: Requesting bars with a 1-MONTH or 3-MONTH spec; copying a bar spec that works on Kraken Spot or another venue into a Kraken Futures data request.

Related errors


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