{"record":{"id":"3e1c21235e6e4dd1","repo":"nautechsystems/nautilus_trader","slug":"unrecognized-settlement-currency-settle-coin","errorCode":null,"errorMessage":"unrecognized settlement currency '{settle_coin}'","messagePattern":"unrecognized settlement currency '(.+?)'","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/bybit/src/common/parse.rs","lineNumber":1345,"sourceCode":"        .parse()\n        .with_context(|| format!(\"Failed to parse {field}='{value}' as u64 millis\"))?;\n    let nanos = millis\n        .checked_mul(NANOSECONDS_IN_MILLISECOND)\n        .context(\"millisecond timestamp overflowed when converting to nanoseconds\")?;\n    Ok(UnixNanos::from(nanos))\n}\n\nfn resolve_settlement_currency(\n    settle_coin: &str,\n    base_currency: Currency,\n    quote_currency: Currency,\n) -> anyhow::Result<Currency> {\n    if settle_coin.eq_ignore_ascii_case(base_currency.code.as_str()) {\n        Ok(base_currency)\n    } else if settle_coin.eq_ignore_ascii_case(quote_currency.code.as_str()) {\n        Ok(quote_currency)\n    } else {\n        Err(anyhow::anyhow!(\n            \"unrecognized settlement currency '{settle_coin}'\"\n        ))\n    }\n}\n\n/// Returns a currency from the internal map or creates a new crypto currency.\n///\n/// Uses [`Currency::get_or_create_crypto`] to handle unknown currency codes,\n/// which automatically registers newly listed Bybit assets.\npub fn get_currency(code: &str) -> Currency {\n    Currency::get_or_create_crypto(code)\n}\n\nfn extract_strike_from_symbol(symbol: &str) -> anyhow::Result<Price> {\n    let parts: Vec<&str> = symbol.split('-').collect();\n    let strike = parts\n        .get(2)\n        .ok_or_else(|| anyhow::anyhow!(\"invalid option symbol '{symbol}'\"))?;","sourceCodeStart":1327,"sourceCodeEnd":1363,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bybit/src/common/parse.rs#L1327-L1363","documentation":"resolve_settlement_currency maps a Bybit settleCoin to either the base or quote currency of the pair. Linear contracts settle in the quote currency and inverse contracts in the base; if settleCoin matches neither, the adapter cannot determine the settlement currency and throws this error while parsing the instrument definition.","triggerScenarios":"parse_linear_instrument or parse_inverse_instrument receives an instrument whose settleCoin (e.g. 'USDT', 'USDC', 'BTC') is case-insensitively neither the base nor quote currency of the symbol.","commonSituations":"New Bybit products (e.g. USDC-settled contracts) where settleCoin is not the traditional base/quote; symbols with unusual quote assets; stale symbol lists after delistings; unified-margin instruments not supported by the adapter version.","solutions":["Check the instrument's settleCoin in the Bybit response and confirm it is supported (base or quote of the symbol).","Filter instruments on subscribe: only request symbols whose settleCoin matches base or quote.","Upgrade the adapter if support for the new settlement currency (e.g. USDC) was added upstream.","Extend resolve_settlement_currency to map the new settle coin to a registered Currency if it is legitimate for your use case."],"exampleFix":"// before\nlet settle = resolve_settlement_currency(&settle_coin, base, quote)?;\n// after\nlet supported = [base.code.as_str(), quote.code.as_str(), \"USDT\", \"USDC\"];\nif !supported.iter().any(|c| settle_coin.eq_ignore_ascii_case(c)) {\n    anyhow::bail!(\"skipping unsupported settle coin {settle_coin}\");\n}\nlet settle = resolve_settlement_currency(&settle_coin, base, quote)?;","handlingStrategy":"validation","validationCode":"// Rust: filter instruments by supported settle coins before parsing\nlet supported = [\"USDT\", \"USDC\", base.code.as_str(), quote.code.as_str()];\nlet ok = inst.settle_coin.eq_ignore_ascii_case(base.code.as_str())\n    || inst.settle_coin.eq_ignore_ascii_case(quote.code.as_str());","typeGuard":"fn settle_supported(settle_coin: &str, base: &Currency, quote: &Currency) -> bool {\n    settle_coin.eq_ignore_ascii_case(base.code.as_str())\n        || settle_coin.eq_ignore_ascii_case(quote.code.as_str())\n}","tryCatchPattern":"match resolve_settlement_currency(&settle_coin, base, quote) {\n    Ok(c) => c,\n    Err(e) => { log::warn!(\"skipping instrument with settle coin {settle_coin}: {e:#}\"); return Ok(None); }\n};","preventionTips":["Only subscribe to instruments whose settleCoin is base or quote","Check Bybit announcements for new settlement currencies (USDC etc.)","Filter instrument lists by category+settleCoin before parsing"],"tags":["instrument","currency","bybit","derivatives"],"backgroundTag":"invalid-enum-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}