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>
- Monthly + hourly Kalshi/Polymarket arb scanner (stdlib-only Python).
- Live positions tab w/ realized P&L history.
- GitHub Actions cron workflow texts SMS via Apps Script webhook on
newly-detected arbs. State persisted in alerts_state.json.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>