nautechsystems/nautilus_trader · error
BitMEX does not support {}-{:?}-{:?} bars
Error message
BitMEX does not support {}-{:?}-{:?} bars What it means
Raised when requesting bars for a spec BitMEX does not serve. The adapter maps only specific (aggregation, step) combinations: 1-minute, 5-minute, 1-hour, and 1-day. Any other combination (e.g. 15-minute, second-based, or Minute-3 bars) produces this error listing the unsupported step, aggregation, and price type.
Source
Thrown at crates/adapters/bitmex/src/http/client.rs:2326
anyhow::ensure!(
bar_type.spec().price_type == PriceType::Last,
"Only LAST price type bars are supported"
);
if let (Some(start), Some(end)) = (start, end) {
anyhow::ensure!(
start < end,
"Invalid time range: start={start:?} end={end:?}"
);
}
let spec = bar_type.spec();
let bin_size = match (spec.aggregation, spec.step.get()) {
(BarAggregation::Minute, 1) => "1m",
(BarAggregation::Minute, 5) => "5m",
(BarAggregation::Hour, 1) => "1h",
(BarAggregation::Day, 1) => "1d",
_ => anyhow::bail!(
"BitMEX does not support {}-{:?}-{:?} bars",
spec.step.get(),
spec.aggregation,
spec.price_type,
),
};
let instrument_id = bar_type.instrument_id();
let instrument = self.instrument_from_cache_by_id(instrument_id)?;
let mut params = GetTradeBucketedParamsBuilder::default();
params.symbol(instrument_id.symbol.as_str());
params.bin_size(bin_size);
if partial {
params.partial(true);
}
View on GitHub (pinned to 18893faf8b)
Solutions
- Use one of the supported bar specs: 1m, 5m, 1h, or 1d
- Request 1m bars and aggregate locally to the desired interval (e.g. 15m)
- Check the BitMEX API documentation for currently supported binSizes, as the adapter supports only this fixed subset
Example fix
// before let bar_type = BarType::new(instrument_id, BarAggregation::Minute, 15, PriceType::Last); // after let bar_type = BarType::new(instrument_id, BarAggregation::Minute, 1, PriceType::Last); // aggregate to 15m downstream
Defensive patterns
Strategy: validation
Validate before calling
let supported = matches!(
(bar_type.spec().aggregation, bar_type.spec().step.get()),
(BarAggregation::Minute, 1) | (BarAggregation::Minute, 5) | (BarAggregation::Hour, 1) | (BarAggregation::Day, 1)
);
ensure!(supported, "unsupported BitMEX bar spec: {:?}", bar_type.spec()); Type guard
fn is_supported_bitmex_bar_spec(spec: &BarAggregationSpec) -> bool {
matches!(
(spec.aggregation, spec.step.get()),
(BarAggregation::Minute, 1) | (BarAggregation::Minute, 5) | (BarAggregation::Hour, 1) | (BarAggregation::Day, 1)
)
} Try / catch
match client.request_bars(bar_type, limit).await {
Ok(bars) => { /* handle */ }
Err(e) if e.to_string().contains("does not support") => {
// fall back to 1m bars and resample locally
}
Err(e) => return Err(e),
} Prevention
- Restrict BitMEX bar configs to 1m, 5m, 1h, and 1d
- Build higher intervals (e.g. 15m, 4h) from 1m bars via local aggregation
- Validate bar specs at strategy configuration load time, not request time
When it happens
Trigger: Calling bars/request with a BarType whose spec is not one of (Minute,1), (Minute,5), (Hour,1), or (Day,1). E.g. BarAggregation::Minute with step 15, or Second aggregation of any step.
Common situations: Users configuring bar aggregation intervals that work on other venues (like 15m or 4h) but not BitMEX's limited REST binSize set; strategy configs copied across adapters.
Related errors
- Binance Futures does not support second-level kline interval
- Binance Futures does not support {a:?} aggregation
- Only EXTERNAL aggregation bars are supported
- `handle_bar` is not implemented for `{}`
- Aggregation not time based
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/e56ca8e17288f26c.
Report an issue: GitHub.