{"record":{"id":"fa2614485ac74cb2","repo":"nautechsystems/nautilus_trader","slug":"bybit-only-supports-the-following-hour-intervals","errorCode":null,"errorMessage":"Bybit only supports the following hour intervals: {BYBIT_HOUR_INTERVALS:?}","messagePattern":"Bybit only supports the following hour intervals: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/bybit/src/common/parse.rs","lineNumber":305,"sourceCode":") -> 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)\n        }\n        BarAggregation::Week => {\n            if step != 1 {\n                anyhow::bail!(\"Bybit only supports 1 WEEK interval bars\");\n            }\n            Ok(BybitKlineInterval::Week1)\n        }\n        BarAggregation::Month => {\n            if step != 1 {\n                anyhow::bail!(\"Bybit only supports 1 MONTH interval bars\");","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bybit/src/common/parse.rs#L287-L323","documentation":"`bar_spec_to_bybit_interval` maps hour-aggregated bar specs to Bybit kline intervals; only 1, 2, 4, 6, and 12 hour steps exist on Bybit (as listed in `BYBIT_HOUR_INTERVALS`). Any other hour step raises this error naming the supported set.","triggerScenarios":"Requesting bars with `BarAggregation::Hour` and a step not in {1, 2, 4, 6, 12} — e.g. 3, 8, or 24 hour bars.","commonSituations":"Configuring 8-hour bars (common on crypto dashboards) which Bybit doesn't offer; 24-hour bars that should be expressed as 1 DAY; porting configs from venues with richer hour intervals (Binance has 8h).","solutions":["Use a supported hour step: 1, 2, 4, 6, or 12.","Express 24-hour bars as `BarAggregation::Day` step 1.","Composite-aggregate locally from 1-hour or 4-hour bars for unsupported steps like 8.","Print/check `BYBIT_HOUR_INTERVALS` in the adapter version you use, as the supported set could expand."],"exampleFix":"// before\nBarSpecification::new(8, BarAggregation::Hour, PriceType::Last)\n// after\nBarSpecification::new(6, BarAggregation::Hour, PriceType::Last)","handlingStrategy":"validation","validationCode":"const BYBIT_HOUR_STEPS: [u64; 5] = [1, 2, 4, 6, 12];\nfn hour_step_supported(step: u64) -> bool {\n    BYBIT_HOUR_STEPS.contains(&step)\n}\nanyhow::ensure!(hour_step_supported(bar_spec.step), \"unsupported Bybit hour 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(\"hour intervals\") => {\n        request_klines(BybitKlineInterval::Hour1) // aggregate to 8h locally\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Use only 1/2/4/6/12 hour steps on Bybit","Express 24-hour bars as 1 DAY instead of 24 HOUR","Build multi-hour bars locally from 1h klines when needed","Consult BYBIT_HOUR_INTERVALS in the adapter for the authoritative set"],"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"}