mirror of
https://github.com/cjudice-commits/prediction-market-arb.git
synced 2026-07-28 22:17:45 +00:00
ba533980e4
Kalshi /portfolio/settlements only lists matured-and-held markets. Anything the user bought and sold before expiry was invisible. Added a follow-up query on /portfolio/positions?count_filter=total_traded filtered to position_fp=0 — captures every round-trip. realized comes straight from Kalshi's realized_pnl_dollars (exact). Polymarket history was skipping any conditionId where the CLOB still reports closed=false. But if the user sold all their shares before the market resolves, that's still a history row with realized = sell - buy. Result tag is 'SOLD' to distinguish from resolved-and-won/-lost rows. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>