{"record":{"id":"cbfbe0a6c373cc32","repo":"nautechsystems/nautilus_trader","slug":"skipping-non-trade-execution","errorCode":null,"errorMessage":"Skipping non-trade execution: {:?}","messagePattern":"Skipping non-trade execution: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/adapters/bitmex/src/http/parse.rs","lineNumber":1089,"sourceCode":"/// # Errors\n///\n/// Currently this function does not return errors as all fields are handled gracefully,\n/// but returns `Result` for future error handling compatibility.\n///\n/// Parse a BitMEX execution into a Nautilus `FillReport` using instrument scaling.\n///\n/// # Errors\n///\n/// Returns an error when the execution does not represent a trade or lacks required identifiers.\npub fn parse_fill_report(\n    exec: &BitmexExecution,\n    instrument: &InstrumentAny,\n    ts_init: UnixNanos,\n) -> anyhow::Result<FillReport> {\n    // Skip non-trade executions (funding, settlements, etc.)\n    // Trade executions have exec_type of Trade and must have order_id\n    if !matches!(exec.exec_type, BitmexExecType::Trade) {\n        anyhow::bail!(\"Skipping non-trade execution: {:?}\", exec.exec_type);\n    }\n\n    // Additional check: skip executions without order_id (likely funding/settlement)\n    let order_id = exec.order_id.ok_or_else(|| {\n        anyhow::anyhow!(\"Skipping execution without order_id: {:?}\", exec.exec_type)\n    })?;\n\n    let account_id = bitmex_account_id(exec.account);\n    let instrument_id = instrument.id();\n    let venue_order_id = VenueOrderId::new(order_id.to_string());\n    // trd_match_id might be missing for some execution types, use exec_id as fallback\n    let trade_id = TradeId::new(\n        exec.trd_match_id\n            .or(Some(exec.exec_id))\n            .ok_or_else(|| anyhow::anyhow!(\"Fill missing both trd_match_id and exec_id\"))?\n            .to_string(),\n    );\n    // Skip executions without side (likely not trades)","sourceCodeStart":1071,"sourceCodeEnd":1107,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bitmex/src/http/parse.rs#L1071-L1107","documentation":"parse_fill_report only converts BitMEX execution records whose exec_type is Trade into FillReports. Funding, settlement, and other non-trade execution rows are rejected with this bail so they never produce synthetic fills. It signals the caller passed an execution record that is legitimately not a trade.","triggerScenarios":"request_fill_reports iterating a BitMEX /execution or /execution/tradeHistory response that contains funding or settlement entries (exec_type != Trade), or a test feeding a non-Trade execution into parse_fill_report.","commonSituations":"Downloading fill history across a funding interval so funding entries appear in the response; settlement transactions after contract expiry; wallet adjustment rows mixed into execution history.","solutions":["Filter executions on exec_type == Trade before requesting parse (the adapter's list-level parser skips these; only direct calls see the error)","If calling parse_fill_report directly, pre-check matches!(exec.exec_type, BitmexExecType::Trade) and skip non-trades","Treat this bail as an expected skip, not a failure: log and continue processing the remaining executions","If funding/settlement records are needed, use a wallet/transaction endpoint rather than the execution endpoint"],"exampleFix":"// before\nfor exec in executions {\n    fills.push(parse_fill_report(&exec, &instrument, ts_init)?);\n}\n// after\nfor exec in executions {\n    if !matches!(exec.exec_type, BitmexExecType::Trade) {\n        continue; // funding/settlement entries\n    }\n    fills.push(parse_fill_report(&exec, &instrument, ts_init)?);\n}","handlingStrategy":"validation","validationCode":"fn is_trade_exec(exec: &BitmexExecution) -> bool {\n    matches!(exec.exec_type, BitmexExecType::Trade)\n}\n// executions.iter().filter(|e| is_trade_exec(e)).map(parse_fill_report...)","typeGuard":"fn as_trade(exec: &BitmexExecution) -> Option<&BitmexExecution> {\n    matches!(exec.exec_type, BitmexExecType::Trade).then_some(exec)\n}","tryCatchPattern":"match parse_fill_report(exec, instrument, ts_init) {\n    Ok(fill) => fills.push(fill),\n    Err(e) if e.to_string().starts_with(\"Skipping non-trade execution\") => {\n        debug!(\"skipped non-trade exec {}: {:?}\", exec.exec_id, exec.exec_type);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Filter exec_type == Trade before feeding executions to the fill parser","Expect funding/settlement rows whenever requests span funding intervals","Use wallet/transaction endpoints for funding data instead of execution history","Keep a skip-count metric so silent skips of real fills are noticed"],"tags":["rust","bitmex","fills","parsing"],"backgroundTag":"unsupported-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"}