From 5a7434c37456ea6cd686cade6504f20397cfda78 Mon Sep 17 00:00:00 2001 From: jaxperro Date: Tue, 7 Jul 2026 11:40:14 -0400 Subject: [PATCH] closed_exits: cap first-backfill depth 25k->4k rows (bounded daily runtime) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 25k-row (500-page) full-history backfill × 90 sharp wallets stalled the daily pipeline for 4+ hours on its first uncached pass. 4000 rows (80 pages) covers the 30d backtest and most of the 180d display window; the exits cache is incremental so the horizon extends on later runs. Extreme scalpers keep a hold-to-res ceiling on their deepest history (honest, and none are followed). Co-Authored-By: Claude Fable 5 --- smart_money.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/smart_money.py b/smart_money.py index beba1bd8..6035e627 100644 --- a/smart_money.py +++ b/smart_money.py @@ -107,7 +107,7 @@ def leaderboard_candidates(pool): return ranked[:pool] -def closed_exits(wallet, since_ts=0, max_rows=25000, newest_bound=0): +def closed_exits(wallet, since_ts=0, max_rows=4000, newest_bound=0): """{asset: {ts, exit_p, p, iv, cond, title, outcome}} for the wallet's FULLY-CLOSED positions, newest first. `ts` is the close (sell/redeem) timestamp; the exit price is reconstructed from realized P&L over shares @@ -121,7 +121,13 @@ def closed_exits(wallet, since_ts=0, max_rows=25000, newest_bound=0): hold-to-res ceiling back into a scalper's stats). Stops at since_ts, newest_bound (for incremental refresh: rows older than what's already cached), max_rows, or an empty page. Prefer cache.closed_exits — the - incremental cached layer over this raw fetcher.""" + incremental cached layer over this raw fetcher. + + max_rows default 4000 (80 pages) bounds the FIRST backfill: full-history + depth (25k) × 90 sharp wallets stalled the daily pipeline for hours. 4000 + covers the 30d backtest and most of the 180d display window; the cache is + incremental so the horizon extends naturally on later runs, and an extreme + scalper's deepest history just keeps a hold-to-res ceiling (honest).""" out = {} off = 0 while off < max_rows: