{"record":{"id":"dcc40eddde4acda1","repo":"nautechsystems/nautilus_trader","slug":"unsupported-bar-aggregation-for-kraken-spot-othe","errorCode":null,"errorMessage":"Unsupported bar aggregation for Kraken Spot: {other:?}","messagePattern":"Unsupported bar aggregation for Kraken Spot: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/kraken/src/common/parse.rs","lineNumber":1177,"sourceCode":"        avg_px_open,\n    })\n}\n\n/// Converts a Nautilus BarType to Kraken Spot API interval (in minutes).\n///\n/// # Errors\n///\n/// Returns an error if:\n/// - Bar aggregation type is not supported (only Minute, Hour, Day are valid).\n/// - Bar step is not supported for the aggregation type.\npub fn bar_type_to_spot_interval(bar_type: BarType) -> anyhow::Result<u32> {\n    let step = bar_type.spec().step.get() as u32;\n    let base_interval = match bar_type.spec().aggregation {\n        BarAggregation::Minute => 1,\n        BarAggregation::Hour => 60,\n        BarAggregation::Day => 1440,\n        other => {\n            anyhow::bail!(\"Unsupported bar aggregation for Kraken Spot: {other:?}\");\n        }\n    };\n    Ok(base_interval * step)\n}\n\n/// Converts a Nautilus BarType to Kraken Futures API resolution string.\n///\n/// Supported resolutions: 1m, 5m, 15m, 1h, 4h, 12h, 1d, 1w\n///\n/// # Errors\n///\n/// Returns an error if:\n/// - Bar aggregation type is not supported.\n/// - Bar step is not supported for the aggregation type.\npub fn bar_type_to_futures_resolution(bar_type: BarType) -> anyhow::Result<&'static str> {\n    let step = bar_type.spec().step.get() as u32;\n    match bar_type.spec().aggregation {\n        BarAggregation::Minute => match step {","sourceCodeStart":1159,"sourceCodeEnd":1195,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/kraken/src/common/parse.rs#L1159-L1195","documentation":"Kraken Spot OHLC data only supports Minute, Hour, and Day bar aggregations; these map to Kraken's interval (1, 60, 1440) multiplied by the bar step. Any other BarAggregation (Tick, Volume, Second, Week, Month, etc.) is rejected by bar_type_to_spot_interval.","triggerScenarios":"request_bars calls bar_type_to_spot_interval with a BarType whose spec aggregation is not Minute, Hour, or Day — e.g. second-based bars or volume bars on a Kraken Spot venue.","commonSituations":"Configuring bar aggregations generically across venues without checking Kraken Spot's supported intervals; requesting 1-second or tick bars from historical data endpoints.","solutions":["Request Minute, Hour, or Day bars only, adjusting the step (step multiplies the base interval).","Aggregate finer/different data client-side (e.g. request 1-minute bars and aggregate to seconds/volume locally).","Switch the bar spec: e.g. Minute with step 5 for 5m bars instead of unsupported aggregations."],"exampleFix":"// before\nlet bar_type = BarType::new(instrument_id, BarSpec::new(BarAggregation::Second, 30));\n// after\nlet bar_type = BarType::new(instrument_id, BarSpec::new(BarAggregation::Minute, 1));","handlingStrategy":"validation","validationCode":"const SPOT_AGGREGATIONS: [BarAggregation; 3] =\n    [BarAggregation::Minute, BarAggregation::Hour, BarAggregation::Day];\nif !SPOT_AGGREGATIONS.contains(&bar_type.spec().aggregation) {\n    eprintln!(\"Kraken Spot supports only Minute/Hour/Day bars\");\n}","typeGuard":null,"tryCatchPattern":"match bar_type_to_spot_interval(&bar_type) {\n    Ok(interval) => request_bars(interval),\n    Err(e) if e.to_string().contains(\"Unsupported bar aggregation\") => {\n        fallback_to_1m_and_aggregate(&bar_type)?;\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Encode per-venue allowed bar specs in strategy config.","Prefer Minute/Hour/Day specs for Kraken Spot history requests.","Build custom aggregations locally from 1m bars instead of requesting them from the venue."],"tags":["kraken","bars","aggregation","unsupported"],"backgroundTag":"unsupported-enum-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}