polly-gamba 1.0.41 → 1.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -103,7 +103,7 @@ class ClaudeTrader {
103
103
  role: 'user',
104
104
  content: `You are a Polymarket ${PAPER_MODE ? 'PAPER TRADING (no real money)' : 'paper'} trader running a high-volume moneyball strategy. Your job is to place paper trades on EVERY market where you have ANY opinion on fair value — even slight.
105
105
  ${PAPER_MODE ? '\n⚠️ PAPER MODE: This is a test environment. Be AGGRESSIVE — trade more, skip less. Lower your threshold to 3% edge for any market resolving within 6 months.\n' : ''}
106
- TOOLS: place_order, skip_all, get_budget_status, get_positions
106
+ TOOLS: place_order, skip_all, get_budget_status, get_positions, scan_smart_money, get_wallet_positions, get_late_money, get_market_trades
107
107
  RULES:
108
108
  - Output ONLY tool calls. Zero prose.
109
109
  - For EVERY market in the list: if current price differs from your estimated fair probability by more than ${PAPER_MODE ? '3%' : '5%'}, place a trade.
@@ -116,8 +116,16 @@ RULES:
116
116
  ## POSITION DISCIPLINE:
117
117
  - Max $100 per market (20% of $500 budget). The MCP enforces this — don't fight it.
118
118
  - Same-direction re-entry is NEVER allowed while a position is open. You CANNOT average down into an existing open position. The MCP enforces this hard block. If you still believe in the thesis after a price drop, close the existing position first, then re-enter fresh next scan.
119
+ - CORRELATED PAIRS: Holding YES on one election outcome + NO on the complementary outcome is one correlated exposure, not two independent bets. Count the combined notional against your per-theme cap ($20 total). They cannot both win.
119
120
  - exit_trigger is required on every trade. Be specific: "Exit when price hits 0.X" or "Exit when [specific news event]" — not "when narrative converges."
120
- - Call get_budget_status AND get_positions at the start of each scan to know available capital and your current open positions. get_positions returns {"positions": [...], "closed_markets": [...]}. You MUST review BOTH before trading to apply concentration AND closed-market discipline correctly.`
121
+ - Call get_budget_status AND get_positions at the start of each scan to know available capital and your current open positions. get_positions returns {"positions": [...], "closed_markets": [...]}. You MUST review BOTH before trading to apply concentration AND closed-market discipline correctly.
122
+
123
+ ## SMART MONEY (poly-scout tools — use when evaluating edge):
124
+ - scan_smart_money(): Returns top Polymarket wallets by ROI + their consensus positions. If 3+ smart wallets are on the same side of a market you're evaluating, treat it as +5pp edge boost on that side.
125
+ - get_late_money(market_id): Detects unusual volume buildup in last 48h vs baseline. A strong late-money signal (confidence > 0.7) on a market you're already considering = stronger conviction. Do NOT trade solely on late money — use it as a corroborating signal alongside your own fair value estimate.
126
+ - get_wallet_positions(address): Use to verify specific wallet's current positions when scan_smart_money flags them.
127
+ - get_market_trades(token_id): Use to inspect raw trade flow on a specific market when you want to verify smart money claims.
128
+ - Smart money is a signal amplifier, not a replacement for thesis. Always form your own fair value estimate first.`
121
129
  }
122
130
  }));
123
131
  this.ready = true;
@@ -212,6 +220,7 @@ ${m.description ? `- Description: ${m.description.slice(0, 200)}` : ''}`).join('
212
220
  - Correlation examples: "Will Jesus return before GTA VI", "Will BTC hit $1M before GTA VI", "Will China invade Taiwan before GTA VI" — all three resolve based on GTA VI's release date. They are the SAME theme.
213
221
  - Similarly: "Will Orbán be PM" and "Will Magyar be PM" are both the Hungary 2026 election — treat as same theme (you may hold both as a hedge pair, but do not add a third Hungary position).
214
222
  - IMPORTANT: All 2028 US election markets share one theme — "2028 US election". This includes: Dem primary nominees (Newsom, Harris, etc.), Rep primary nominees (Vance, Rubio, etc.), and the general election winner. Do NOT hold more than 2 positions across this entire cycle.
223
+ - IMPORTANT: All Russia-Ukraine conflict markets share one theme — "Russia-Ukraine conflict". This includes: Putin removal, Zelenskyy removal, ceasefire timing, territorial outcomes, and any other market that resolves based on the Russia-Ukraine war's trajectory. Do NOT hold more than 2 positions across this entire theme.
215
224
  - If you're uncertain whether a market correlates to an existing theme, assume it does and skip.
216
225
 
217
226
  ## CLOSED MARKET DISCIPLINE (absolute rule — never override):
@@ -226,6 +235,35 @@ ${m.description ? `- Description: ${m.description.slice(0, 200)}` : ''}`).join('
226
235
  - Anchor fair value on base rates and world knowledge first; use sportsbooks to adjust by ±5pp only. If you cannot defend the estimate without the sportsbook line, the edge is too speculative.
227
236
  - Exception: if both Polymarket AND sportsbooks agree with your base-rate analysis, the convergence strengthens the thesis.
228
237
 
238
+ ## ELECTION MARKET DISCIPLINE (apply when any market involves a political election, referendum, or leadership transition):
239
+
240
+ ### Turnout Shock Screening
241
+ Before sizing any election bet, assess turnout risk. If 2+ of these signals are present, apply a 40% DISCOUNT to any structural incumbency advantage in your fair-value estimate:
242
+ - Pre-election voter registration spike >15% above the prior comparable election cycle
243
+ - Opposition rally sizes or enthusiasm signals markedly above historical norms
244
+ - "Change election" or "historic election" framing dominant across independent media
245
+ - Predicted or early-voting turnout above the country's historical 90th percentile
246
+ - Incumbent has been in power >12 years (fatigue compounds at this threshold)
247
+ Rationale: Structural advantages (gerrymandering, media control, state resources) are calibrated for normal-turnout elections. When mobilization is historic, marginal voters break disproportionately for the opposition, inverting the structural model.
248
+
249
+ ### Historical Analog Quality
250
+ When citing a historical precedent to anchor fair value (e.g. "in 2022, X happened"), you MUST assign it an explicit structural similarity score (0–100%) and state the key differences:
251
+ - Score ≥80%: strong anchor, use as primary prior
252
+ - Score 50–79%: weak anchor, adjust by ±5pp only, state the differences
253
+ - Score <50%: discard the analogy, use base rates instead
254
+ Example of a BAD analogy: Hungary 2026 ← Hungary 2022. Similarity ~50%: 2022 had 6-party unified opposition (fragmented, easy to split); 2026 had a single-party challenger (Magyar/TISZA, clean brand). Different structural conditions. Do not use 2022 to anchor Orbán's survival probability in 2026.
255
+
256
+ ### Regime-Fatigue Flag
257
+ If an incumbent has been in power >10 years AND visible economic pain or corruption signals exist (inflation, stagnant wages, high-profile corruption exposed in mainstream coverage): flag this as a REGIME-FATIGUE ELECTION. In regime-fatigue elections, reduce structural incumbency advantage estimates by 30% before computing fair value. This reflects the empirical pattern that structural advantages erode faster than polling captures when voter frustration crosses a threshold.
258
+
259
+ ### Correlated Hedge Pair Sizing
260
+ If you hold YES on one outcome AND NO on the complementary outcome in the same election (e.g., "Orbán becomes PM" YES + "Magyar becomes PM" NO), treat both positions TOGETHER as one correlated exposure unit:
261
+ - Combined notional = sum of both position sizes
262
+ - Both positions cannot simultaneously win — the upside and downside are correlated, not independent
263
+ - Cap the combined notional at $20 (2 positions × $10), not $20 per leg
264
+ - In the concentration table, label these as "HEDGE PAIR — one correlated exposure" and count them as 2/2 (theme FULL)
265
+ - Do NOT add a third position to the same election even if the third market looks mispriced — you are already fully exposed to the outcome
266
+
229
267
  STEP 1: Call get_positions. Then output a THEME CONCENTRATION TABLE — list every theme with ≥1 open position, showing count/max (e.g. "2028 US election: 3/2 FULL", "GTA VI: 2/2 FULL", "Hungary 2026 election: 1/2"). Any theme showing FULL must be skipped entirely. You MUST output this table before evaluating any market.
230
268
  STEP 2: For each market, check your theme concentration table first. If the market's theme is FULL, skip it immediately. Otherwise apply horizon discipline, closed market discipline, and edge check.
231
269
  STEP 3: If price differs from your fair probability by the required edge (accounting for sportsbook haircut if applicable), place a trade ($10 USDC). Call skip_all only if you have zero opinion on all markets.`;
@@ -310,13 +348,13 @@ ${positionLines}
310
348
 
311
349
  CLOSE RULES — apply ALL that match, no thesis override allowed:
312
350
  1. Exit trigger condition has been met (e.g. specific price level hit, event occurred). Apply literally.
313
- 2. Position is down >35% AND the fundamental thesis has materially weakened or been disproven (market structure changed, key assumption invalidated).
351
+ 2. Position is down >35% HARD CLOSE. This is a programmatic rule enforced server-side; by the time you see this position it may already be closed. Do NOT override with thesis defense.
314
352
  3. Your side of the position is priced below 10% — HARD CLOSE. The market has strongly repriced against you. Do NOT override this with "thesis not disproven yet." At <10%, expected value of holding is near zero.
315
353
  4. Position is down >50% — HARD CLOSE regardless of thesis. Cut losses. No exceptions.
316
354
  5. You have 2+ open positions in the SAME market with the SAME outcome — close the NEWER entry (higher ts value) regardless of P&L. Duplicate same-outcome positions double exposure without incremental edge. Keep the original entry.
317
355
  6. Position is UP >25% from entry AND has been held >48h — CLOSE to lock in profits. The market has moved significantly in your favor; gains are now vulnerable to reversion. Use take_profit reason. Exception: if the resolution event is within 7 days AND the position is still clearly on the right side, you may hold until resolution.
318
356
  7. STALE POSITION: Position held >7 days AND price has moved <5% from entry AND resolution event is >30 days away — CLOSE to redeploy capital. A position that doesn't move over 7 days means the mispricing wasn't as large as estimated. Cut it, accept the small loss/gain, and redeploy to markets with active price movement.
319
- 8. CONCENTRATION VIOLATION: Count open positions by underlying theme (the single real-world event that resolves all of them). Examples: "Will Jesus return before GTA VI", "Will BTC hit $1M before GTA VI", "Will China invade Taiwan before GTA VI" all share the theme "GTA VI release date". Similarly "Will Spurs win NBA Finals", "Will OKC win NBA Finals", "Will Celtics win NBA Finals" all share the theme "2026 NBA Finals". IMPORTANT: All positions tied to the 2028 US election cycle share one theme — "2028 US election". This includes: 2028 Dem primary nominees (Newsom, etc.), 2028 Rep primary nominees (Vance, Rubio, etc.), and the 2028 general election winner — regardless of which stage of the race resolves each market. If you have 3+ positions in the same theme: close positions one by one (starting with the one whose current price is closest to 50/50) until you have ≤2 in that theme. If you have 4, you must close 2. If you have 5, close 3. Do NOT stop after closing just one if the theme still has 3+ positions. Apply this BEFORE checking other rules. This check requires the FULL position list — which is why Step 0 mandates calling get_positions first.
357
+ 8. CONCENTRATION VIOLATION: Count open positions by underlying theme (the single real-world event that resolves all of them). Examples: "Will Jesus return before GTA VI", "Will BTC hit $1M before GTA VI", "Will China invade Taiwan before GTA VI" all share the theme "GTA VI release date". Similarly "Will Spurs win NBA Finals", "Will OKC win NBA Finals", "Will Celtics win NBA Finals" all share the theme "2026 NBA Finals". IMPORTANT: All positions tied to the 2028 US election cycle share one theme — "2028 US election". This includes: 2028 Dem primary nominees (Newsom, etc.), 2028 Rep primary nominees (Vance, Rubio, etc.), and the 2028 general election winner — regardless of which stage of the race resolves each market. IMPORTANT: All Russia-Ukraine conflict positions share one theme — "Russia-Ukraine conflict". This includes: Putin removal/survival, Zelenskyy removal/survival, ceasefire timing, territorial outcomes — any market that resolves based on how the Russia-Ukraine war progresses. If you have 3+ positions in the same theme: close positions one by one (starting with the one whose current price is closest to 50/50) until you have ≤2 in that theme. If you have 4, you must close 2. If you have 5, close 3. Do NOT stop after closing just one if the theme still has 3+ positions. Apply this BEFORE checking other rules. This check requires the FULL position list — which is why Step 0 mandates calling get_positions first.
320
358
  9. SPORTSBOOK THESIS DECAY: If the original reasoning cited a sportsbook cross-reference (e.g. "sportsbooks imply X%, Polymarket shows Y%") AND the position is currently down >20%: CLOSE immediately with reason "thesis_decayed". This is a mechanical rule — a -20% drawdown on a sportsbook arb trade is itself the signal that the cross-market gap has closed or the thesis was wrong. Do NOT attempt to re-estimate current sportsbook consensus or override based on "the sportsbook line is still there." The drawdown is the verdict. No exceptions.
321
359
 
322
360
  HOLD RULES: If NONE of the close rules apply and exit trigger NOT triggered, do nothing (no output needed).
@@ -144,9 +144,9 @@ class PositionMonitor {
144
144
  const hardStopClosed = [];
145
145
  for (const candidate of reviewCandidates) {
146
146
  const isPriceBelowFloor = candidate.current_price <= 0.10;
147
- const isLargeEnoughLoss = candidate.gain_pct <= -0.50;
147
+ const isLargeEnoughLoss = candidate.gain_pct <= -0.35;
148
148
  if (isPriceBelowFloor || isLargeEnoughLoss) {
149
- await this.executeHardStop(candidate, isPriceBelowFloor ? 'price_below_floor' : 'stop_loss_50pct');
149
+ await this.executeHardStop(candidate, isPriceBelowFloor ? 'price_below_floor' : 'stop_loss_35pct');
150
150
  hardStopClosed.push(candidate.market_id);
151
151
  }
152
152
  }
@@ -257,15 +257,15 @@ async function runHardStopTests() {
257
257
  const isPriceBelowFloor = price <= 0.10;
258
258
  assert(isPriceBelowFloor, 'price=0.08 should trigger floor stop');
259
259
  });
260
- await test('F2: loss = -50% triggers stop-loss', async () => {
261
- const gain = -0.50;
262
- const isLargeEnoughLoss = gain <= -0.50;
263
- assert(isLargeEnoughLoss, 'exactly -50% should trigger stop-loss');
260
+ await test('F2: loss = -35% triggers stop-loss', async () => {
261
+ const gain = -0.35;
262
+ const isLargeEnoughLoss = gain <= -0.35;
263
+ assert(isLargeEnoughLoss, 'exactly -35% should trigger stop-loss');
264
264
  });
265
- await test('F3: loss = -49.9% does NOT trigger stop-loss', async () => {
266
- const gain = -0.499;
267
- const isLargeEnoughLoss = gain <= -0.50;
268
- assert(!isLargeEnoughLoss, '-49.9% should NOT trigger stop-loss');
265
+ await test('F3: loss = -34.9% does NOT trigger stop-loss', async () => {
266
+ const gain = -0.349;
267
+ const isLargeEnoughLoss = gain <= -0.35;
268
+ assert(!isLargeEnoughLoss, '-34.9% should NOT trigger stop-loss');
269
269
  });
270
270
  await test('F4: price = 0.10 triggers floor (boundary — off-by-one vs stated rule)', async () => {
271
271
  // Code uses <= 0.10 but the Claude prompt rule says "priced below 10%"
@@ -275,12 +275,12 @@ async function runHardStopTests() {
275
275
  assert(isPriceBelowFloor, 'price=0.10 triggers stop (code behavior)');
276
276
  console.log('\n [NOTE] Boundary: price=0.10 triggers hard stop. Prompt says "<10%" but code uses "<=0.10".');
277
277
  });
278
- await test('F5: price > 0.10 and loss < 50% — no hard stop', async () => {
278
+ await test('F5: price > 0.10 and loss < 35% — no hard stop', async () => {
279
279
  const price = 0.12;
280
- const gain = -0.40;
280
+ const gain = -0.30;
281
281
  const isPriceBelowFloor = price <= 0.10;
282
- const isLargeEnoughLoss = gain <= -0.50;
283
- assert(!isPriceBelowFloor && !isLargeEnoughLoss, 'price=0.12, -40% should not trigger hard stop');
282
+ const isLargeEnoughLoss = gain <= -0.35;
283
+ assert(!isPriceBelowFloor && !isLargeEnoughLoss, 'price=0.12, -30% should not trigger hard stop');
284
284
  });
285
285
  }
286
286
  // ─── G) Double-Close Bug ─────────────────────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polly-gamba",
3
- "version": "1.0.41",
3
+ "version": "1.0.43",
4
4
  "description": "Coinbase price signal → Claude brain → Polymarket CLOB execution",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
package/service.log CHANGED
@@ -4723,3 +4723,306 @@ npm warn deprecated prebuild-install@7.1.3: No longer maintained. Please contact
4723
4723
  [expiring] fetching expiring markets (closing within 72h, vol24h>$10k, liq>$10k, price 0.05-0.95)
4724
4724
  [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4725
4725
  [scan] failed to fetch markets: fetch failed
4726
+ [position-monitor] WARNING: no price data for 558934 YES — missing 0.3h (closes after 24h continuous)
4727
+ [position-monitor] WARNING: no price data for 566140 NO — missing 0.3h (closes after 24h continuous)
4728
+ [position-monitor] WARNING: no price data for 540819 NO — missing 0.3h (closes after 24h continuous)
4729
+ [position-monitor] WARNING: no price data for 568629 YES — first miss recorded, watching (market may be resolved or delisted)
4730
+ [position-monitor] WARNING: no price data for 558936 YES — first miss recorded, watching (market may be resolved or delisted)
4731
+ [position-monitor] WARNING: no price data for 553866 NO — first miss recorded, watching (market may be resolved or delisted)
4732
+ [position-monitor] WARNING: no price data for 567689 NO — first miss recorded, watching (market may be resolved or delisted)
4733
+ [position-monitor] WARNING: no price data for 566142 NO — first miss recorded, watching (market may be resolved or delisted)
4734
+ [position-monitor] WARNING: no price data for 540844 NO — first miss recorded, watching (market may be resolved or delisted)
4735
+ [position-monitor] WARNING: no price data for 562828 NO — first miss recorded, watching (market may be resolved or delisted)
4736
+ [position-monitor] WARNING: no price data for 566188 NO — first miss recorded, watching (market may be resolved or delisted)
4737
+ [position-monitor] WARNING: no price data for 559651 NO — first miss recorded, watching (market may be resolved or delisted)
4738
+ [position-monitor] WARNING: no price data for 567621 NO — first miss recorded, watching (market may be resolved or delisted)
4739
+ [position-monitor] checked=22 review_candidates=5 hard_stops=0 (moved>5% or <72h expiry)
4740
+ [gamma] Loaded 498 markets (filtered from 500)
4741
+ [expiring] 0 expiring markets for review
4742
+ [expiring] no expiring markets found this cycle
4743
+ [position-monitor] WARNING: no price data for 553830 NO — first miss recorded, watching (market may be resolved or delisted)
4744
+ [position-monitor] WARNING: no price data for 558934 YES — missing 0.5h (closes after 24h continuous)
4745
+ [position-monitor] WARNING: no price data for 566140 NO — missing 0.5h (closes after 24h continuous)
4746
+ [position-monitor] WARNING: no price data for 540819 NO — missing 0.5h (closes after 24h continuous)
4747
+ [position-monitor] WARNING: no price data for 568629 YES — missing 0.2h (closes after 24h continuous)
4748
+ [position-monitor] checked=22 review_candidates=6 hard_stops=0 (moved>5% or <72h expiry)
4749
+ [polly-gamba] Starting paper trading service
4750
+ [polly-gamba] Claude cwd: /Users/feral/polly-gamba
4751
+ [polly-gamba] Expiring trader cwd: /Users/feral/polly-gamba-expiring
4752
+ [coinbase-ws] Connecting to wss://ws-feed.exchange.coinbase.com
4753
+ [polly-gamba] Listening for BTC/ETH price signals (threshold: 0.5% in 60s)...
4754
+ [scan] fetching high-quality markets (vol24h>$50k, liq>$50k, price 0.10-0.90)
4755
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4756
+ [expiring] fetching expiring markets (closing within 72h, vol24h>$10k, liq>$10k, price 0.05-0.95)
4757
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4758
+ [coinbase-ws] Connected
4759
+ [gamma] Loaded 498 markets (filtered from 500)
4760
+ [expiring] 0 expiring markets for review
4761
+ [expiring] no expiring markets found this cycle
4762
+ [gamma] Loaded 498 markets (filtered from 500)
4763
+ [scan] 17 high-quality markets for autonomous review
4764
+ [position-monitor] checked=22 review_candidates=7 hard_stops=0 (moved>5% or <72h expiry)
4765
+ [claude-trader:anthropic] ready
4766
+ [claude-trader:ollama] ready
4767
+ [claude-trader:expiring] ready
4768
+ [scan] fetching high-quality markets (vol24h>$50k, liq>$50k, price 0.10-0.90)
4769
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4770
+ [expiring] fetching expiring markets (closing within 72h, vol24h>$10k, liq>$10k, price 0.05-0.95)
4771
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4772
+ [scan] failed to fetch markets: fetch failed
4773
+ [expiring] failed to fetch markets: fetch failed
4774
+ [position-monitor] WARNING: no price data for 553830 NO — first miss recorded, watching (market may be resolved or delisted)
4775
+ [position-monitor] WARNING: no price data for 558934 YES — first miss recorded, watching (market may be resolved or delisted)
4776
+ [position-monitor] WARNING: no price data for 566140 NO — first miss recorded, watching (market may be resolved or delisted)
4777
+ [position-monitor] WARNING: no price data for 540819 NO — first miss recorded, watching (market may be resolved or delisted)
4778
+ [position-monitor] WARNING: no price data for 568629 YES — first miss recorded, watching (market may be resolved or delisted)
4779
+ [position-monitor] WARNING: no price data for 558936 YES — first miss recorded, watching (market may be resolved or delisted)
4780
+ [position-monitor] WARNING: no price data for 553866 NO — first miss recorded, watching (market may be resolved or delisted)
4781
+ [position-monitor] WARNING: no price data for 567689 NO — first miss recorded, watching (market may be resolved or delisted)
4782
+ [position-monitor] WARNING: no price data for 566142 NO — first miss recorded, watching (market may be resolved or delisted)
4783
+ [position-monitor] WARNING: no price data for 540844 NO — first miss recorded, watching (market may be resolved or delisted)
4784
+ [position-monitor] WARNING: no price data for 562828 NO — first miss recorded, watching (market may be resolved or delisted)
4785
+ [position-monitor] WARNING: no price data for 566188 NO — first miss recorded, watching (market may be resolved or delisted)
4786
+ [position-monitor] WARNING: no price data for 559651 NO — first miss recorded, watching (market may be resolved or delisted)
4787
+ [position-monitor] WARNING: no price data for 567621 NO — first miss recorded, watching (market may be resolved or delisted)
4788
+ [position-monitor] WARNING: no price data for 561975 NO — first miss recorded, watching (market may be resolved or delisted)
4789
+ [position-monitor] WARNING: no price data for 567561 NO — first miss recorded, watching (market may be resolved or delisted)
4790
+ [position-monitor] WARNING: no price data for 567560 YES — first miss recorded, watching (market may be resolved or delisted)
4791
+ [position-monitor] checked=22 review_candidates=3 hard_stops=0 (moved>5% or <72h expiry)
4792
+ [scan] fetching high-quality markets (vol24h>$50k, liq>$50k, price 0.10-0.90)
4793
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4794
+ [expiring] fetching expiring markets (closing within 72h, vol24h>$10k, liq>$10k, price 0.05-0.95)
4795
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4796
+ [scan] failed to fetch markets: fetch failed
4797
+ [expiring] failed to fetch markets: fetch failed
4798
+ [position-monitor] WARNING: no price data for 553830 NO — missing 0.3h (closes after 24h continuous)
4799
+ [position-monitor] WARNING: no price data for 558934 YES — missing 0.3h (closes after 24h continuous)
4800
+ [position-monitor] WARNING: no price data for 566140 NO — missing 0.3h (closes after 24h continuous)
4801
+ [position-monitor] WARNING: no price data for 540819 NO — missing 0.3h (closes after 24h continuous)
4802
+ [position-monitor] WARNING: no price data for 568629 YES — missing 0.3h (closes after 24h continuous)
4803
+ [position-monitor] WARNING: no price data for 558936 YES — missing 0.3h (closes after 24h continuous)
4804
+ [position-monitor] WARNING: no price data for 553866 NO — missing 0.3h (closes after 24h continuous)
4805
+ [position-monitor] WARNING: no price data for 567689 NO — missing 0.3h (closes after 24h continuous)
4806
+ [position-monitor] WARNING: no price data for 566142 NO — missing 0.3h (closes after 24h continuous)
4807
+ [position-monitor] WARNING: no price data for 540844 NO — missing 0.3h (closes after 24h continuous)
4808
+ [position-monitor] WARNING: no price data for 553862 YES — first miss recorded, watching (market may be resolved or delisted)
4809
+ [position-monitor] WARNING: no price data for 562828 NO — missing 0.3h (closes after 24h continuous)
4810
+ [position-monitor] WARNING: no price data for 566188 NO — missing 0.3h (closes after 24h continuous)
4811
+ [position-monitor] WARNING: no price data for 559651 NO — missing 0.3h (closes after 24h continuous)
4812
+ [position-monitor] WARNING: no price data for 567621 NO — missing 0.3h (closes after 24h continuous)
4813
+ [position-monitor] WARNING: no price data for 560317 NO — first miss recorded, watching (market may be resolved or delisted)
4814
+ [position-monitor] WARNING: no price data for 561230 NO — first miss recorded, watching (market may be resolved or delisted)
4815
+ [position-monitor] WARNING: no price data for 561975 NO — missing 0.3h (closes after 24h continuous)
4816
+ [position-monitor] WARNING: no price data for 567561 NO — missing 0.3h (closes after 24h continuous)
4817
+ [position-monitor] WARNING: no price data for 567560 YES — missing 0.3h (closes after 24h continuous)
4818
+ [position-monitor] WARNING: no price data for 567687 NO — first miss recorded, watching (market may be resolved or delisted)
4819
+ [position-monitor] checked=22 review_candidates=1 hard_stops=0 (moved>5% or <72h expiry)
4820
+ [signal] ETH up 0.51% @ $2,099.48 over 58s
4821
+ [signal] ETH up 0.51% @ $2,099.48
4822
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4823
+ [gamma] Loaded 497 markets (filtered from 500)
4824
+ [match] 20 markets for ETH signal
4825
+ [scan] fetching high-quality markets (vol24h>$50k, liq>$50k, price 0.10-0.90)
4826
+ [scan] 18 high-quality markets for autonomous review
4827
+ [expiring] fetching expiring markets (closing within 72h, vol24h>$10k, liq>$10k, price 0.05-0.95)
4828
+ [expiring] 0 expiring markets for review
4829
+ [expiring] no expiring markets found this cycle
4830
+ [position-monitor] WARNING: no price data for 553830 NO — missing 0.4h (closes after 24h continuous)
4831
+ [position-monitor] WARNING: no price data for 558934 YES — missing 0.4h (closes after 24h continuous)
4832
+ [position-monitor] WARNING: no price data for 566140 NO — missing 0.4h (closes after 24h continuous)
4833
+ [position-monitor] WARNING: no price data for 540819 NO — missing 0.4h (closes after 24h continuous)
4834
+ [position-monitor] WARNING: no price data for 568629 YES — missing 0.4h (closes after 24h continuous)
4835
+ [position-monitor] checked=22 review_candidates=7 hard_stops=0 (moved>5% or <72h expiry)
4836
+ [coinbase-ws] Disconnected — reconnecting in 5s
4837
+ [scan] fetching high-quality markets (vol24h>$50k, liq>$50k, price 0.10-0.90)
4838
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4839
+ [coinbase-ws] Connecting to wss://ws-feed.exchange.coinbase.com
4840
+ [expiring] fetching expiring markets (closing within 72h, vol24h>$10k, liq>$10k, price 0.05-0.95)
4841
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4842
+ [coinbase-ws] Error: write EPIPE
4843
+ [coinbase-ws] Disconnected — reconnecting in 5s
4844
+ [coinbase-ws] Connecting to wss://ws-feed.exchange.coinbase.com
4845
+ [scan] failed to fetch markets: fetch failed
4846
+ [coinbase-ws] Connected
4847
+ [gamma] Loaded 498 markets (filtered from 500)
4848
+ [expiring] 0 expiring markets for review
4849
+ [expiring] no expiring markets found this cycle
4850
+ [position-monitor] WARNING: no price data for 553830 NO — missing 0.7h (closes after 24h continuous)
4851
+ [position-monitor] WARNING: no price data for 558934 YES — missing 0.7h (closes after 24h continuous)
4852
+ [position-monitor] WARNING: no price data for 566140 NO — missing 0.7h (closes after 24h continuous)
4853
+ [position-monitor] WARNING: no price data for 540819 NO — missing 0.7h (closes after 24h continuous)
4854
+ [position-monitor] WARNING: no price data for 568629 YES — missing 0.7h (closes after 24h continuous)
4855
+ [position-monitor] checked=22 review_candidates=7 hard_stops=0 (moved>5% or <72h expiry)
4856
+ [scan] fetching high-quality markets (vol24h>$50k, liq>$50k, price 0.10-0.90)
4857
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4858
+ [scan] failed to fetch markets: fetch failed
4859
+ [position-monitor] checked=21 review_candidates=7 hard_stops=0 (moved>5% or <72h expiry)
4860
+ [signal] BTC up 0.50% @ $69,391.68 over 29s
4861
+ [signal] BTC up 0.50% @ $69,391.68
4862
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4863
+ [gamma] Loaded 497 markets (filtered from 500)
4864
+ [match] 1 markets for BTC signal
4865
+ [signal] ETH up 0.50% @ $2,124.37 over 3s
4866
+ [signal] ETH up 0.50% @ $2,124.37
4867
+ [match] 20 markets for ETH signal
4868
+ [expiring] fetching expiring markets (closing within 72h, vol24h>$10k, liq>$10k, price 0.05-0.95)
4869
+ [expiring] 0 expiring markets for review
4870
+ [expiring] no expiring markets found this cycle
4871
+ [scan] fetching high-quality markets (vol24h>$50k, liq>$50k, price 0.10-0.90)
4872
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4873
+ [scan] failed to fetch markets: fetch failed
4874
+ [position-monitor] WARNING: no price data for 553830 NO — first miss recorded, watching (market may be resolved or delisted)
4875
+ [position-monitor] WARNING: no price data for 558934 YES — first miss recorded, watching (market may be resolved or delisted)
4876
+ [position-monitor] WARNING: no price data for 566140 NO — first miss recorded, watching (market may be resolved or delisted)
4877
+ [position-monitor] WARNING: no price data for 540819 NO — first miss recorded, watching (market may be resolved or delisted)
4878
+ [position-monitor] WARNING: no price data for 568629 YES — first miss recorded, watching (market may be resolved or delisted)
4879
+ [position-monitor] checked=21 review_candidates=6 hard_stops=0 (moved>5% or <72h expiry)
4880
+ [expiring] fetching expiring markets (closing within 72h, vol24h>$10k, liq>$10k, price 0.05-0.95)
4881
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4882
+ [expiring] failed to fetch markets: fetch failed
4883
+ [scan] fetching high-quality markets (vol24h>$50k, liq>$50k, price 0.10-0.90)
4884
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4885
+ [scan] failed to fetch markets: fetch failed
4886
+ [expiring] fetching expiring markets (closing within 72h, vol24h>$10k, liq>$10k, price 0.05-0.95)
4887
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4888
+ [expiring] failed to fetch markets: fetch failed
4889
+ [position-monitor] WARNING: no price data for 553830 NO — missing 0.3h (closes after 24h continuous)
4890
+ [position-monitor] WARNING: no price data for 558934 YES — missing 0.3h (closes after 24h continuous)
4891
+ [position-monitor] WARNING: no price data for 566140 NO — missing 0.3h (closes after 24h continuous)
4892
+ [position-monitor] WARNING: no price data for 540819 NO — missing 0.3h (closes after 24h continuous)
4893
+ [position-monitor] WARNING: no price data for 568629 YES — missing 0.3h (closes after 24h continuous)
4894
+ [position-monitor] WARNING: no price data for 558936 YES — first miss recorded, watching (market may be resolved or delisted)
4895
+ [position-monitor] WARNING: no price data for 553866 NO — first miss recorded, watching (market may be resolved or delisted)
4896
+ [position-monitor] WARNING: no price data for 567689 NO — first miss recorded, watching (market may be resolved or delisted)
4897
+ [position-monitor] WARNING: no price data for 540844 NO — first miss recorded, watching (market may be resolved or delisted)
4898
+ [position-monitor] WARNING: no price data for 553862 YES — first miss recorded, watching (market may be resolved or delisted)
4899
+ [position-monitor] WARNING: no price data for 566188 NO — first miss recorded, watching (market may be resolved or delisted)
4900
+ [position-monitor] WARNING: no price data for 559651 NO — first miss recorded, watching (market may be resolved or delisted)
4901
+ [position-monitor] WARNING: no price data for 567621 NO — first miss recorded, watching (market may be resolved or delisted)
4902
+ [position-monitor] WARNING: no price data for 560317 NO — first miss recorded, watching (market may be resolved or delisted)
4903
+ [position-monitor] checked=21 review_candidates=4 hard_stops=0 (moved>5% or <72h expiry)
4904
+ [scan] fetching high-quality markets (vol24h>$50k, liq>$50k, price 0.10-0.90)
4905
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4906
+ [position-monitor] WARNING: no price data for 566140 NO — missing 0.5h (closes after 24h continuous)
4907
+ [position-monitor] WARNING: no price data for 540819 NO — missing 0.5h (closes after 24h continuous)
4908
+ [gamma] Loaded 498 markets (filtered from 500)
4909
+ [scan] 18 high-quality markets for autonomous review
4910
+ [position-monitor] checked=21 review_candidates=7 hard_stops=0 (moved>5% or <72h expiry)
4911
+ [expiring] fetching expiring markets (closing within 72h, vol24h>$10k, liq>$10k, price 0.05-0.95)
4912
+ [expiring] 0 expiring markets for review
4913
+ [expiring] no expiring markets found this cycle
4914
+ [scan] fetching high-quality markets (vol24h>$50k, liq>$50k, price 0.10-0.90)
4915
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4916
+ [gamma] Loaded 498 markets (filtered from 500)
4917
+ [scan] 18 high-quality markets for autonomous review
4918
+ [position-monitor] WARNING: no price data for 558934 YES — first miss recorded, watching (market may be resolved or delisted)
4919
+ [position-monitor] WARNING: no price data for 568629 YES — first miss recorded, watching (market may be resolved or delisted)
4920
+ [position-monitor] checked=21 review_candidates=6 hard_stops=0 (moved>5% or <72h expiry)
4921
+ [expiring] fetching expiring markets (closing within 72h, vol24h>$10k, liq>$10k, price 0.05-0.95)
4922
+ [expiring] 0 expiring markets for review
4923
+ [expiring] no expiring markets found this cycle
4924
+ [signal] BTC up 0.50% @ $69,709.14 over 59s
4925
+ [signal] BTC up 0.50% @ $69,709.14
4926
+ [match] 1 markets for BTC signal
4927
+ [signal] ETH up 0.50% @ $2,138.63 over 60s
4928
+ [signal] ETH up 0.50% @ $2,138.63
4929
+ [match] 20 markets for ETH signal
4930
+ [scan] fetching high-quality markets (vol24h>$50k, liq>$50k, price 0.10-0.90)
4931
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4932
+ [expiring] fetching expiring markets (closing within 72h, vol24h>$10k, liq>$10k, price 0.05-0.95)
4933
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4934
+ [scan] failed to fetch markets: fetch failed
4935
+ [gamma] Loaded 498 markets (filtered from 500)
4936
+ [expiring] 0 expiring markets for review
4937
+ [expiring] no expiring markets found this cycle
4938
+ [position-monitor] WARNING: no price data for 553830 NO — first miss recorded, watching (market may be resolved or delisted)
4939
+ [position-monitor] WARNING: no price data for 558934 YES — missing 0.4h (closes after 24h continuous)
4940
+ [position-monitor] WARNING: no price data for 566140 NO — first miss recorded, watching (market may be resolved or delisted)
4941
+ [position-monitor] WARNING: no price data for 540819 NO — first miss recorded, watching (market may be resolved or delisted)
4942
+ [position-monitor] WARNING: no price data for 558936 YES — first miss recorded, watching (market may be resolved or delisted)
4943
+ [position-monitor] WARNING: no price data for 567689 NO — first miss recorded, watching (market may be resolved or delisted)
4944
+ [position-monitor] WARNING: no price data for 540844 NO — first miss recorded, watching (market may be resolved or delisted)
4945
+ [position-monitor] WARNING: no price data for 553862 YES — first miss recorded, watching (market may be resolved or delisted)
4946
+ [position-monitor] WARNING: no price data for 562828 NO — first miss recorded, watching (market may be resolved or delisted)
4947
+ [position-monitor] WARNING: no price data for 559651 NO — first miss recorded, watching (market may be resolved or delisted)
4948
+ [position-monitor] WARNING: no price data for 567621 NO — first miss recorded, watching (market may be resolved or delisted)
4949
+ [position-monitor] WARNING: no price data for 560317 NO — first miss recorded, watching (market may be resolved or delisted)
4950
+ [position-monitor] WARNING: no price data for 561975 NO — first miss recorded, watching (market may be resolved or delisted)
4951
+ [position-monitor] WARNING: no price data for 567561 NO — first miss recorded, watching (market may be resolved or delisted)
4952
+ [position-monitor] WARNING: no price data for 567560 YES — first miss recorded, watching (market may be resolved or delisted)
4953
+ [position-monitor] WARNING: no price data for 567687 NO — first miss recorded, watching (market may be resolved or delisted)
4954
+ [position-monitor] checked=21 review_candidates=2 hard_stops=0 (moved>5% or <72h expiry)
4955
+ [signal] ETH down -0.50% @ $2,139.8 over 37s
4956
+ [signal] ETH down 0.50% @ $2,139.8
4957
+ [match] 20 markets for ETH signal
4958
+ [signal] BTC down -0.50% @ $69,838.62 over 60s
4959
+ [signal] BTC down 0.50% @ $69,838.62
4960
+ [match] 1 markets for BTC signal
4961
+ [scan] fetching high-quality markets (vol24h>$50k, liq>$50k, price 0.10-0.90)
4962
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4963
+ [expiring] fetching expiring markets (closing within 72h, vol24h>$10k, liq>$10k, price 0.05-0.95)
4964
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4965
+ [position-monitor] WARNING: no price data for 558934 YES — missing 0.5h (closes after 24h continuous)
4966
+ [position-monitor] WARNING: no price data for 566140 NO — missing 0.2h (closes after 24h continuous)
4967
+ [position-monitor] WARNING: no price data for 540819 NO — missing 0.2h (closes after 24h continuous)
4968
+ [position-monitor] WARNING: no price data for 568629 YES — first miss recorded, watching (market may be resolved or delisted)
4969
+ [position-monitor] WARNING: no price data for 558936 YES — missing 0.2h (closes after 24h continuous)
4970
+ [position-monitor] WARNING: no price data for 567689 NO — missing 0.2h (closes after 24h continuous)
4971
+ [position-monitor] WARNING: no price data for 540844 NO — missing 0.2h (closes after 24h continuous)
4972
+ [position-monitor] WARNING: no price data for 553862 YES — missing 0.2h (closes after 24h continuous)
4973
+ [position-monitor] WARNING: no price data for 560317 NO — missing 0.2h (closes after 24h continuous)
4974
+ [position-monitor] WARNING: no price data for 567687 NO — missing 0.2h (closes after 24h continuous)
4975
+ [position-monitor] checked=21 review_candidates=3 hard_stops=0 (moved>5% or <72h expiry)
4976
+ [gamma] Loaded 498 markets (filtered from 500)
4977
+ [scan] 18 high-quality markets for autonomous review
4978
+ [gamma] Loaded 498 markets (filtered from 500)
4979
+ [expiring] 0 expiring markets for review
4980
+ [expiring] no expiring markets found this cycle
4981
+ [position-monitor] WARNING: no price data for 553830 NO — first miss recorded, watching (market may be resolved or delisted)
4982
+ [position-monitor] WARNING: no price data for 558934 YES — missing 0.8h (closes after 24h continuous)
4983
+ [position-monitor] checked=21 review_candidates=7 hard_stops=0 (moved>5% or <72h expiry)
4984
+ [scan] fetching high-quality markets (vol24h>$50k, liq>$50k, price 0.10-0.90)
4985
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4986
+ [expiring] fetching expiring markets (closing within 72h, vol24h>$10k, liq>$10k, price 0.05-0.95)
4987
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4988
+ [scan] failed to fetch markets: fetch failed
4989
+ [expiring] failed to fetch markets: fetch failed
4990
+ [position-monitor] WARNING: no price data for 558934 YES — missing 1.0h (closes after 24h continuous)
4991
+ [position-monitor] WARNING: no price data for 566140 NO — first miss recorded, watching (market may be resolved or delisted)
4992
+ [position-monitor] WARNING: no price data for 540819 NO — first miss recorded, watching (market may be resolved or delisted)
4993
+ [position-monitor] WARNING: no price data for 568629 YES — first miss recorded, watching (market may be resolved or delisted)
4994
+ [position-monitor] checked=21 review_candidates=6 hard_stops=0 (moved>5% or <72h expiry)
4995
+ [scan] fetching high-quality markets (vol24h>$50k, liq>$50k, price 0.10-0.90)
4996
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
4997
+ [gamma] Loaded 498 markets (filtered from 500)
4998
+ [scan] 18 high-quality markets for autonomous review
4999
+ [expiring] fetching expiring markets (closing within 72h, vol24h>$10k, liq>$10k, price 0.05-0.95)
5000
+ [expiring] 0 expiring markets for review
5001
+ [expiring] no expiring markets found this cycle
5002
+ [signal] BTC up 0.50% @ $70,410.96 over 60s
5003
+ [signal] BTC up 0.50% @ $70,410.96
5004
+ [match] 1 markets for BTC signal
5005
+ [signal] ETH up 0.50% @ $2,162.53 over 59s
5006
+ [signal] ETH up 0.50% @ $2,162.53
5007
+ [match] 20 markets for ETH signal
5008
+ [position-monitor] checked=21 review_candidates=7 hard_stops=0 (moved>5% or <72h expiry)
5009
+ npm warn deprecated prebuild-install@7.1.3: No longer maintained. Please contact the author of the relevant native addon; alternatives are available.
5010
+ [polly-gamba] Starting paper trading service
5011
+ [polly-gamba] Claude cwd: /Users/feral/polly-gamba
5012
+ [polly-gamba] Expiring trader cwd: /Users/feral/polly-gamba-expiring
5013
+ [coinbase-ws] Connecting to wss://ws-feed.exchange.coinbase.com
5014
+ [polly-gamba] Listening for BTC/ETH price signals (threshold: 0.5% in 60s)...
5015
+ [scan] fetching high-quality markets (vol24h>$50k, liq>$50k, price 0.10-0.90)
5016
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
5017
+ [expiring] fetching expiring markets (closing within 72h, vol24h>$10k, liq>$10k, price 0.05-0.95)
5018
+ [gamma] Fetching active markets from https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=500
5019
+ [gamma] Loaded 498 markets (filtered from 500)
5020
+ [scan] 18 high-quality markets for autonomous review
5021
+ [gamma] Loaded 498 markets (filtered from 500)
5022
+ [expiring] 0 expiring markets for review
5023
+ [expiring] no expiring markets found this cycle
5024
+ [coinbase-ws] Connected
5025
+ [position-monitor] checked=21 review_candidates=7 hard_stops=0 (moved>5% or <72h expiry)
5026
+ [claude-trader:anthropic] ready
5027
+ [claude-trader:ollama] ready
5028
+ [claude-trader:expiring] ready
package/settings.json CHANGED
@@ -7,6 +7,13 @@
7
7
  "REDIS_URL": "redis://localhost:6379",
8
8
  "POLLY_REDIS_PREFIX": "polly"
9
9
  }
10
+ },
11
+ "poly-scout": {
12
+ "command": "npx",
13
+ "args": ["--yes", "-y", "@gonzih/poly-scout"],
14
+ "env": {
15
+ "REDIS_URL": "redis://localhost:6379"
16
+ }
10
17
  }
11
18
  }
12
19
  }
@@ -120,7 +120,7 @@ export class ClaudeTrader {
120
120
  role: 'user',
121
121
  content: `You are a Polymarket ${PAPER_MODE ? 'PAPER TRADING (no real money)' : 'paper'} trader running a high-volume moneyball strategy. Your job is to place paper trades on EVERY market where you have ANY opinion on fair value — even slight.
122
122
  ${PAPER_MODE ? '\n⚠️ PAPER MODE: This is a test environment. Be AGGRESSIVE — trade more, skip less. Lower your threshold to 3% edge for any market resolving within 6 months.\n' : ''}
123
- TOOLS: place_order, skip_all, get_budget_status, get_positions
123
+ TOOLS: place_order, skip_all, get_budget_status, get_positions, scan_smart_money, get_wallet_positions, get_late_money, get_market_trades
124
124
  RULES:
125
125
  - Output ONLY tool calls. Zero prose.
126
126
  - For EVERY market in the list: if current price differs from your estimated fair probability by more than ${PAPER_MODE ? '3%' : '5%'}, place a trade.
@@ -133,8 +133,16 @@ RULES:
133
133
  ## POSITION DISCIPLINE:
134
134
  - Max $100 per market (20% of $500 budget). The MCP enforces this — don't fight it.
135
135
  - Same-direction re-entry is NEVER allowed while a position is open. You CANNOT average down into an existing open position. The MCP enforces this hard block. If you still believe in the thesis after a price drop, close the existing position first, then re-enter fresh next scan.
136
+ - CORRELATED PAIRS: Holding YES on one election outcome + NO on the complementary outcome is one correlated exposure, not two independent bets. Count the combined notional against your per-theme cap ($20 total). They cannot both win.
136
137
  - exit_trigger is required on every trade. Be specific: "Exit when price hits 0.X" or "Exit when [specific news event]" — not "when narrative converges."
137
- - Call get_budget_status AND get_positions at the start of each scan to know available capital and your current open positions. get_positions returns {"positions": [...], "closed_markets": [...]}. You MUST review BOTH before trading to apply concentration AND closed-market discipline correctly.`
138
+ - Call get_budget_status AND get_positions at the start of each scan to know available capital and your current open positions. get_positions returns {"positions": [...], "closed_markets": [...]}. You MUST review BOTH before trading to apply concentration AND closed-market discipline correctly.
139
+
140
+ ## SMART MONEY (poly-scout tools — use when evaluating edge):
141
+ - scan_smart_money(): Returns top Polymarket wallets by ROI + their consensus positions. If 3+ smart wallets are on the same side of a market you're evaluating, treat it as +5pp edge boost on that side.
142
+ - get_late_money(market_id): Detects unusual volume buildup in last 48h vs baseline. A strong late-money signal (confidence > 0.7) on a market you're already considering = stronger conviction. Do NOT trade solely on late money — use it as a corroborating signal alongside your own fair value estimate.
143
+ - get_wallet_positions(address): Use to verify specific wallet's current positions when scan_smart_money flags them.
144
+ - get_market_trades(token_id): Use to inspect raw trade flow on a specific market when you want to verify smart money claims.
145
+ - Smart money is a signal amplifier, not a replacement for thesis. Always form your own fair value estimate first.`
138
146
  }
139
147
  }))
140
148
  this.ready = true
@@ -240,6 +248,7 @@ ${m.description ? `- Description: ${m.description.slice(0, 200)}` : ''}`).join('
240
248
  - Correlation examples: "Will Jesus return before GTA VI", "Will BTC hit $1M before GTA VI", "Will China invade Taiwan before GTA VI" — all three resolve based on GTA VI's release date. They are the SAME theme.
241
249
  - Similarly: "Will Orbán be PM" and "Will Magyar be PM" are both the Hungary 2026 election — treat as same theme (you may hold both as a hedge pair, but do not add a third Hungary position).
242
250
  - IMPORTANT: All 2028 US election markets share one theme — "2028 US election". This includes: Dem primary nominees (Newsom, Harris, etc.), Rep primary nominees (Vance, Rubio, etc.), and the general election winner. Do NOT hold more than 2 positions across this entire cycle.
251
+ - IMPORTANT: All Russia-Ukraine conflict markets share one theme — "Russia-Ukraine conflict". This includes: Putin removal, Zelenskyy removal, ceasefire timing, territorial outcomes, and any other market that resolves based on the Russia-Ukraine war's trajectory. Do NOT hold more than 2 positions across this entire theme.
243
252
  - If you're uncertain whether a market correlates to an existing theme, assume it does and skip.
244
253
 
245
254
  ## CLOSED MARKET DISCIPLINE (absolute rule — never override):
@@ -254,6 +263,35 @@ ${m.description ? `- Description: ${m.description.slice(0, 200)}` : ''}`).join('
254
263
  - Anchor fair value on base rates and world knowledge first; use sportsbooks to adjust by ±5pp only. If you cannot defend the estimate without the sportsbook line, the edge is too speculative.
255
264
  - Exception: if both Polymarket AND sportsbooks agree with your base-rate analysis, the convergence strengthens the thesis.
256
265
 
266
+ ## ELECTION MARKET DISCIPLINE (apply when any market involves a political election, referendum, or leadership transition):
267
+
268
+ ### Turnout Shock Screening
269
+ Before sizing any election bet, assess turnout risk. If 2+ of these signals are present, apply a 40% DISCOUNT to any structural incumbency advantage in your fair-value estimate:
270
+ - Pre-election voter registration spike >15% above the prior comparable election cycle
271
+ - Opposition rally sizes or enthusiasm signals markedly above historical norms
272
+ - "Change election" or "historic election" framing dominant across independent media
273
+ - Predicted or early-voting turnout above the country's historical 90th percentile
274
+ - Incumbent has been in power >12 years (fatigue compounds at this threshold)
275
+ Rationale: Structural advantages (gerrymandering, media control, state resources) are calibrated for normal-turnout elections. When mobilization is historic, marginal voters break disproportionately for the opposition, inverting the structural model.
276
+
277
+ ### Historical Analog Quality
278
+ When citing a historical precedent to anchor fair value (e.g. "in 2022, X happened"), you MUST assign it an explicit structural similarity score (0–100%) and state the key differences:
279
+ - Score ≥80%: strong anchor, use as primary prior
280
+ - Score 50–79%: weak anchor, adjust by ±5pp only, state the differences
281
+ - Score <50%: discard the analogy, use base rates instead
282
+ Example of a BAD analogy: Hungary 2026 ← Hungary 2022. Similarity ~50%: 2022 had 6-party unified opposition (fragmented, easy to split); 2026 had a single-party challenger (Magyar/TISZA, clean brand). Different structural conditions. Do not use 2022 to anchor Orbán's survival probability in 2026.
283
+
284
+ ### Regime-Fatigue Flag
285
+ If an incumbent has been in power >10 years AND visible economic pain or corruption signals exist (inflation, stagnant wages, high-profile corruption exposed in mainstream coverage): flag this as a REGIME-FATIGUE ELECTION. In regime-fatigue elections, reduce structural incumbency advantage estimates by 30% before computing fair value. This reflects the empirical pattern that structural advantages erode faster than polling captures when voter frustration crosses a threshold.
286
+
287
+ ### Correlated Hedge Pair Sizing
288
+ If you hold YES on one outcome AND NO on the complementary outcome in the same election (e.g., "Orbán becomes PM" YES + "Magyar becomes PM" NO), treat both positions TOGETHER as one correlated exposure unit:
289
+ - Combined notional = sum of both position sizes
290
+ - Both positions cannot simultaneously win — the upside and downside are correlated, not independent
291
+ - Cap the combined notional at $20 (2 positions × $10), not $20 per leg
292
+ - In the concentration table, label these as "HEDGE PAIR — one correlated exposure" and count them as 2/2 (theme FULL)
293
+ - Do NOT add a third position to the same election even if the third market looks mispriced — you are already fully exposed to the outcome
294
+
257
295
  STEP 1: Call get_positions. Then output a THEME CONCENTRATION TABLE — list every theme with ≥1 open position, showing count/max (e.g. "2028 US election: 3/2 FULL", "GTA VI: 2/2 FULL", "Hungary 2026 election: 1/2"). Any theme showing FULL must be skipped entirely. You MUST output this table before evaluating any market.
258
296
  STEP 2: For each market, check your theme concentration table first. If the market's theme is FULL, skip it immediately. Otherwise apply horizon discipline, closed market discipline, and edge check.
259
297
  STEP 3: If price differs from your fair probability by the required edge (accounting for sportsbook haircut if applicable), place a trade ($10 USDC). Call skip_all only if you have zero opinion on all markets.`
@@ -362,13 +400,13 @@ ${positionLines}
362
400
 
363
401
  CLOSE RULES — apply ALL that match, no thesis override allowed:
364
402
  1. Exit trigger condition has been met (e.g. specific price level hit, event occurred). Apply literally.
365
- 2. Position is down >35% AND the fundamental thesis has materially weakened or been disproven (market structure changed, key assumption invalidated).
403
+ 2. Position is down >35% HARD CLOSE. This is a programmatic rule enforced server-side; by the time you see this position it may already be closed. Do NOT override with thesis defense.
366
404
  3. Your side of the position is priced below 10% — HARD CLOSE. The market has strongly repriced against you. Do NOT override this with "thesis not disproven yet." At <10%, expected value of holding is near zero.
367
405
  4. Position is down >50% — HARD CLOSE regardless of thesis. Cut losses. No exceptions.
368
406
  5. You have 2+ open positions in the SAME market with the SAME outcome — close the NEWER entry (higher ts value) regardless of P&L. Duplicate same-outcome positions double exposure without incremental edge. Keep the original entry.
369
407
  6. Position is UP >25% from entry AND has been held >48h — CLOSE to lock in profits. The market has moved significantly in your favor; gains are now vulnerable to reversion. Use take_profit reason. Exception: if the resolution event is within 7 days AND the position is still clearly on the right side, you may hold until resolution.
370
408
  7. STALE POSITION: Position held >7 days AND price has moved <5% from entry AND resolution event is >30 days away — CLOSE to redeploy capital. A position that doesn't move over 7 days means the mispricing wasn't as large as estimated. Cut it, accept the small loss/gain, and redeploy to markets with active price movement.
371
- 8. CONCENTRATION VIOLATION: Count open positions by underlying theme (the single real-world event that resolves all of them). Examples: "Will Jesus return before GTA VI", "Will BTC hit $1M before GTA VI", "Will China invade Taiwan before GTA VI" all share the theme "GTA VI release date". Similarly "Will Spurs win NBA Finals", "Will OKC win NBA Finals", "Will Celtics win NBA Finals" all share the theme "2026 NBA Finals". IMPORTANT: All positions tied to the 2028 US election cycle share one theme — "2028 US election". This includes: 2028 Dem primary nominees (Newsom, etc.), 2028 Rep primary nominees (Vance, Rubio, etc.), and the 2028 general election winner — regardless of which stage of the race resolves each market. If you have 3+ positions in the same theme: close positions one by one (starting with the one whose current price is closest to 50/50) until you have ≤2 in that theme. If you have 4, you must close 2. If you have 5, close 3. Do NOT stop after closing just one if the theme still has 3+ positions. Apply this BEFORE checking other rules. This check requires the FULL position list — which is why Step 0 mandates calling get_positions first.
409
+ 8. CONCENTRATION VIOLATION: Count open positions by underlying theme (the single real-world event that resolves all of them). Examples: "Will Jesus return before GTA VI", "Will BTC hit $1M before GTA VI", "Will China invade Taiwan before GTA VI" all share the theme "GTA VI release date". Similarly "Will Spurs win NBA Finals", "Will OKC win NBA Finals", "Will Celtics win NBA Finals" all share the theme "2026 NBA Finals". IMPORTANT: All positions tied to the 2028 US election cycle share one theme — "2028 US election". This includes: 2028 Dem primary nominees (Newsom, etc.), 2028 Rep primary nominees (Vance, Rubio, etc.), and the 2028 general election winner — regardless of which stage of the race resolves each market. IMPORTANT: All Russia-Ukraine conflict positions share one theme — "Russia-Ukraine conflict". This includes: Putin removal/survival, Zelenskyy removal/survival, ceasefire timing, territorial outcomes — any market that resolves based on how the Russia-Ukraine war progresses. If you have 3+ positions in the same theme: close positions one by one (starting with the one whose current price is closest to 50/50) until you have ≤2 in that theme. If you have 4, you must close 2. If you have 5, close 3. Do NOT stop after closing just one if the theme still has 3+ positions. Apply this BEFORE checking other rules. This check requires the FULL position list — which is why Step 0 mandates calling get_positions first.
372
410
  9. SPORTSBOOK THESIS DECAY: If the original reasoning cited a sportsbook cross-reference (e.g. "sportsbooks imply X%, Polymarket shows Y%") AND the position is currently down >20%: CLOSE immediately with reason "thesis_decayed". This is a mechanical rule — a -20% drawdown on a sportsbook arb trade is itself the signal that the cross-market gap has closed or the thesis was wrong. Do NOT attempt to re-estimate current sportsbook consensus or override based on "the sportsbook line is still there." The drawdown is the verdict. No exceptions.
373
411
 
374
412
  HOLD RULES: If NONE of the close rules apply and exit trigger NOT triggered, do nothing (no output needed).
@@ -183,9 +183,9 @@ export class PositionMonitor {
183
183
  const hardStopClosed: string[] = []
184
184
  for (const candidate of reviewCandidates) {
185
185
  const isPriceBelowFloor = candidate.current_price <= 0.10
186
- const isLargeEnoughLoss = candidate.gain_pct <= -0.50
186
+ const isLargeEnoughLoss = candidate.gain_pct <= -0.35
187
187
  if (isPriceBelowFloor || isLargeEnoughLoss) {
188
- await this.executeHardStop(candidate, isPriceBelowFloor ? 'price_below_floor' : 'stop_loss_50pct')
188
+ await this.executeHardStop(candidate, isPriceBelowFloor ? 'price_below_floor' : 'stop_loss_35pct')
189
189
  hardStopClosed.push(candidate.market_id)
190
190
  }
191
191
  }
@@ -366,16 +366,16 @@ async function runHardStopTests(): Promise<void> {
366
366
  assert(isPriceBelowFloor, 'price=0.08 should trigger floor stop')
367
367
  })
368
368
 
369
- await test('F2: loss = -50% triggers stop-loss', async () => {
370
- const gain = -0.50
371
- const isLargeEnoughLoss = gain <= -0.50
372
- assert(isLargeEnoughLoss, 'exactly -50% should trigger stop-loss')
369
+ await test('F2: loss = -35% triggers stop-loss', async () => {
370
+ const gain = -0.35
371
+ const isLargeEnoughLoss = gain <= -0.35
372
+ assert(isLargeEnoughLoss, 'exactly -35% should trigger stop-loss')
373
373
  })
374
374
 
375
- await test('F3: loss = -49.9% does NOT trigger stop-loss', async () => {
376
- const gain = -0.499
377
- const isLargeEnoughLoss = gain <= -0.50
378
- assert(!isLargeEnoughLoss, '-49.9% should NOT trigger stop-loss')
375
+ await test('F3: loss = -34.9% does NOT trigger stop-loss', async () => {
376
+ const gain = -0.349
377
+ const isLargeEnoughLoss = gain <= -0.35
378
+ assert(!isLargeEnoughLoss, '-34.9% should NOT trigger stop-loss')
379
379
  })
380
380
 
381
381
  await test('F4: price = 0.10 triggers floor (boundary — off-by-one vs stated rule)', async () => {
@@ -387,12 +387,12 @@ async function runHardStopTests(): Promise<void> {
387
387
  console.log('\n [NOTE] Boundary: price=0.10 triggers hard stop. Prompt says "<10%" but code uses "<=0.10".')
388
388
  })
389
389
 
390
- await test('F5: price > 0.10 and loss < 50% — no hard stop', async () => {
390
+ await test('F5: price > 0.10 and loss < 35% — no hard stop', async () => {
391
391
  const price = 0.12
392
- const gain = -0.40
392
+ const gain = -0.30
393
393
  const isPriceBelowFloor = price <= 0.10
394
- const isLargeEnoughLoss = gain <= -0.50
395
- assert(!isPriceBelowFloor && !isLargeEnoughLoss, 'price=0.12, -40% should not trigger hard stop')
394
+ const isLargeEnoughLoss = gain <= -0.35
395
+ assert(!isPriceBelowFloor && !isLargeEnoughLoss, 'price=0.12, -30% should not trigger hard stop')
396
396
  })
397
397
  }
398
398