polly-gamba 1.0.42 → 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.
- package/dist/claude-trader.js +39 -2
- package/package.json +1 -1
- package/settings.json +7 -0
- package/src/claude-trader.ts +39 -2
package/dist/claude-trader.js
CHANGED
|
@@ -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;
|
|
@@ -227,6 +235,35 @@ ${m.description ? `- Description: ${m.description.slice(0, 200)}` : ''}`).join('
|
|
|
227
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.
|
|
228
236
|
- Exception: if both Polymarket AND sportsbooks agree with your base-rate analysis, the convergence strengthens the thesis.
|
|
229
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
|
+
|
|
230
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.
|
|
231
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.
|
|
232
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.`;
|
package/package.json
CHANGED
package/settings.json
CHANGED
package/src/claude-trader.ts
CHANGED
|
@@ -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
|
|
@@ -255,6 +263,35 @@ ${m.description ? `- Description: ${m.description.slice(0, 200)}` : ''}`).join('
|
|
|
255
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.
|
|
256
264
|
- Exception: if both Polymarket AND sportsbooks agree with your base-rate analysis, the convergence strengthens the thesis.
|
|
257
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
|
+
|
|
258
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.
|
|
259
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.
|
|
260
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.`
|