nautechsystems/nautilus_trader · error
Bybit only supports the following hour intervals: {BYBIT_HOU
Error message
Bybit only supports the following hour intervals: {BYBIT_HOUR_INTERVALS:?} What it means
`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.
Source
Thrown at crates/adapters/bybit/src/common/parse.rs:305
) -> anyhow::Result<BybitKlineInterval> {
match aggregation {
BarAggregation::Minute => match step {
1 => Ok(BybitKlineInterval::Minute1),
3 => Ok(BybitKlineInterval::Minute3),
5 => Ok(BybitKlineInterval::Minute5),
15 => Ok(BybitKlineInterval::Minute15),
30 => Ok(BybitKlineInterval::Minute30),
_ => anyhow::bail!(
"Bybit only supports minute intervals 1, 3, 5, 15, 30 (use HOUR for >= 60)"
),
},
BarAggregation::Hour => match step {
1 => Ok(BybitKlineInterval::Hour1),
2 => Ok(BybitKlineInterval::Hour2),
4 => Ok(BybitKlineInterval::Hour4),
6 => Ok(BybitKlineInterval::Hour6),
12 => Ok(BybitKlineInterval::Hour12),
_ => anyhow::bail!(
"Bybit only supports the following hour intervals: {BYBIT_HOUR_INTERVALS:?}"
),
},
BarAggregation::Day => {
if step != 1 {
anyhow::bail!("Bybit only supports 1 DAY interval bars");
}
Ok(BybitKlineInterval::Day1)
}
BarAggregation::Week => {
if step != 1 {
anyhow::bail!("Bybit only supports 1 WEEK interval bars");
}
Ok(BybitKlineInterval::Week1)
}
BarAggregation::Month => {
if step != 1 {
anyhow::bail!("Bybit only supports 1 MONTH interval bars");View on GitHub (pinned to 18893faf8b)
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.
Example fix
// before BarSpecification::new(8, BarAggregation::Hour, PriceType::Last) // after BarSpecification::new(6, BarAggregation::Hour, PriceType::Last)
Defensive patterns
Strategy: validation
Validate before calling
const BYBIT_HOUR_STEPS: [u64; 5] = [1, 2, 4, 6, 12];
fn hour_step_supported(step: u64) -> bool {
BYBIT_HOUR_STEPS.contains(&step)
}
anyhow::ensure!(hour_step_supported(bar_spec.step), "unsupported Bybit hour interval"); Try / catch
match bar_spec_to_bybit_interval(&bar_spec) {
Ok(interval) => request_klines(interval),
Err(e) if e.to_string().contains("hour intervals") => {
request_klines(BybitKlineInterval::Hour1) // aggregate to 8h locally
}
Err(e) => return Err(e),
} Prevention
- 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
When it happens
Trigger: Requesting bars with `BarAggregation::Hour` and a step not in {1, 2, 4, 6, 12} — e.g. 3, 8, or 24 hour bars.
Common situations: 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).
Related errors
- Bybit only supports minute intervals 1, 3, 5, 15, 30 (use HO
- Bybit only supports 1 DAY interval bars
- Chain ID mismatch at connect: expected {expected_chain_id},
- Batch cancel limit is {endpoint_limit} orders for {product_t
- Unsupported blockchain {blockchain} for RPC connection
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/fa2614485ac74cb2.
Report an issue: GitHub.