Commit Graph

483 Commits

Author SHA1 Message Date
copybot[bot] 3b6ab663e8 copybot: live paper feed [skip ci] 2026-07-07 15:40:58 +00:00
jaxperro 5a7434c374 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>
2026-07-07 11:40:15 -04:00
copybot[bot] a62cbf0985 copybot: live paper feed [skip ci] 2026-07-07 15:34:50 +00:00
jaxperro 972b32e8f0 CRITICAL: fix their_prev crash that silently killed all new opens since 07-05
_handle_their_buy referenced their_prev in the fresh-OPEN branch but only
assigned it in the is_add branch — every new position crashed with
UnboundLocalError the moment the their-bet ceiling landed 2026-07-06. The
webhook/heartbeat try/except swallowed it as 'handler error', so the bot
logged FOLLOW then silently placed NOTHING (last real fill 07-05 23:17;
live Fly logs show FOLLOW ArbTrader ... -> heartbeat error: their_prev).
This is the primary cause of 'live bot missing bets'. Fix: hoist their_prev
above the if/else so both branches see the signal's prior position.

Also (the user's two asks):
- copybot on_wallet_activity: a QUALIFYING bet we were too slow to catch
  (webhook missed / bot down / fast market resolved before we polled) is now
  recorded as a missed bet 'too slow to follow (Nm late)' instead of silently
  dropped; below-floor dust stays console-only. Filter runs before the stale
  gate so we know if it would have qualified.
- sync_floors.py rewritten: PIN each paper-bot wallet's floor to the trusted
  cache p80 (identical to the backtest's conv_thr), written to
  copybot.paper.json, wired into daily.sh + committed. Kills the boot-time
  data-api floor drift (fortuneking $1,498 boot vs $892 backtest) that made
  the live bot filter out bets the backtest kept.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:33:36 -04:00
copybot[bot] c002c45e5b copybot: live paper feed [skip ci] 2026-07-07 15:06:01 +00:00
jaxperro b6cb2e53b2 SECURITY: drop leaked alchemy_key from config.live.example.json
The key does not belong in any committed file — the worker reads the RPC
from ALCHEMY_RPC_URL env (or the gitignored config.json locally). Rotating
the key is the real fix (it hit the public repo history); this removes it
from HEAD.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:02:14 -04:00
jaxperro 686c1cfcce config.live.example.json: committed secret-free live-test config (Phase 1.7)
config.live.json is gitignored (holds the key) so the Fly worker can't see
it. This committed twin carries the synced 8-wallet follow set + $5 test
caps + separate feed/fills; the worker reads it and injects the key via
LIVE_PRIVATE_KEY env (copybot 1.2). Mac path: cp to config.live.json, fill
the key. Fixes 'stale shisan888 follow set' + the cloud-config gap.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:01:27 -04:00
jaxperro 0e95ab1bf3 live-rollout Phase 1 (partial) + discord ping post-wake retry
copybot.py:
- 1.1 feed_path/fill_log are config-driven (live run won't clobber the
  paper book's feed or fills ledger)
- 1.2 LIVE_PRIVATE_KEY / LIVE_FUNDER_ADDRESS / LIVE_SIGNATURE_TYPE env
  overrides (Fly worker has no gitignored config.live.json)
- 1.4 chain_cash_gap(): live-only book-cash vs CLOB USDC balance, logged
  as ⚠ CASH≠CHAIN (the real-money ledger_drift)
- 1.5 geo-gate is FATAL in live mode — unauth order probe; refuses to arm
  from a 403-geo-blocked box before the confirm phrase (verified: refuses
  from this US Mac)
- 1.6 mirror-exit retry: FAK sells that fill 0 on thin books retry each
  backstop poll, ⚠ EXIT STUCK alert after 10 unfilled attempts

discord_daily.py: --ping retries 4x (5/10/15s) — launchd wakes the Mac to
run daily.sh and the heads-up ping was racing DNS/WiFi coming up after
sleep (getaddrinfo 'nodename nor servname'); the end-of-run digest always
landed, only the start ping lost the race.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 10:59:07 -04:00
copybot[bot] 1608b5b06a copybot: live paper feed [skip ci] 2026-07-07 14:20:18 +00:00
copybot[bot] 0c32bbacfd copybot: live paper feed [skip ci] 2026-07-07 14:18:13 +00:00
copybot[bot] 8a8d48fc46 copybot: live paper feed [skip ci] 2026-07-07 14:14:10 +00:00
copybot[bot] de84e94895 copybot: live paper feed [skip ci] 2026-07-07 13:53:52 +00:00
copybot[bot] ad33f0724a copybot: live paper feed [skip ci] 2026-07-07 13:21:28 +00:00
copybot[bot] f31620f729 copybot: live paper feed [skip ci] 2026-07-07 11:59:22 +00:00
jaxperro 6e7de2c298 README: point the go-real-money row at LIVE_ROLLOUT.md
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 07:34:22 -04:00
jaxperro 39bd173e05 LIVE_ROLLOUT.md: phased real-money integration plan, executable by a fresh session
Phase 0 invariants (geo, single-writer, chain truth, ledger, caps) ->
Phase 1 code prep (feed separation, env secrets, worker deps, on-chain
cash anchor, fatal geocheck, exit retries, config sync, dashboard section)
-> funding (user-only) -> preflight/dry-run -> supervised first fill ->
full edge-case matrix (buy/add/sell/win/loss/refund/missed/downtime/
FAK-no-fill/neg-risk/withdraw) -> wind-down + graduation gate.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 07:34:04 -04:00
jaxperro fb462b7168 exits: fix the 50-row page cap + incremental exits cache in duckdb
/closed-positions serves 50-row pages regardless of limit; stepping by the
requested size truncated every wallet's exit history to its most recent ~50
closes (1% coverage for hyperactive wallets) — sold-mirroring was silently
falling back to the hold-to-res ceiling almost everywhere. Now: page by
returned size, cache exits incrementally in duckdb (immutable events —
deep backfill once, a page or two per refresh; title/outcome columns for
display). Deep-exit 30d replay: $18,270 (+1727%), 259W/79L/29R/284S,
misses 253 -> 1 (mirrored exits recycle capital as fast as the signal does).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 07:27:30 -04:00
copybot[bot] 31a3252c4c copybot: live paper feed [skip ci] 2026-07-07 09:11:09 +00:00
copybot[bot] 1cc7cdf0d9 copybot: live paper feed [skip ci] 2026-07-07 08:05:11 +00:00
jaxperro c5c5c50b8d feeds: sold-aware sharps refresh (exit-mirrored records)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 03:38:51 -04:00
jaxperro 72245e4053 sharps stats mirror exits too (SOLD) — one exit model across all three books
smart_money.closed_exits() is now the shared implementation (backtest +
sharps): close time from /closed-positions, exit price reconstructed from
realized P&L. validate_timing's conv/conv30/all-time/realized tallies count
a bet the wallet sold pre-resolution at its exit price (conv_sold /
conv30_sold / all_sold fields) instead of pretending it rode to resolution.
Beyond the ~4000-row data horizon exits fall back to hold-to-res.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 03:18:41 -04:00
jaxperro 44a08cdc0d backtest: exits mirror the signal (SOLD status) — same model as the live bot
The replay held everything to resolution while the live bot mirrors exits —
two different strategies wearing one dashboard. Now, when a followed wallet
fully closed a position pre-resolution, the replay sells there too: close
time from /closed-positions, exit price reconstructed as
avgPrice + realizedPnl/totalBought, exit taker fee + slippage haircut paid.
Complete in-window round trips on unresolved markets (entered AND exited —
previously invisible to the replay) are included; on-chain-resolved conds
are excluded from round-trip synthesis so redeems can't masquerade as
sells. Sold legs count apart from W/L/R (they're price events, not
outcomes): 30d now 226W/55L/84R/31S, $12,730 (+1173%) — mirrored exits
bank the wallets' early profit-taking that hold-to-resolution left behind.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 03:09:21 -04:00
jaxperro 3674d2f099 whales demoted to volume class everywhere + status vocabulary in the backtest feed
- all three whales -> volume (conviction-only, 4%/bet); truth-scored 30d
  replay IMPROVES $2.5k -> $10.5k (+946%, 230W/54L/88R): follow-all at 12%
  was burning bankroll on low-conviction in-play scraps. Demoted wallets get
  floors PINNED from trusted cache p80 (Stavenson $4,760 / 0x4bFb $1,090 /
  ArbTrader $168) — their dust-heavy recent books auto-derive uselessly low.
- portfolio feed rows now carry status won/lost/refund (missed too),
  mirroring the live bot; no 'sold' by design (hold-to-resolution replay
  never exits early). Dashboard renders refunds amber with W/L/R counts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 02:59:13 -04:00
copybot[bot] 7db6524055 copybot: live paper feed [skip ci] 2026-07-07 06:58:22 +00:00
jaxperro d0d0582c03 copybot: follow-set update (deploy_bot.sh) 2026-07-07 02:58:10 -04:00
copybot[bot] b432167c80 copybot: live paper feed [skip ci] 2026-07-07 06:57:04 +00:00
jaxperro fa9591c379 copybot: follow-set update (deploy_bot.sh) 2026-07-07 02:56:49 -04:00
jaxperro 0de033398a feeds: first truth-scored refresh + refunds counted apart in the replay
The honest 30d backtest: $1k -> $2,538 (+154%), 78W/18L/112R — not the
refund-inflated +8,627%. Sharp list: 33 copy-positive holders under truth
gates; 0x4bFb-whale and ArbTrader no longer qualify (their conviction
records were carried by 50/50 refunds counted as wins). portfolio.py now
reports refunds as R, not L (a scratch is not a loss).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 02:50:46 -04:00
copybot[bot] d84945fc4a copybot: live paper feed [skip ci] 2026-07-07 06:16:20 +00:00
copybot[bot] 0972dfeafb copybot: live paper feed [skip ci] 2026-07-07 06:14:19 +00:00
jaxperro 327513d185 copybot: reconcile_entries — downtime entries become missed bets, not silence
The backtest reads positions (state); the bot reads trades (events). A trade
during downtime was silently baselined away at the next boot — not copied,
not missed, invisible — while the backtest still showed it (2026-07-07:
9 ArbTrader positions opened into the Fly trial-expiry crash-loop appeared
only in portfolio.json's current list). Now every boot + backstop poll
records any unseeded, unheld, unrecorded position that clears the follow
filter as a missed bet (reason 'bot offline'), settled hypothetically like
every other miss. Never copied — the entry is stale by definition. Dust
below risk.min_order_usd is ignored; API failure skips (silence is never
data). Bets that open AND close entirely within downtime stay the
backtest's domain.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 02:10:21 -04:00
jaxperro 4941818d51 scoring: chain-truth resolutions overlay — refunds no longer count as wins
The cache's won (curPrice>=0.5 at pull) counts 50/50 refunds as wins for
BOTH sides — 521 of 2,128 chain-checked follow-set markets (24%) were
refunds, which is where the whales' 92-100% displayed win rates came from.

- live/payouts.py: resolutions table in cache.duckdb, filled from the CTF
  contract's payout vectors (batched+paced JSON-RPC, ~12 calls/s free tier;
  resolved rows immutable, unresolved recheck 6h, RPC failures never cached).
  truth(cond, asset) -> 1/0/0.5/None; refunds need no asset side.
- validate_timing: every displayed stat (conv/conv30/all-time/realized/copy
  replay) settles at truth; refunds count as neither W nor L, P&L is
  size*(wp-p)/p; new conv_ref/conv30_ref/all_ref feed fields.
- trust.conviction_record: optional truthfn — the selection gates
  (trust_wr/trust_roi) no longer select on refund inflation.
- portfolio.py: replay pays wp (refunds 0.5/share, was 1.0).
- conviction_scan: documented as the (refund-inflated) candidate layer;
  final selection re-judges against truth downstream.

Validation: 0x4bFb-whale conv 174-16 91.6% $1.61M -> 34-16 +140ref 68%
$214k, and truth-adjusted all-time P&L now sits within ~16% of lb-api's
PM P&L (was 7x apart); LSB1 (0 refunds) byte-identical, its P&L matches
PM P&L to 0.07%.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 01:55:50 -04:00
copybot[bot] 23c6c44057 copybot: live paper feed [skip ci] 2026-07-07 01:20:46 +00:00
copybot[bot] 45a52433f3 copybot: live paper feed [skip ci] 2026-07-07 01:03:03 +00:00
copybot[bot] a9bbf334c4 copybot: live paper feed [skip ci] 2026-07-07 00:47:56 +00:00
copybot[bot] ea5a4d535d copybot: live paper feed [skip ci] 2026-07-07 00:42:26 +00:00
copybot[bot] 3c86019e9a copybot: live paper feed [skip ci] 2026-07-07 00:31:15 +00:00
copybot[bot] 56fc08cace copybot: live paper feed [skip ci] 2026-07-07 00:24:57 +00:00
copybot[bot] f1142ba184 copybot: live paper feed [skip ci] 2026-07-07 00:10:33 +00:00
copybot[bot] fef30218c1 copybot: live paper feed [skip ci] 2026-07-07 00:05:23 +00:00
copybot[bot] e8b4d31452 copybot: live paper feed [skip ci] 2026-07-06 23:46:43 +00:00
copybot[bot] a96c178400 copybot: live paper feed [skip ci] 2026-07-06 23:36:53 +00:00
copybot[bot] 0b539083c3 copybot: live paper feed [skip ci] 2026-07-06 23:25:16 +00:00
copybot[bot] 15e91aac0f copybot: live paper feed [skip ci] 2026-07-06 22:59:15 +00:00
copybot[bot] 10680a27bb copybot: live paper feed [skip ci] 2026-07-06 22:27:32 +00:00
copybot[bot] 61720467fc copybot: live paper feed [skip ci] 2026-07-06 22:20:09 +00:00
copybot[bot] e5bf65cbbf copybot: live paper feed [skip ci] 2026-07-06 22:12:31 +00:00
jaxperro c2e702ba97 copybot: record the Jul-5 accounting-migration residue as an audited ledger adjustment (+15.45) — ledger_drift is 0 from here
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 18:12:20 -04:00
copybot[bot] 0a29b061a5 copybot: live paper feed [skip ci] 2026-07-06 22:09:41 +00:00
copybot[bot] ba95ea04b2 copybot: live paper feed [skip ci] 2026-07-06 22:07:32 +00:00