{"record":{"id":"ec62e480f188d8f8","repo":"nautechsystems/nautilus_trader","slug":"binance-spot-account-trades-pagination-made-no-pro","errorCode":null,"errorMessage":"Binance Spot account-trades pagination made no progress","messagePattern":"Binance Spot account-trades pagination made no progress","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/execution.rs","lineNumber":1238,"sourceCode":"                    page.iter().any(|report| report_time_ms(report) > end_time)\n                });\n\n                reports.extend(page.into_iter().filter(|report| {\n                    requested_start_time\n                        .is_none_or(|start_time| report_time_ms(report) >= start_time)\n                        && requested_end_time\n                            .is_none_or(|end_time| report_time_ms(report) <= end_time)\n                        && seen_trade_ids.insert(report.trade_id)\n                }));\n\n                if page_len < ACCOUNT_TRADES_PAGE_LIMIT as usize || passed_end {\n                    break;\n                }\n\n                let next_from_id = max_trade_id\n                    .checked_add(1)\n                    .context(\"Binance Spot trade ID overflow during pagination\")?;\n                anyhow::ensure!(\n                    next_from_id > from_id,\n                    \"Binance Spot account-trades pagination made no progress\"\n                );\n                from_id = next_from_id;\n            }\n        } else if let Some(query_start_time) = requested_start_time {\n            let query_end_time = requested_end_time.unwrap_or_else(|| {\n                self.clock.get_time_ns().as_i64() / NANOSECONDS_IN_MILLISECOND as i64\n            });\n            anyhow::ensure!(\n                query_start_time <= query_end_time,\n                \"fill report start time must not exceed end time\"\n            );\n            let mut window_start = query_start_time;\n\n            loop {\n                let window_end = window_start\n                    .saturating_add(ACCOUNT_TRADES_MAX_INTERVAL_MS)","sourceCodeStart":1220,"sourceCodeEnd":1256,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/spot/execution.rs#L1220-L1256","documentation":"When paginating account trades by venue order id, the loop advances fromId = max_trade_id + 1 after each full ACCOUNT_TRADES_PAGE_LIMIT page. If the next cursor is not greater than the current from_id the loop would spin forever, so the adapter bails with this no-progress guard (spot/execution.rs:1238).","triggerScenarios":"Binance keeps returning full pages while the local filters (seen_trade_ids dedupe and the requested time window) discard every row, so max_trade_id never advances past the cursor — anomalous API behavior or a pathological window/dedupe interaction.","commonSituations":"Repeatedly running fill-report scans over the same window so every trade is already deduped; venue-side behavior changes returning unfiltered data outside the requested window; concurrent overlapping report generations.","solutions":["Re-run the fill report with a narrower time window or after new trades exist","Avoid issuing overlapping fill-report scans concurrently; keep a watermark of the last seen trade time","If it persists, capture the raw myTrades response for the fromId range and report it to the NautilusTrader maintainers"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// keep a watermark so successive fill-report scans never rescan fully-seen pages\nlet start = last_fill_scan_ts.map(|t| t + 1.nanos()); // advance strictly","typeGuard":null,"tryCatchPattern":"match generate_fill_reports(cmd).await {\n    Err(e) if e.to_string().contains(\"pagination made no progress\") => {\n        // narrow the window and retry once; if it repeats, capture raw pages and report upstream\n    }\n    other => other?,\n}","preventionTips":["Persist the last processed trade id/time and always resume from that watermark","Prefer venue_order_id-scoped fill queries when reconciling a single order","Avoid running two overlapping mass-status generations over the same window"],"tags":["binance","spot","pagination","fill-reports","infinite-loop-guard"],"backgroundTag":"pagination-stalled","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}