{"record":{"id":"e56ca8e17288f26c","repo":"nautechsystems/nautilus_trader","slug":"bitmex-does-not-support-bars","errorCode":null,"errorMessage":"BitMEX does not support {}-{:?}-{:?} bars","messagePattern":"BitMEX does not support (.+?)-(.+?)-(.+?) bars","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/bitmex/src/http/client.rs","lineNumber":2326,"sourceCode":"        anyhow::ensure!(\n            bar_type.spec().price_type == PriceType::Last,\n            \"Only LAST price type bars are supported\"\n        );\n\n        if let (Some(start), Some(end)) = (start, end) {\n            anyhow::ensure!(\n                start < end,\n                \"Invalid time range: start={start:?} end={end:?}\"\n            );\n        }\n\n        let spec = bar_type.spec();\n        let bin_size = match (spec.aggregation, spec.step.get()) {\n            (BarAggregation::Minute, 1) => \"1m\",\n            (BarAggregation::Minute, 5) => \"5m\",\n            (BarAggregation::Hour, 1) => \"1h\",\n            (BarAggregation::Day, 1) => \"1d\",\n            _ => anyhow::bail!(\n                \"BitMEX does not support {}-{:?}-{:?} bars\",\n                spec.step.get(),\n                spec.aggregation,\n                spec.price_type,\n            ),\n        };\n\n        let instrument_id = bar_type.instrument_id();\n        let instrument = self.instrument_from_cache_by_id(instrument_id)?;\n\n        let mut params = GetTradeBucketedParamsBuilder::default();\n        params.symbol(instrument_id.symbol.as_str());\n        params.bin_size(bin_size);\n\n        if partial {\n            params.partial(true);\n        }\n","sourceCodeStart":2308,"sourceCodeEnd":2344,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bitmex/src/http/client.rs#L2308-L2344","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nlet bar_type = BarType::new(instrument_id, BarAggregation::Minute, 15, PriceType::Last);\n// after\nlet bar_type = BarType::new(instrument_id, BarAggregation::Minute, 1, PriceType::Last); // aggregate to 15m downstream","handlingStrategy":"validation","validationCode":"let supported = matches!(\n    (bar_type.spec().aggregation, bar_type.spec().step.get()),\n    (BarAggregation::Minute, 1) | (BarAggregation::Minute, 5) | (BarAggregation::Hour, 1) | (BarAggregation::Day, 1)\n);\nensure!(supported, \"unsupported BitMEX bar spec: {:?}\", bar_type.spec());","typeGuard":"fn is_supported_bitmex_bar_spec(spec: &BarAggregationSpec) -> bool {\n    matches!(\n        (spec.aggregation, spec.step.get()),\n        (BarAggregation::Minute, 1) | (BarAggregation::Minute, 5) | (BarAggregation::Hour, 1) | (BarAggregation::Day, 1)\n    )\n}","tryCatchPattern":"match client.request_bars(bar_type, limit).await {\n    Ok(bars) => { /* handle */ }\n    Err(e) if e.to_string().contains(\"does not support\") => {\n        // fall back to 1m bars and resample locally\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["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"],"tags":["rust","bitmex","bars","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"}