{"record":{"id":"6eb469442348a0df","repo":"nautechsystems/nautilus_trader","slug":"unsupported-deribit-resolution-resolution","errorCode":null,"errorMessage":"Unsupported Deribit resolution: {resolution}","messagePattern":"Unsupported Deribit resolution: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/deribit/src/websocket/parse.rs","lineNumber":637,"sourceCode":"/// Returns an error if the resolution string is invalid or BarType construction fails.\npub fn resolution_to_bar_type(\n    instrument_id: InstrumentId,\n    resolution: &str,\n) -> anyhow::Result<BarType> {\n    let (step, aggregation) = match resolution {\n        \"1\" => (1, BarAggregation::Minute),\n        \"3\" => (3, BarAggregation::Minute),\n        \"5\" => (5, BarAggregation::Minute),\n        \"10\" => (10, BarAggregation::Minute),\n        \"15\" => (15, BarAggregation::Minute),\n        \"30\" => (30, BarAggregation::Minute),\n        \"60\" => (1, BarAggregation::Hour),\n        \"120\" => (2, BarAggregation::Hour),\n        \"180\" => (3, BarAggregation::Hour),\n        \"360\" => (6, BarAggregation::Hour),\n        \"720\" => (12, BarAggregation::Hour),\n        \"1D\" => (1, BarAggregation::Day),\n        _ => anyhow::bail!(\"Unsupported Deribit resolution: {resolution}\"),\n    };\n\n    let spec = BarSpecification::new_checked(step, aggregation, PriceType::Last)\n        .context(\"invalid Deribit bar resolution\")?;\n    Ok(BarType::new(\n        instrument_id,\n        spec,\n        AggregationSource::External,\n    ))\n}\n\n/// Parses a Deribit chart message from a WebSocket subscription into a [`Bar`].\n///\n/// Converts a single OHLCV data point from the `chart.trades.{instrument}.{resolution}` channel\n/// into a Nautilus Bar object.\n///\n/// When `use_cost_for_volume` is true, `Bar.volume` is populated from `chart_msg.cost` (USD) to\n/// match instruments whose trade `amount` is in USD (inverse perpetuals / inverse futures).","sourceCodeStart":619,"sourceCodeEnd":655,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/deribit/src/websocket/parse.rs#L619-L655","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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","Compute the equivalent supported resolution (e.g. 5-minute data from 1-minute bars) or use a venue that natively supports the desired aggregation","Update the adapter to map newly introduced Deribit resolutions if Deribit added them and your adapter version is outdated"],"exampleFix":"// before\nlet bar_type = resolution_to_bar_type(instrument_id, \"5\")?; // unsupported\n// after\nlet bar_type = resolution_to_bar_type(instrument_id, \"1\")?; // use 1-minute bars","handlingStrategy":"validation","validationCode":"const SUPPORTED: &[&str] = &[\"1\",\"2\",\"3\",\"4\",\"5\",\"10\",\"15\",\"20\",\"30\",\"60\",\"120\",\"180\",\"360\",\"720\",\"1D\"];\nfn is_supported_resolution(r: &str) -> bool { SUPPORTED.contains(&r) }","typeGuard":"fn is_supported_resolution(r: &str) -> bool {\n    matches!(r, \"1\"|\"2\"|\"3\"|\"4\"|\"5\"|\"10\"|\"15\"|\"20\"|\"30\"|\"60\"|\"120\"|\"180\"|\"360\"|\"720\"|\"1D\")\n}","tryCatchPattern":"match resolution_to_bar_type(instrument_id, resolution) {\n    Ok(bar_type) => { /* use bar_type */ }\n    Err(e) => tracing::warn!(%resolution, %e, \"skipping unsupported Deribit resolution\"),\n}","preventionTips":["Only request bars using resolutions listed in resolution_to_bar_type","Derive higher aggregations locally from 1-minute bars","Keep adapter versions current so new Deribit resolutions are handled"],"tags":["rust","deribit","websocket","parsing","bars"],"backgroundTag":"invalid-enum-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}