{"record":{"id":"d501e128c2e38a01","repo":"nautechsystems/nautilus_trader","slug":"trade-bin-missing-low-price-for-instrument-id","errorCode":null,"errorMessage":"Trade bin missing low price for {instrument_id}","messagePattern":"Trade bin missing low price for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/bitmex/src/http/parse.rs","lineNumber":745,"sourceCode":"/// 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\n    let volume_contracts = normalize_trade_bin_volume(bin.volume, &bin.symbol);\n    let volume = parse_contracts_quantity(volume_contracts, instrument);\n    let ts_event = UnixNanos::from(bin.timestamp);\n\n    Ok(Bar::new(\n        *bar_type, open, high, low, close, volume, ts_event, ts_init,","sourceCodeStart":727,"sourceCodeEnd":763,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bitmex/src/http/parse.rs#L727-L763","documentation":"Same guard family as the missing open/high/close checks in parse_trade_bin: the BitMEX trade bin's `low` field is null so no valid Bar can be built. The library treats OHLC as mandatory for Bar construction and fails fast with an anyhow error naming the instrument.","triggerScenarios":"request_bars processing a trade bin JSON where `low` is null — e.g. an in-progress bin streamed/fetched before the exchange computed the low, or a partial REST response.","commonSituations":"Polling the newest bin; BitMEX returning degraded/partial data during outages; symbols with thin liquidity where fields may be momentarily absent.","solutions":["Exclude the current unfinalized bin from the requested bar range.","Refetch the bin after the bin interval elapses; finalized bins carry all OHLC values.","Pre-filter bins with null OHLC fields before parsing.","Verify the symbol/timeframe combination is valid on BitMEX (valid tradeBin endpoints)."],"exampleFix":"// before\nlet low = bin.low.ok_or_else(|| anyhow::anyhow!(\"Trade bin missing low price for {instrument_id}\"))?;\n// after\nlet Some(low) = bin.low else {\n    log::warn!(\"Skipping incomplete bin for {instrument_id}\");\n    return Ok(None);\n};","handlingStrategy":"validation","validationCode":"if bin.low.is_none() { /* skip or refetch bin */ }","typeGuard":"fn has_ohlc(bin: &BitmexTradeBin) -> Option<(f64, f64, f64, f64)> {\n    Some((bin.open?, bin.high?, bin.low?, bin.close?))\n}","tryCatchPattern":"let bar = parse_trade_bin(&bin, instrument_id, precision)\n    .map_err(|e| { log::warn!(\"incomplete bin skipped: {e}\"); e })\n    .ok();","preventionTips":["Request only closed bins for historical analysis.","Treat null OHLC fields in BitMEX responses as expected, not exceptional.","Add a completeness filter upstream of the parser."],"tags":["bitmex","bars","missing-data","null-field"],"backgroundTag":"missing-required-argument","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"}