nautechsystems/nautilus_trader · error

Missing is_quanto for {}

Error message

Missing is_quanto for {}

What it means

The `is_quanto` flag tells the adapter whether a BitMEX contract is quanto-settled, which affects currency conversion of PnL/fees. When the instrument message lacks this field the adapter fails fast with this error instead of guessing settlement semantics. Wrong or missing quanto flags would corrupt money calculations.

Source

Thrown at crates/adapters/bitmex/src/websocket/messages.rs:597

        // Required fields
        let root_symbol = msg
            .root_symbol
            .ok_or_else(|| anyhow::anyhow!("Missing root_symbol for {}", msg.symbol))?;
        let underlying = msg
            .underlying
            .ok_or_else(|| anyhow::anyhow!("Missing underlying for {}", msg.symbol))?;
        let quote_currency = msg
            .quote_currency
            .ok_or_else(|| anyhow::anyhow!("Missing quote_currency for {}", msg.symbol))?;
        let tick_size = msg
            .tick_size
            .ok_or_else(|| anyhow::anyhow!("Missing tick_size for {}", msg.symbol))?;
        let multiplier = msg
            .multiplier
            .ok_or_else(|| anyhow::anyhow!("Missing multiplier for {}", msg.symbol))?;
        let is_quanto = msg
            .is_quanto
            .ok_or_else(|| anyhow::anyhow!("Missing is_quanto for {}", msg.symbol))?;
        let is_inverse = msg
            .is_inverse
            .ok_or_else(|| anyhow::anyhow!("Missing is_inverse for {}", msg.symbol))?;

        // Parse state - default to Open if not present
        let state = msg
            .state
            .and_then(|s| serde_json::from_str::<BitmexInstrumentState>(&format!("\"{s}\"")).ok())
            .unwrap_or(BitmexInstrumentState::Open);

        // Parse instrument type - default to PerpetualContract if not present
        let instrument_type = msg
            .instrument_type
            .and_then(|t| serde_json::from_str::<BitmexInstrumentType>(&format!("\"{t}\"")).ok())
            .unwrap_or(BitmexInstrumentType::PerpetualContract);

        Ok(Self {
            symbol: msg.symbol,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Inspect the received instrument payload and ensure `is_quanto` is included (it is always present in BitMEX instrument records).
  2. Fix the deserialization path so the field is not stripped (check serde field renames/skip rules).
  3. Update any local test fixtures to include `"is_quanto": false` (or true as appropriate).
  4. Pull a full instrument definition from BitMEX REST to populate all required fields before processing.

Example fix

// before
let payload = r#"{"symbol":"ETHUSD","multiplier":1000000000000}"#;
// after
let payload = r#"{"symbol":"ETHUSD","multiplier":1000000000000,"is_quanto":false}"#;
Defensive patterns

Strategy: validation

Validate before calling

fn validate_instrument_msg(msg: &BitmexInstrumentMsg) -> Result<(), String> {
    if msg.is_quanto.is_none() { return Err(format!("is_quanto missing for {}", msg.symbol)); }
    Ok(())
}

Type guard

fn has_quanto(f: &Option<bool>) -> bool { f.is_some() }

Try / catch

if let Err(e) = parse_instrument(msg) {
    if e.to_string().contains("Missing is_quanto") { log::warn!("skip: {e}"); } else { return Err(e); }
}

Prevention

When it happens

Trigger: Parsing a BitMEX `instrument` websocket update where `msg.is_quanto` is None at crates/adapters/bitmex/src/websocket/messages.rs:597 — i.e. the payload omitted the `is_quanto` key or it deserialized to null.

Common situations: Partial instrument snapshots from custom relays; hand-written test JSON fixtures missing the flag; BitMEX API payload changes; a mapper that drops fields it does not recognize before the adapter sees them.

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/3dfacd3a2d3bcb27. Report an issue: GitHub.