{"record":{"id":"a75e81c99d970c6f","repo":"nautechsystems/nautilus_trader","slug":"missing-option-type-for-option-instrument","errorCode":null,"errorMessage":"Missing option_type for option instrument","messagePattern":"Missing option_type for option instrument","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/deribit/src/common/parse.rs","lineNumber":380,"sourceCode":"    let instrument_id = InstrumentId::new(Symbol::new(instrument.instrument_name), *DERIBIT_VENUE);\n    let underlying = Currency::get_or_create_crypto(instrument.base_currency);\n    let quote_currency = Currency::get_or_create_crypto(instrument.quote_currency);\n    let settlement = instrument\n        .settlement_currency\n        .unwrap_or(instrument.base_currency);\n    let settlement_currency = Currency::get_or_create_crypto(settlement);\n\n    // Determine if inverse (settled in base currency) or linear (settled in quote/USDC)\n    let is_inverse = instrument\n        .instrument_type\n        .as_ref()\n        .is_some_and(|t| t == \"reversed\");\n\n    // Determine option kind\n    let option_kind = match instrument.option_type {\n        Some(DeribitOptionType::Call) => OptionKind::Call,\n        Some(DeribitOptionType::Put) => OptionKind::Put,\n        None => anyhow::bail!(\"Missing option_type for option instrument\"),\n    };\n\n    // Parse strike price\n    let strike = instrument.strike.context(\"Missing strike for option\")?;\n    let strike_price = Price::from_decimal(strike)?;\n\n    // Convert timestamps from milliseconds to nanoseconds\n    let activation_ns = (instrument.creation_timestamp as u64) * 1_000_000;\n    let expiration_ns = instrument\n        .expiration_timestamp\n        .context(\"Missing expiration_timestamp for option\")? as u64\n        * 1_000_000;\n\n    let price_increment = Price::from_decimal(instrument.tick_size)?;\n\n    let multiplier = deribit_amount_quantity_multiplier();\n    let lot_size = Quantity::from_decimal(instrument.min_trade_amount)?;\n    let min_trade_amount = Quantity::from_decimal(instrument.min_trade_amount)?;","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/deribit/src/common/parse.rs#L362-L398","documentation":"When parsing a Deribit option instrument, the option_type field (Call/Put) must be present to construct an OptionKind. If Deribit returns the instrument without option_type populated, parsing cannot proceed and it errors.","triggerScenarios":"parse_option_instrument receives a DeribitInstrument with option_type == None — e.g. an incomplete or malformed instrument payload from the Deribit API.","commonSituations":"Deribit API schema changes or partial responses, future-type instruments accidentally routed to the option parser, caching stale instrument definitions.","solutions":["Check the instrument is an option (kind field) before calling the option parser","Update the Deribit API client/model if option_type serialization changed","Log and skip instruments missing option_type instead of failing the whole parse"],"exampleFix":"// before\nNone => anyhow::bail!(\"Missing option_type for option instrument\"),\n// after\nNone => {\n    log::warn!(\"Skipping {} with missing option_type\", instrument.instrument_name);\n    return Ok(None);\n}","handlingStrategy":"type-guard","validationCode":"assert!(instrument.option_type.is_some(), \"instrument {} lacks option_type\", instrument.instrument_name);","typeGuard":"fn is_parseable_option(i: &DeribitInstrument) -> bool {\n    i.option_type.is_some() && i.strike.is_some()\n}","tryCatchPattern":"match parse_deribit_instrument_any(&payload) {\n    Err(e) if e.to_string().contains(\"Missing option_type\") => {\n        warn!(\"skipping malformed instrument\");\n    }\n    other => other?,\n}","preventionTips":["Verify instrument kind before routing to the option parser","Pin/update Deribit client models when the API schema changes","Log and skip malformed instruments rather than aborting the batch"],"tags":["deribit","instrument","options","parsing"],"backgroundTag":"missing-required-argument","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"}