closed_exits: cap first-backfill depth 25k->4k rows (bounded daily runtime)
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 <noreply@anthropic.com>
This commit is contained in:
+8
-2
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user