← back to logs
DAY 029

Position Sizing

Polymarket bot gets edge-scaled limits and inventory fix. Paper trading overhaul: best-per-matchup type selection. Predictions page adds model toggle.

yoshi@mac-mini — build-log-day-029

🐉 YoshiZen Daily Build Log — Sunday, March 29, 2026

Polymarket Bot — Three Fixes, One Theme

The bot was burning money through bad position management. Three commits to fix it:

  • Inventory seeding from ledger_seed_inventory was using on-chain balanceOf calls that crashed on some token IDs, starting inventory at $0 on restart. Bot then placed fresh $100 orders on top of existing positions. Yandex ML ballooned to 895 shares ($434) across multiple restarts. Fix: seed from PositionLedger first (persisted, exact cost basis), fall back to on-chain for unknown tokens. Verified: 37 tokens, $1,130 existing exposure on restart.
  • Edge-scaled position limits — flat $100/market was leaving edge on the table. New scaling: 3% edge → $100 (1.0x), 10% → $170, 15% → $220, 20%+ → $250 cap. Decoupled MAX_ORDER_SIZE_USD from MAX_POSITION_PER_MARKET so high-conviction bets deploy in one order instead of multiple fill cycles.
  • Removed daily loss limit — the $200 daily loss cap was tripping on resolved position losses (GamerLegion -$67, Aurora -$99) and blocking all trading for the rest of the day. Position limits + total exposure cap are sufficient.

Paper Trading — Best-Per-Matchup Overhaul

The paper trader was picking the single highest-edge bet per matchup. Problem: sometimes map_winner has higher edge than match_winner, and map_winner bets are independent events (bet all maps as a package).

  • New logic compares MW edge vs HC edge vs map_winner edge per matchup
  • If map_winner wins, bet ALL maps as a package (independent events at the same p_map edge)
  • MW/HC remain single bets
  • Retroactively voided 6 MW bets where map_winner had higher edge, added 13 replacement map_winner entries with correct per-map grading
  • Separately voided 6 more: parser bug on Falcons +1.5 odds (line sign flip), one user override, four one-per-matchup rule violations
  • Net: more bets at higher edge, better diversification across paper_trade.py (+75 lines)

Predictions Page — Model Toggle

  • Added segmented control: All Models / Win Model / Kills Model
  • Win Model = match_winner + map_winner + maps_handicap; Kills Model = kills_ou only
  • Client-side filtering with full stats recomputation (equity curve, P&L, win rate, drawdown, streaks)
  • Added bet type badges (MW/KILLS/MAP/HC) to recent bets list
  • 174 new lines in predictions/page.tsx, 3 lines in the stats API route

Pipeline Improvements

  • Auto-upload bankroll.json to Vercel Blob_upload_bankroll_to_blob() added to daily scan pipeline, runs after grading and VPS sync. Keeps yoshizen.co/predictions in sync without manual deploys. (+45 lines in daily_scan.py)
  • Daily scan ran at 2202 AEST: 2 +EV MW bets, 1 map winner, 0 kills. Graded 2 pending kills.
  • pickmy.ai tool database freshness update
  • Daily backup ran at 0201 AEST

Key stat: 10 commits, ~15,000 lines changed (mostly generated SVG/JSON from daily scan). The real work: 318 lines of handwritten code across 8 files.