{"record":{"id":"6b350ead44f43462","repo":"nautechsystems/nautilus_trader","slug":"bybit-only-supports-minute-intervals-1-3-5-15","errorCode":null,"errorMessage":"Bybit only supports minute intervals 1, 3, 5, 15, 30 (use HOUR for >= 60)","messagePattern":"Bybit only supports minute intervals 1, 3, 5, 15, 30 \\(use HOUR for >= 60\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/bybit/src/common/parse.rs","lineNumber":295,"sourceCode":"/// Converts a Nautilus bar aggregation and step to a Bybit kline interval.\n///\n/// Bybit supported intervals: 1, 3, 5, 15, 30, 60, 120, 240, 360, 720 (minutes), D, W, M\n///\n/// # Errors\n///\n/// Returns an error if the aggregation type or step is not supported by Bybit.\npub fn bar_spec_to_bybit_interval(\n    aggregation: BarAggregation,\n    step: u64,\n) -> anyhow::Result<BybitKlineInterval> {\n    match aggregation {\n        BarAggregation::Minute => match step {\n            1 => Ok(BybitKlineInterval::Minute1),\n            3 => Ok(BybitKlineInterval::Minute3),\n            5 => Ok(BybitKlineInterval::Minute5),\n            15 => Ok(BybitKlineInterval::Minute15),\n            30 => Ok(BybitKlineInterval::Minute30),\n            _ => anyhow::bail!(\n                \"Bybit only supports minute intervals 1, 3, 5, 15, 30 (use HOUR for >= 60)\"\n            ),\n        },\n        BarAggregation::Hour => match step {\n            1 => Ok(BybitKlineInterval::Hour1),\n            2 => Ok(BybitKlineInterval::Hour2),\n            4 => Ok(BybitKlineInterval::Hour4),\n            6 => Ok(BybitKlineInterval::Hour6),\n            12 => Ok(BybitKlineInterval::Hour12),\n            _ => anyhow::bail!(\n                \"Bybit only supports the following hour intervals: {BYBIT_HOUR_INTERVALS:?}\"\n            ),\n        },\n        BarAggregation::Day => {\n            if step != 1 {\n                anyhow::bail!(\"Bybit only supports 1 DAY interval bars\");\n            }\n            Ok(BybitKlineInterval::Day1)","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bybit/src/common/parse.rs#L277-L313","documentation":"`bar_spec_to_bybit_interval` maps a bar specification (aggregation + step) to a Bybit kline interval. Bybit only defines 1, 3, 5, 15, and 30 minute klines; any other minute step has no exchange interval, so the mapper fails with this error, suggesting HOUR aggregation for >= 60 minutes.","triggerScenarios":"Requesting bars via `request_bars` with `BarAggregation::Minute` and a step not in {1, 3, 5, 15, 30} — e.g. 2, 10, 45, or 60 minute bars.","commonSituations":"Configuring a strategy with 10-minute or 45-minute bars copied from another venue (Binance supports 10m) that Bybit does not; generating bar specs programmatically from arbitrary durations.","solutions":["Change the bar spec step to a supported value: 1, 3, 5, 15, or 30 minutes.","For 60+ minutes, switch aggregation to `Hour` with the corresponding step (e.g. 1 HOUR instead of 60 MINUTE).","Aggregate locally: request 1-minute or 5-minute bars and build composite bars in the strategy.","Check Bybit's kline documentation for the current supported interval list."],"exampleFix":"// before\nBarSpecification::new(10, BarAggregation::Minute, PriceType::Last)\n// after\nBarSpecification::new(15, BarAggregation::Minute, PriceType::Last)","handlingStrategy":"validation","validationCode":"const BYBIT_MINUTE_STEPS: [u64; 5] = [1, 3, 5, 15, 30];\nfn minute_step_supported(step: u64) -> bool {\n    BYBIT_MINUTE_STEPS.contains(&step)\n}\nanyhow::ensure!(minute_step_supported(bar_spec.step), \"unsupported Bybit minute interval\");","typeGuard":null,"tryCatchPattern":"match bar_spec_to_bybit_interval(&bar_spec) {\n    Ok(interval) => request_klines(interval),\n    Err(e) if e.to_string().contains(\"minute intervals\") => {\n        request_klines(BybitKlineInterval::Minute5) // and aggregate locally\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Validate bar specs against venue-supported intervals at config load time","Use 1/3/5/15/30 minute steps or switch to HOUR aggregation for >= 60 minutes","Porting configs from other venues: re-check intervals per exchange","Write a unit test covering every bar spec in your strategy config"],"tags":["bybit","bar-interval","configuration"],"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"}