cache: invalidate() clears pulled_entries too — stale entries dropped fresh bets from the backtest
The daily freshen reset the bets + exits cursors but never pulled_entries, so a watchlist wallet's first_buy map went up to 14 days stale and portfolio.py silently dropped every bet on conds entered since the last pull (`if not et: continue`) — neither resolved nor open. Kruto2027's Jul-7 Brewers bets (visible SOLD in the live bot) and two losing bets were absent from the backtest for exactly this. Entries re-pulled for Set D + portfolio regenerated: Kruto 43->49 bets, both Brewers rows booked, hidden losses folded in. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+8
-2
@@ -259,11 +259,17 @@ def closed_exits(wallet, max_age_s=6 * 3600):
|
||||
|
||||
|
||||
def invalidate(wallets):
|
||||
"""Force a re-pull of these wallets on next get_bets (for daily watchlist
|
||||
forward-refresh)."""
|
||||
"""Force a re-pull of these wallets on next get_bets/get_entries (for daily
|
||||
watchlist forward-refresh). pulled_entries MUST be cleared too: a stale
|
||||
entries snapshot has no first_buy for conds entered since the last pull, and
|
||||
portfolio.py drops those bets entirely (`if not et: continue`) — Kruto's
|
||||
Jul-7 Brewers bets vanished from the backtest for exactly this while its
|
||||
bets/exits cursors were fresh (found 2026-07-08). Exits have their own
|
||||
incremental cursor and don't go stale this way."""
|
||||
with _lock:
|
||||
for w in wallets:
|
||||
_con.execute("DELETE FROM pulled WHERE wallet=?", [w])
|
||||
_con.execute("DELETE FROM pulled_entries WHERE wallet=?", [w])
|
||||
|
||||
|
||||
def query(sql, params=None):
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user