{"record":{"id":"adc1f2f34364e675","repo":"nautechsystems/nautilus_trader","slug":"list-time-is-required-for","errorCode":null,"errorMessage":"`list_time` is required for {}","messagePattern":"`list_time` is required for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/okx/src/common/parse.rs","lineNumber":1664,"sourceCode":"    }\n\n    if definition.lot_sz.is_empty() {\n        anyhow::bail!(\"`lot_sz` is empty for {}\", definition.sprd_id);\n    }\n\n    let context = format!(\"SPREAD instrument {}\", definition.sprd_id);\n    let instrument_id = parse_instrument_id(definition.sprd_id);\n    let raw_symbol = Symbol::from_ustr_unchecked(definition.sprd_id);\n    let underlying =\n        Currency::get_or_create_crypto_with_context(definition.base_ccy, Some(&context));\n    let quote_currency =\n        Currency::get_or_create_crypto_with_context(definition.quote_ccy, Some(&context));\n    let settlement_currency = spread_settlement_currency(definition, underlying, quote_currency);\n    let is_inverse = matches!(definition.sprd_type, OKXSpreadType::Inverse);\n    let activation_ns = definition\n        .list_time\n        .map(parse_millisecond_timestamp)\n        .ok_or_else(|| anyhow::anyhow!(\"`list_time` is required for {}\", definition.sprd_id))?;\n    let expiration_ns = definition\n        .exp_time\n        .map(parse_millisecond_timestamp)\n        .unwrap_or_default();\n    let ts_event = definition\n        .u_time\n        .map_or(ts_init, parse_millisecond_timestamp);\n\n    let price_increment = Price::from_str(&definition.tick_sz).map_err(|e| {\n        anyhow::anyhow!(\n            \"Failed to parse `tick_sz` '{}' for {}: {e}\",\n            definition.tick_sz,\n            definition.sprd_id\n        )\n    })?;\n    let size_increment = Quantity::from_str(&definition.lot_sz).map_err(|e| {\n        anyhow::anyhow!(\n            \"Failed to parse `lot_sz` '{}' for {}: {e}\",","sourceCodeStart":1646,"sourceCodeEnd":1682,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/okx/src/common/parse.rs#L1646-L1682","documentation":"parse_spread_instrument requires OKX spread definitions to carry a list_time (millisecond timestamp) to build the instrument activation time. If list_time is absent (None) the error '`list_time` is required for {sprd_id}' is raised.","triggerScenarios":"Calling parse_spread_instrument (via request_spread_instruments or request_spread_instrument) with a spread definition JSON that omits the list_time field.","commonSituations":"Manually constructed or trimmed fixtures missing list_time; newer OKX spread listings that don't populate list_time; caching definitions stripped of null/optional fields.","solutions":["Re-fetch the spread instrument definition from the OKX /sprd/instruments endpoint ensuring list_time is present","Supply list_time (ms epoch) explicitly when constructing definitions from cached/manual data","Check OKX API for changed availability of list_time for the spread type","If list_time is genuinely optional upstream, relax to unwrap_or_default like exp_time"],"exampleFix":"// before\nlet activation_ns = definition\n    .list_time\n    .map(parse_millisecond_timestamp)\n    .ok_or_else(|| anyhow::anyhow!(\"`list_time` is required for {}\", definition.sprd_id))?;\n// after\nlet activation_ns = definition\n    .list_time\n    .map_or(0, parse_millisecond_timestamp);","handlingStrategy":"validation","validationCode":"fn spread_def_parsable(def: &OKXSpreadInstrument) -> bool {\n    def.list_time.is_some() && !def.tick_sz.is_empty() && !def.lot_sz.is_empty()\n}","typeGuard":null,"tryCatchPattern":"match parse_spread_instrument(&definition, ts_init) {\n    Ok(inst) => inst,\n    Err(e) => { tracing::warn!(\"skipping spread {} def: {e:#}\", definition.sprd_id); return Ok(None); }\n}","preventionTips":["Never strip null/optional fields when caching definitions","Validate required fields (list_time, tick_sz, lot_sz) at cache-write time","Keep fixture JSON complete when writing tests"],"tags":["rust","okx","spread","missing-field"],"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-14T05:17:10.506Z"}