P&L mirrors PM: All-Time/Conv P&L = realized track record (realizedPnl)

The sharps table's P&L was reconstructed from won×entry×size and diverged
from PM /profit by up to 10x, with sign flips — four root causes found by
decomposing outliers against PM:
  1. bets pull capped at 2000 rows/180d -> high-volume wallets truncated
     (ewww1: 740 of 4088 positions cached -> k shown vs k real)
  2. both-sides (hedged) markets: one-per-market dedup dropped the paired
     side (suraxy: -k of dropped losing legs -> overcount)
  3. initialValue=0 on big longshot winners -> mis-sized reconstruction
  4. corrupt near-epoch res_t rows polluting sums

Fix: All-Time/Conv/30d P&L are now the sum of Polymarket's OWN realizedPnl
per closed position over FULL history (cache.closed_exits, extended to store
realized_pnl; smart_money.closed_exits captures it + relaxes the avg/tb
guard). This is the wallet's realized track record — what a copier mirroring
buy/sell/hold banks — and sums to PM. Immune to all four bugs (each asset is
its own realized row; no size/entry/res_t needed). Win% = share of closed
positions that made money. Verified vs PM: ewww1 1.00x, KBO30 0.0x->0.97x,
suraxy 2.7x->1.03x, sign flip fixed; oliman2 1.63x is correct-by-design
(realized track record vs PM's open-book unrealized marks). README gotcha 11
rewritten; dashboard tooltips reframed off the copy-ceiling language.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jaxperro
2026-07-07 20:28:08 -04:00
parent c90c501eb3
commit 2395024a8f
4 changed files with 90 additions and 78 deletions
+15 -11
View File
@@ -290,17 +290,21 @@ runner is retired (GitHub throttled `*/5` to ~2h in practice — it copied 1 of
location doesn't relocate *you* (trade live from Colombia months, paper
from US months).
11. **Hold-to-resolution P&L is a copy ceiling, not the wallet's bank
statement.** The dashboard's Conv/All-Time P&L columns price every entry
held to resolution at the wallet's own stakes — the right yardstick for a
copier that holds, and the wrong one for judging the wallet itself.
Polymarket's own profile P&L (lb-api `/profit`, the **PM P&L** column) is
their actual cash-flow result. ~1× gap = true holder (LSB1 +$69.7k vs
+$68.5k); a huge gap = scalper whose entries resolve well but who never
holds (ArbTraderRookie: **+$8.6k real vs +$462k held, 53×** — a 0.5%
margin on $1.7M volume). For scalpers, whether a copier can reproduce
their fills is the open question — judge by the live book's measured
slippage, never the ceiling.
11. **All-Time / Conv P&L is the wallet's REALIZED track record** — the sum of
Polymarket's own `realizedPnl` per closed position over the wallet's full
history (`cache.closed_exits`, the incremental `/closed-positions` cache).
It's what a copier mirroring their buy/sell/hold actually banks, and it
equals the profile's **PM P&L** except for unrealized marks on positions
still open. This *replaced* the old hold-to-resolution reconstruction
(`won × entry × size`), which diverged from PM by up to 10× and even
flipped signs — four bugs: a 2,000-row pull cap (fixed: full history),
both-sides positions double-dropped by one-per-market dedup (fixed: each
asset is its own realized row), `initialValue = 0` mis-sizing (moot —
realized P&L needs no size), and corrupt near-epoch `res_t` (moot —
realized cash is timestamp-independent). Win % is now the share of closed
positions that *made money*, the mirror lens. (For wallets holding a large
losing open book, realized > PM because PM marks the open losers in;
that gap is unrealized, not an error.)
---