{"record":{"id":"f4c43887e4d5c4f2","repo":"nautechsystems/nautilus_trader","slug":"invalid-multiplier-divisor-divisor-for-bitmex-c","errorCode":null,"errorMessage":"Invalid multiplier divisor {divisor} for {bitmex_currency}","messagePattern":"Invalid multiplier divisor (.+?) for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/bitmex/src/http/parse.rs","lineNumber":570,"sourceCode":"}\n\nfn parse_instrument_multiplier(\n    definition: &BitmexInstrument,\n    settlement_currency: Currency,\n) -> anyhow::Result<Quantity> {\n    if !definition.is_quanto {\n        return Quantity::new_checked(definition.multiplier.abs(), 0).map_err(Into::into);\n    }\n\n    let raw = Decimal::try_from(definition.multiplier.abs())\n        .map_err(|e| anyhow::anyhow!(\"Invalid multiplier {}: {e}\", definition.multiplier))?;\n    let bitmex_currency = definition\n        .settl_currency\n        .as_ref()\n        .unwrap_or(&definition.quote_currency);\n    let divisor = bitmex_currency_divisor(bitmex_currency.as_str());\n    let value = raw.checked_div(divisor).ok_or_else(|| {\n        anyhow::anyhow!(\"Invalid multiplier divisor {divisor} for {bitmex_currency}\")\n    })?;\n\n    Quantity::from_decimal_dp(value, settlement_currency.precision).map_err(Into::into)\n}\n\n/// Parse a BitMEX futures spread instrument into a Nautilus `InstrumentAny`.\n///\n/// # Errors\n///\n/// Returns an error if values are out of valid range or cannot be parsed.\n///\n/// # Panics\n///\n/// Panics if the constructed instrument fails validation.\npub fn parse_crypto_futures_spread_instrument(\n    definition: &BitmexInstrument,\n    ts_init: UnixNanos,\n) -> anyhow::Result<InstrumentAny> {","sourceCodeStart":552,"sourceCodeEnd":588,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bitmex/src/http/parse.rs#L552-L588","documentation":"After converting the quanto multiplier to Decimal, parse_instrument_multiplier divides it by the currency divisor for the settlement currency (falling back to quote currency). If the division yields None (e.g. the divisor is zero because bitmex_currency_divisor returned an unknown/0 value for the currency), this error names the divisor and currency.","triggerScenarios":"Parsing a quanto instrument whose settl_currency (or quote_currency) maps to an invalid/zero divisor from bitmex_currency_divisor, making checked_div fail.","commonSituations":"A new BitMEX settlement currency not yet covered by the adapter's divisor table; a typo/unsupported currency code in the instrument definition; adapter and venue currency list out of sync.","solutions":["Check which currency produced the bad divisor and add/update its entry in bitmex_currency_divisor.","Verify settl_currency on the BitMEX instrument definition for that symbol.","Skip the unsupported symbol when loading instruments and log it.","Update the adapter to a version whose currency divisor table includes the new BitMEX currency."],"exampleFix":"// before\nlet divisor = bitmex_currency_divisor(bitmex_currency.as_str());\nlet value = raw.checked_div(divisor).ok_or_else(|| ...)?;\n// after: ensure the currency is supported before dividing\nlet divisor = bitmex_currency_divisor(bitmex_currency.as_str());\nanyhow::ensure!(!divisor.is_zero(), \"Unsupported BitMEX currency {bitmex_currency}: zero divisor\");\nlet value = raw.checked_div(divisor).ok_or_else(|| ...)?;","handlingStrategy":"validation","validationCode":"let currency = definition.settl_currency.as_ref().unwrap_or(&definition.quote_currency);\nif bitmex_currency_divisor(currency.as_str()).is_zero() {\n    log::warn!(\"unsupported BitMEX currency {currency}; skipping {}\", definition.symbol);\n    return Ok(None);\n}","typeGuard":null,"tryCatchPattern":"match parse_futures_instrument(&definition, ...) {\n    Ok(inst) => Some(inst),\n    Err(e) if e.to_string().contains(\"divisor\") => {\n        log::warn!(\"currency divisor unsupported: {e}\"); None\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Keep the currency divisor table in sync with BitMEX's listed settlement currencies.","Skip-and-log unknown currencies instead of failing the whole instrument load.","Verify settl_currency values when onboarding new symbols."],"tags":["parsing","instrument","currency","division","bitmex"],"backgroundTag":"invalid-argument-value","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"}