{"skill":{"slug":"polymarket-negrisk-arb","displayName":"Polymarket NegRisk Arbitrage","summary":"Scan multi-outcome Polymarket markets for mathematical arbitrage. When the sum of all outcome prices falls below $1.00, buy all sides simultaneously via batc...","description":"---\nname: polymarket-negrisk-arb\ndescription: Scan multi-outcome Polymarket markets for mathematical arbitrage. When the sum of all outcome prices falls below $1.00, buy all sides simultaneously via batch trade to lock in risk-free profit. No signals. No AI. Just math.\nmetadata:\n  author: \"r2creatorstudios\"\n  version: \"1.0.2\"\n  displayName: \"Polymarket NegRisk Arbitrage\"\n  difficulty: \"intermediate\"\n---\n\n# Polymarket NegRisk Arbitrage Trader\n\n> **This is a template.** The default signal is NegRisk price sum deviation from $1.00 —\n> remix it with tighter thresholds, different min-profit floors, or additional liquidity filters.\n> The skill handles all the plumbing (market discovery, grouping, batch execution, safeguards).\n> Your agent provides the edge by tuning when and how aggressively to enter.\n\nScan multi-outcome markets for mathematical arbitrage opportunities. When the sum of all outcome prices deviates from $1.00, buy the mispriced side across all buckets simultaneously using Simmer's batch trade endpoint.\n\nNo signals. No AI. Just math.\n\n## Strategy\n\nPolymarket NegRisk markets have multiple mutually exclusive outcomes (e.g., election candidates, tweet count ranges). Exactly one outcome resolves YES = $1.00.\n\n**The Math:**\n\nIn an efficient market:\n```\nsum(all YES prices) = $1.00\nsum(all NO prices) = $1.00\n```\n\nWhen markets are inefficient:\n```\nsum(YES) < $0.95 → Buy ALL YES → guaranteed $1.00 payout, cost < $0.95 → profit\nsum(NO)  < $0.95 → Buy ALL NO  → guaranteed $1.00 payout, cost < $0.95 → profit\n```\n\n**Example:**\n```\nElection market — 4 candidates:\n  Candidate A: YES = $0.45\n  Candidate B: YES = $0.22\n  Candidate C: YES = $0.18\n  Candidate D: YES = $0.08\n  Sum = $0.93 (< $0.95 threshold)\n\n→ Buy ALL YES for $0.93 total\n→ One candidate wins → collect $1.00\n→ Profit: $0.07 (7.5% return, risk-free)\n```\n\n## When to Use This Skill\n\n- Multi-outcome Polymarket events (elections, tweet counts, sports brackets)\n- When market makers are slow to rebalance after news\n- High-volatility periods where prices shift quickly\n- Events with many outcomes (more outcomes = more pricing errors)\n\n## Setup\n\n```bash\npip install simmer-sdk\nexport SIMMER_API_KEY=\"your-key-here\"\n```\n\n## Quick Start\n\n```bash\n# Scan for opportunities (dry run, no trades)\npython negrisk_arb.py\n\n# Execute real trades\npython negrisk_arb.py --live\n\n# Only show YES arbitrage\npython negrisk_arb.py --side yes\n\n# Only show NO arbitrage  \npython negrisk_arb.py --side no\n\n# Set minimum profit threshold\npython negrisk_arb.py --min-profit 0.05\n\n# JSON output\npython negrisk_arb.py --json\n\n# Quiet mode for cron\npython negrisk_arb.py --live --quiet\n\n# Show stats\npython negrisk_arb.py --stats\n\n# Show config\npython negrisk_arb.py --config\n\n# Update config\npython negrisk_arb.py --set max_position_usd=10.00\n```\n\n## Configuration\n\n| Setting | Env Variable | Default | Description |\n|---------|-------------|---------|-------------|\n| max_yes_sum | SIMMER_NEGRISK_MAX_YES_SUM | 0.95 | Max sum of YES prices to trigger buy |\n| max_no_sum | SIMMER_NEGRISK_MAX_NO_SUM | 0.95 | Max sum of NO prices to trigger buy |\n| min_profit_pct | SIMMER_NEGRISK_MIN_PROFIT | 0.03 | Min profit % after fees (3%) |\n| max_position_usd | SIMMER_NEGRISK_MAX_POSITION | 10.00 | Max USD per outcome bucket |\n| max_total_usd | SIMMER_NEGRISK_MAX_TOTAL | 50.00 | Max total USD per event |\n| max_trades_per_run | SIMMER_NEGRISK_MAX_TRADES | 2 | Max arbitrage events per cycle |\n| daily_budget | SIMMER_NEGRISK_DAILY_BUDGET | 50.00 | Daily spend limit |\n| min_outcomes | SIMMER_NEGRISK_MIN_OUTCOMES | 3 | Min outcomes per event (skip binary) |\n| max_outcomes | SIMMER_NEGRISK_MAX_OUTCOMES | 15 | Max outcomes (too many = illiquid) |\n| slippage_max_pct | SIMMER_NEGRISK_SLIPPAGE | 0.05 | Max slippage tolerance (5%) |\n| fee_filter | SIMMER_NEGRISK_FEE_FILTER | true | Skip markets with fees |\n| require_simultaneous | SIMMER_NEGRISK_SIMULTANEOUS | true | Use batch trades for simultaneous execution |\n\n## How It Works\n\nEach cycle the script:\n\n1. **Fetch active markets** — GET /api/sdk/markets (all active, sorted by opportunity)\n2. **Group by event** — Group markets sharing the same Polymarket event\n3. **Calculate sums** — Sum YES prices and NO prices for each event group\n4. **Filter opportunities** — Find events where sum < threshold\n5. **Validate edge** — Check fee rates, slippage estimates, min profit after costs\n6. **Execute batch** — POST /api/sdk/trades/batch with all buckets simultaneously\n7. **Track positions** — Tag all trades with source: \"sdk:negrisk-arb\"\n\n## Safeguards\n\n- **Fee check** — Skips any event where any outcome has taker fees\n- **Slippage check** — Estimates slippage via context API, skips if too high\n- **Simultaneous execution** — Uses batch endpoint to minimize timing risk\n- **Position check** — Skips events where you already hold positions\n- **Daily budget** — Hard stop when daily limit is reached\n- **Min outcomes** — Skips binary markets (YES + NO always = $1.00 by design)\n- **Liquidity check** — Skips outcomes with very low volume (< $100 24h)\n\n## Fee-Accurate Profit Calculation\n\n```\nyes_cost     = sum of all YES prices in cluster\npayout       = $1.00 (exactly one resolves YES)\nfee_cost     = sum of (price × fee_rate) for each outcome\nnet_profit   = payout - yes_cost - fee_cost\nprofit_pct   = net_profit / yes_cost\n```\n\nOnly trades when `profit_pct >= min_profit_pct`.\n\n## Simultaneous Execution (Critical)\n\nStandard sequential trades are risky:\n```\nBuy outcome A → price moves → Buy outcome B → sum now > $1 → no longer profitable\n```\n\nThis skill uses Simmer's batch endpoint:\n```python\nPOST /api/sdk/trades/batch\n{\n  \"trades\": [\n    {\"market_id\": \"uuid-A\", \"side\": \"yes\", \"amount\": 5.0},\n    {\"market_id\": \"uuid-B\", \"side\": \"yes\", \"amount\": 5.0},\n    {\"market_id\": \"uuid-C\", \"side\": \"yes\", \"amount\": 5.0}\n  ],\n  \"venue\": \"polymarket\",\n  \"source\": \"sdk:negrisk-arb\"\n}\n```\n\nAll trades execute in parallel — minimizes timing risk.\n\n## Example Output\n\n```\n🔢 NegRisk Arbitrage Scanner\n==================================================\n\n⚙️ Configuration:\n  Max YES sum:     $0.95\n  Max NO sum:      $0.95\n  Min profit:      3.0%\n  Max position:    $10.00/bucket\n  Daily budget:    $50.00\n\n🔍 Scanning 847 active markets...\n  Grouped into 203 multi-outcome events\n  Evaluating 203 events for arbitrage...\n\n🎯 Opportunities Found: 2\n\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\nEvent: \"Who wins the 2026 German election?\"\nSide: YES arbitrage\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n  CDU/CSU:   $0.38\n  SPD:       $0.27\n  Greens:    $0.15\n  AfD:       $0.09\n  FDP:       $0.04\n  ──────────────\n  Sum:       $0.93 (< $0.95 threshold) ✅\n  \n  Profit calculation:\n  Cost:      $0.93\n  Payout:    $1.00\n  Net:       +$0.07 (7.5%) ✅\n  Fees:      $0.00 (zero-fee market) ✅\n  Slippage:  ~1.2% (within limit) ✅\n\n  Executing batch trade...\n  ✅ CDU/CSU YES — 13.2 shares @ $0.38\n  ✅ SPD YES     — 18.5 shares @ $0.27\n  ✅ Greens YES  — 33.3 shares @ $0.15\n  ✅ AfD YES     — 55.6 shares @ $0.09\n  ✅ FDP YES     — 125.0 shares @ $0.04\n  \n  Total spent:   $4.65\n  Expected gain: $0.35 (7.5%)\n\n📊 Summary:\n  Events scanned:    203\n  Opportunities:     2\n  Trades executed:   8 (batch)\n  Total invested:    $9.30\n  Expected profit:   $0.70\n```\n\n## Win Rate Tracking\n\nThe skill tracks every arbitrage in `negrisk_ledger.json`:\n- Entry prices and total cost\n- Winning outcome after resolution\n- Actual profit vs expected\n- Slippage impact\n\nRun `--stats` after 20+ events to see real performance vs theoretical edge.\n\n## Troubleshooting\n\n**\"No arbitrage opportunities found\"**\n- Markets may be efficiently priced right now\n- Try lowering `min_profit_pct` to 0.02\n- Check during high-volatility periods (election night, major events)\n\n**\"All events skipped for fees\"**\n- Only zero-fee markets are traded\n- Set `fee_filter=false` to override (not recommended)\n\n**\"Batch trade partially filled\"**\n- Some outcomes may have thin liquidity\n- Reduce `max_position_usd` to reduce market impact\n- Increase `slippage_max_pct` slightly\n\n**\"Sum check passed but trade rejected\"**\n- Prices moved between scan and execution\n- Normal in fast-moving markets\n- Skill will retry on next cycle\n\n**\"Event has too many outcomes\"**\n- Increase `max_outcomes` setting\n- Or skip — very fragmented markets often have liquidity issues\n\n## API Endpoints Used\n\n- `GET /api/sdk/markets` — Market list with prices and divergence\n- `GET /api/sdk/context/{market_id}` — Fee rates and slippage estimates\n- `POST /api/sdk/trades/batch` — Simultaneous multi-outcome execution\n- `GET /api/sdk/positions` — Current portfolio positions\n- `GET /api/sdk/portfolio` — Balance and daily spend tracking\n\n## Cron / Automaton Setup\n\n```json\n\"automaton\": {\n  \"managed\": true,\n  \"entrypoint\": \"negrisk_arb.py --live --quiet\",\n  \"cron\": \"0 */2 * * *\"\n}\n```\n\nRuns every 2 hours. Arbitrage windows can be short — more frequent scanning catches more opportunities.\n\nOr via OpenClaw native cron:\n```bash\nopenclaw cron add \\\n  --name \"NegRisk Arbitrage\" \\\n  --cron \"0 */2 * * *\" \\\n  --session isolated \\\n  --message \"Run NegRisk arbitrage scan: cd /path/to/skill && python negrisk_arb.py --live --quiet. Show summary.\" \\\n  --announce\n```\n\n## Important Notes\n\n- This is mathematical arbitrage, not prediction — you don't need to know who wins\n- Works best on events with 4+ outcomes (more outcomes = more pricing errors)\n- Elon Tweet markets are a special case of this strategy (you're already doing it!)\n- Opportunities are rare but high-confidence when found\n- Always verify the batch filled completely before assuming profit is locked\n","tags":{"latest":"1.0.2"},"stats":{"comments":0,"downloads":705,"installsAllTime":0,"installsCurrent":0,"stars":0,"versions":3},"createdAt":1773441551572,"updatedAt":1779078150113},"latestVersion":{"version":"1.0.2","createdAt":1773475020743,"changelog":"polymarket-negrisk-arb v1.0.2\n\n- Version bump to 1.0.2; no code or documentation changes detected.\n- No functional or descriptive changes from the previous release.","license":"MIT-0"},"metadata":null,"owner":{"handle":"r2crypto","userId":"s17297xmm71pk2t3pa39ratj9s8856ah","displayName":"r2crypto","image":"https://avatars.githubusercontent.com/u/225481090?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1780089883507}}