nautechsystems/nautilus_trader · error
Invalid multiplier {}: {e}
Error message
Invalid multiplier {}: {e} What it means
parse_instrument_multiplier converts a BitMEX quanto instrument's multiplier into a Nautilus Quantity. For quanto contracts it converts the f64 multiplier to Decimal; if Decimal::try_from fails (NaN, infinite, or otherwise unrepresentable), the f64 value and the conversion error are wrapped in this message.
Source
Thrown at crates/adapters/bitmex/src/http/parse.rs:563
.taker_fee(taker_fee)
.ts_event(ts_event)
.ts_init(ts_init)
.build()
.unwrap();
Ok(InstrumentAny::CryptoFuture(instrument))
}
fn parse_instrument_multiplier(
definition: &BitmexInstrument,
settlement_currency: Currency,
) -> anyhow::Result<Quantity> {
if !definition.is_quanto {
return Quantity::new_checked(definition.multiplier.abs(), 0).map_err(Into::into);
}
let raw = Decimal::try_from(definition.multiplier.abs())
.map_err(|e| anyhow::anyhow!("Invalid multiplier {}: {e}", definition.multiplier))?;
let bitmex_currency = definition
.settl_currency
.as_ref()
.unwrap_or(&definition.quote_currency);
let divisor = bitmex_currency_divisor(bitmex_currency.as_str());
let value = raw.checked_div(divisor).ok_or_else(|| {
anyhow::anyhow!("Invalid multiplier divisor {divisor} for {bitmex_currency}")
})?;
Quantity::from_decimal_dp(value, settlement_currency.precision).map_err(Into::into)
}
/// Parse a BitMEX futures spread instrument into a Nautilus `InstrumentAny`.
///
/// # Errors
///
/// Returns an error if values are out of valid range or cannot be parsed.
///View on GitHub (pinned to 18893faf8b)
Solutions
- Log the full instrument definition (symbol, multiplier, settl_currency) to identify the offending contract.
- Skip or exclude the affected symbol from the instrument load list if it is not needed.
- Check for a newer nautilus_bitmex adapter version that handles the multiplier representation.
- Report/verify against the BitMEX /instrument endpoint whether the multiplier is genuinely non-finite.
Defensive patterns
Strategy: try-catch
Validate before calling
if definition.is_quanto && !definition.multiplier.is_finite() {
log::warn!("skipping {} : non-finite multiplier", definition.symbol);
return Ok(None);
} Try / catch
match parse_perpetual_instrument(&definition, ...) {
Ok(inst) => Some(inst),
Err(e) if e.to_string().contains("Invalid multiplier") => {
log::warn!("skipping instrument: {e}"); None
}
Err(e) => return Err(e),
} Prevention
- Log the raw instrument definition on parse failure for diagnosis.
- Filter instrument loads to a known symbol list.
- Track BitMEX new-listing announcements and test parsing against them.
When it happens
Trigger: Parsing a perpetual or futures instrument definition whose is_quanto is true and whose multiplier is NaN, infinite, or cannot be represented as a fixed-point Decimal.
Common situations: BitMEX listing a new/odd contract with an anomalous multiplier field; corrupted or partially-updated instrument definition responses; float serialization changes from the venue API.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Invalid multiplier divisor {divisor} for {bitmex_currency}
- invalid {field} `{raw}`
- Order missing order_qty and cannot reconstruct (order_id={},
- Skipping non-trade execution: {:?}
- Skipping execution without side: {:?}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/4ee865a7d7f33139.
Report an issue: GitHub.