{"record":{"id":"7f8e29a535824c24","repo":"nautechsystems/nautilus_trader","slug":"trade-bin-missing-open-price-for-instrument-id","errorCode":null,"errorMessage":"Trade bin missing open price for {instrument_id}","messagePattern":"Trade bin missing open price for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/bitmex/src/http/parse.rs","lineNumber":739,"sourceCode":"}\n\n/// Converts a BitMEX trade-bin record into a Nautilus [`Bar`].\n///\n/// # Errors\n///\n/// Returns an error when required OHLC fields are missing from the payload.\npub fn parse_trade_bin(\n    bin: &BitmexTradeBin,\n    instrument: &InstrumentAny,\n    bar_type: &BarType,\n    ts_init: UnixNanos,\n) -> anyhow::Result<Bar> {\n    let instrument_id = bar_type.instrument_id();\n    let price_precision = instrument.price_precision();\n\n    let open = bin\n        .open\n        .ok_or_else(|| anyhow::anyhow!(\"Trade bin missing open price for {instrument_id}\"))?;\n    let high = bin\n        .high\n        .ok_or_else(|| anyhow::anyhow!(\"Trade bin missing high price for {instrument_id}\"))?;\n    let low = bin\n        .low\n        .ok_or_else(|| anyhow::anyhow!(\"Trade bin missing low price for {instrument_id}\"))?;\n    let close = bin\n        .close\n        .ok_or_else(|| anyhow::anyhow!(\"Trade bin missing close price for {instrument_id}\"))?;\n\n    let open = Price::new(open, price_precision);\n    let high = Price::new(high, price_precision);\n    let low = Price::new(low, price_precision);\n    let close = Price::new(close, price_precision);\n\n    let (open, high, low, close) =\n        normalize_trade_bin_prices(open, high, low, close, &bin.symbol, Some(bar_type));\n","sourceCodeStart":721,"sourceCodeEnd":757,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bitmex/src/http/parse.rs#L721-L757","documentation":"parse_trade_bin converts a BitMEX tradeBin into a Nautilus Bar and requires the OHLC fields to be present. If the bin's open price is null (BitMEX may omit fields on partial/empty bins), the parser fails with this message naming the instrument.","triggerScenarios":"request_bars receiving a tradeBin record with a null open field — typically the still-forming (partial) latest bin when partial=true, or venue-side gaps in bin data.","commonSituations":"Requesting bars that include the current, not-yet-closed bucket; venue maintenance windows producing incomplete bins; low-liquidity symbols where the bin has no trades.","solutions":["Set partial=false (or exclude the last bin) so only closed, complete bins are requested.","Trim the end timestamp back before the current bucket boundary.","Check adjacent fields (high/low/close) — if all are null, the bin is empty and should be skipped.","Retry the request later if the gap is transient; verify the bin exists on the BitMEX /trade/bins endpoint."],"exampleFix":"// before\nlet bars = client.request_bars(bar_type, start, end, limit, true).await?;\n// after\nlet bars = client.request_bars(bar_type, start, end, limit, false).await?;","handlingStrategy":"fallback","validationCode":"let open = bin.open\n    .or_else(|| log_warn_then_none(&bin, instrument_id))\n    .ok_or_else(|| anyhow::anyhow!(\"Trade bin missing open price for {instrument_id}\"))?;","typeGuard":null,"tryCatchPattern":"match client.request_bars(bar_type, start, end, limit, partial).await {\n    Ok(bars) => bars,\n    Err(e) if e.to_string().contains(\"missing open price\") => {\n        log::warn!(\"partial bin received; retrying without last bar: {e}\");\n        client.request_bars(bar_type, start, end_trimmed, limit, false).await?\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Prefer partial=false for historical backfills.","Trim end back to the last fully closed bucket boundary.","Treat the latest bin as provisional and refresh it once closed.","Skip bins where any OHLC field is null rather than failing the batch."],"tags":["bars","parsing","missing-field","bitmex","trade-bin"],"backgroundTag":"empty-required-field","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"}