nautechsystems/nautilus_trader · error

Trade bin missing low price for {instrument_id}

Error message

Trade bin missing low price for {instrument_id}

What it means

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.

Source

Thrown at crates/adapters/bitmex/src/http/parse.rs:745

/// Returns an error when required OHLC fields are missing from the payload.
pub fn parse_trade_bin(
    bin: &BitmexTradeBin,
    instrument: &InstrumentAny,
    bar_type: &BarType,
    ts_init: UnixNanos,
) -> anyhow::Result<Bar> {
    let instrument_id = bar_type.instrument_id();
    let price_precision = instrument.price_precision();

    let open = bin
        .open
        .ok_or_else(|| anyhow::anyhow!("Trade bin missing open price for {instrument_id}"))?;
    let high = bin
        .high
        .ok_or_else(|| anyhow::anyhow!("Trade bin missing high price for {instrument_id}"))?;
    let low = bin
        .low
        .ok_or_else(|| anyhow::anyhow!("Trade bin missing low price for {instrument_id}"))?;
    let close = bin
        .close
        .ok_or_else(|| anyhow::anyhow!("Trade bin missing close price for {instrument_id}"))?;

    let open = Price::new(open, price_precision);
    let high = Price::new(high, price_precision);
    let low = Price::new(low, price_precision);
    let close = Price::new(close, price_precision);

    let (open, high, low, close) =
        normalize_trade_bin_prices(open, high, low, close, &bin.symbol, Some(bar_type));

    let volume_contracts = normalize_trade_bin_volume(bin.volume, &bin.symbol);
    let volume = parse_contracts_quantity(volume_contracts, instrument);
    let ts_event = UnixNanos::from(bin.timestamp);

    Ok(Bar::new(
        *bar_type, open, high, low, close, volume, ts_event, ts_init,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Exclude the current unfinalized bin from the requested bar range.
  2. Refetch the bin after the bin interval elapses; finalized bins carry all OHLC values.
  3. Pre-filter bins with null OHLC fields before parsing.
  4. Verify the symbol/timeframe combination is valid on BitMEX (valid tradeBin endpoints).

Example fix

// before
let low = bin.low.ok_or_else(|| anyhow::anyhow!("Trade bin missing low price for {instrument_id}"))?;
// after
let Some(low) = bin.low else {
    log::warn!("Skipping incomplete bin for {instrument_id}");
    return Ok(None);
};
Defensive patterns

Strategy: validation

Validate before calling

if bin.low.is_none() { /* skip or refetch bin */ }

Type guard

fn has_ohlc(bin: &BitmexTradeBin) -> Option<(f64, f64, f64, f64)> {
    Some((bin.open?, bin.high?, bin.low?, bin.close?))
}

Try / catch

let bar = parse_trade_bin(&bin, instrument_id, precision)
    .map_err(|e| { log::warn!("incomplete bin skipped: {e}"); e })
    .ok();

Prevention

When it happens

Trigger: 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.

Common situations: Polling the newest bin; BitMEX returning degraded/partial data during outages; symbols with thin liquidity where fields may be momentarily absent.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/d501e128c2e38a01. Report an issue: GitHub.