nautechsystems/nautilus_trader · error

Unsupported Deribit resolution: {resolution}

Error message

Unsupported Deribit resolution: {resolution}

What it means

Deribit's websocket chart/trade messages carry a string `resolution` field (e.g. "1", "60", "1D"). `resolution_to_bar_type` maps that string to a Nautilus BarSpecification (step + BarAggregation). If the resolution string is not one of the known Deribit values, the mapping fails and this error is raised instead of constructing a BarType.

Source

Thrown at crates/adapters/deribit/src/websocket/parse.rs:637

/// Returns an error if the resolution string is invalid or BarType construction fails.
pub fn resolution_to_bar_type(
    instrument_id: InstrumentId,
    resolution: &str,
) -> anyhow::Result<BarType> {
    let (step, aggregation) = match resolution {
        "1" => (1, BarAggregation::Minute),
        "3" => (3, BarAggregation::Minute),
        "5" => (5, BarAggregation::Minute),
        "10" => (10, BarAggregation::Minute),
        "15" => (15, BarAggregation::Minute),
        "30" => (30, BarAggregation::Minute),
        "60" => (1, BarAggregation::Hour),
        "120" => (2, BarAggregation::Hour),
        "180" => (3, BarAggregation::Hour),
        "360" => (6, BarAggregation::Hour),
        "720" => (12, BarAggregation::Hour),
        "1D" => (1, BarAggregation::Day),
        _ => anyhow::bail!("Unsupported Deribit resolution: {resolution}"),
    };

    let spec = BarSpecification::new_checked(step, aggregation, PriceType::Last)
        .context("invalid Deribit bar resolution")?;
    Ok(BarType::new(
        instrument_id,
        spec,
        AggregationSource::External,
    ))
}

/// Parses a Deribit chart message from a WebSocket subscription into a [`Bar`].
///
/// Converts a single OHLCV data point from the `chart.trades.{instrument}.{resolution}` channel
/// into a Nautilus Bar object.
///
/// When `use_cost_for_volume` is true, `Bar.volume` is populated from `chart_msg.cost` (USD) to
/// match instruments whose trade `amount` is in USD (inverse perpetuals / inverse futures).

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Check the resolution string against the supported set in `resolution_to_bar_type` (1,2,3,4,5,10,15,20,30 minutes; 60/120/180/360/720 hour steps; "1D") and use only those values
  2. Compute the equivalent supported resolution (e.g. 5-minute data from 1-minute bars) or use a venue that natively supports the desired aggregation
  3. Update the adapter to map newly introduced Deribit resolutions if Deribit added them and your adapter version is outdated

Example fix

// before
let bar_type = resolution_to_bar_type(instrument_id, "5")?; // unsupported
// after
let bar_type = resolution_to_bar_type(instrument_id, "1")?; // use 1-minute bars
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED: &[&str] = &["1","2","3","4","5","10","15","20","30","60","120","180","360","720","1D"];
fn is_supported_resolution(r: &str) -> bool { SUPPORTED.contains(&r) }

Type guard

fn is_supported_resolution(r: &str) -> bool {
    matches!(r, "1"|"2"|"3"|"4"|"5"|"10"|"15"|"20"|"30"|"60"|"120"|"180"|"360"|"720"|"1D")
}

Try / catch

match resolution_to_bar_type(instrument_id, resolution) {
    Ok(bar_type) => { /* use bar_type */ }
    Err(e) => tracing::warn!(%resolution, %e, "skipping unsupported Deribit resolution"),
}

Prevention

When it happens

Trigger: Deribit sends a chart/ohlc message (or the user requests bars) with a resolution string not in the match table — e.g. a new Deribit interval like "2" or "1W", a typo'd resolution passed when subscribing to bars, or a bar type was constructed with a step/aggregation combo that has no Deribit resolution equivalent.

Common situations: Requesting bar aggregations Deribit doesn't offer (e.g. 5-minute bars requested via a resolution Deribit doesn't publish), Deribit adding new resolutions not yet handled by this adapter version, or hardcoded resolution strings in user config that drift from the adapter's supported set.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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