Loading...
Loading...
Build and test Polymarket prediction market trading strategies for YES/NO token trading. Provides 6 tools: get_all_prediction_events (browse markets, $0.001), get_prediction_market_data (analyze price history, $0.001), create_prediction_market_strategy (generate code, $1-$4.50), run_prediction_market_backtest (test performance, $0.001). Trade on real-world events (politics, economics, sports, crypto). Currently simulation only (live deployment coming soon).
npx skill4agent add aaaaqwq/claude-code-skills trade-prediction-marketsUse MCPSearch to select: mcp__workbench__get_all_prediction_events
Use MCPSearch to select: mcp__workbench__get_prediction_market_data
Use MCPSearch to select: mcp__workbench__create_prediction_market_strategy1. Browse markets:
get_all_prediction_events(market_category="crypto_rolling")
→ See BTC/ETH price prediction markets
2. Analyze market data:
get_prediction_market_data(condition_id="0x123...")
→ Study YES/NO token price history
3. Create strategy:
create_prediction_market_strategy(
strategy_name="PolymarketArb_M",
description="Buy YES when price <40%, sell at 55%"
)
4. Test strategy:
run_prediction_market_backtest(
strategy_name="PolymarketArb_M",
...
)active_onlymarket_categorycrypto_rollingpoliticseconomicssportsentertainmentcondition_idstart_dateend_datetimeframelimitstrategy_namedescriptionstrategy_namestart_dateend_datecondition_idassetintervalinitial_balancetimeframedata_typeassetinclude_resolvedstrategy_namelimitEvent: "Will BTC exceed $100,000 by end of hour?"
YES Token:
- Pays $1.00 if event occurs
- Pays $0.00 if event doesn't occur
- Current price = Market's implied probability
- Example: YES token at $0.65 = 65% implied probability
NO Token:
- Pays $1.00 if event DOESN'T occur
- Pays $0.00 if event occurs
- Current price = 1 - YES price
- Example: NO token at $0.35 = 35% implied probability
Total: YES price + NO price ≈ $1.00 (arbitrage if not)Scenario: YES token at $0.40
Buy YES token:
- Pay $0.40 now
- If event occurs: Receive $1.00 (profit $0.60 = 150% return)
- If event doesn't occur: Lose $0.40 (-100% return)
Risk/Reward:
- Risking $0.40 to make $0.60
- 1.5:1 reward:risk ratio
- Need >40% win rate to break evenType: Continuous prediction markets
Frequency: Every 15m, 1h, 4h, etc.
Question: "Will BTC price increase next [interval]?"
Example:
- 1h BTC rolling market
- New market every hour
- Predict if BTC closes higher than current price
Use case: Short-term price speculation
Trading style: Active, high frequencyType: One-time events
Frequency: Varies (elections, policy decisions)
Timeline: Days to months until resolution
Examples:
- "Will candidate X win election?"
- "Will bill Y pass Congress by date Z?"
- "Will Fed cut rates in next meeting?"
Use case: Event speculation
Trading style: Position trading, hold until resolutionType: Scheduled data releases
Frequency: Monthly, quarterly
Timeline: Fixed resolution dates
Examples:
- "Will CPI exceed 3.5% next month?"
- "Will GDP growth exceed 2% this quarter?"
- "Will unemployment rate decrease?"
Use case: Economic data predictions
Trading style: Position before release, exit at resolutionType: Game outcomes, championships
Frequency: Varies by sport
Timeline: Hours to months
Examples:
- "Will Team X win game tonight?"
- "Will Player Y score >25 points?"
- "Will Team Z win championship?"
Use case: Sports betting alternative
Trading style: Event-based positionsConcept: Buy underpriced probabilities, sell when corrected
Example:
- Event has ~60% true probability
- YES token priced at $0.45 (implies 45%)
- Buy YES (underpriced)
- Sell when price reaches $0.60 (fair value)
Advantages: Mathematical edge if probability estimation accurate
Disadvantages: Requires good probability estimationConcept: Follow YES/NO token price momentum
Example:
- YES token price rising from $0.30 → $0.45
- Buy YES (momentum continuing)
- Exit when momentum fades
Advantages: Captures strong moves
Disadvantages: Late entries, whipsawsConcept: Fade extreme probability movements
Example:
- YES token spikes to $0.85 (85% implied)
- Seems too high, buy NO token ($0.15)
- Exit when reverts toward mean
Advantages: Profits from overreactions
Disadvantages: Catching falling knives (sometimes market is right)Concept: Trade based on news/catalysts
Example:
- Positive news for candidate X
- Buy YES token before market fully reacts
- Exit after market prices in news
Advantages: Early mover advantage
Disadvantages: Requires fast news reactionBTC 1h Rolling Market:
Hour 1 (12:00-13:00):
- Market created at 12:00
- Question: "Will BTC close higher at 13:00 than 12:00?"
- YES/NO tokens trade 12:00-13:00
- Resolves at 13:00 based on price change
Hour 2 (13:00-14:00):
- New market created at 13:00
- Previous market resolved
- Profits/losses settled
- Process repeats
Strategy rolls from market to market automaticallyclass MyPolymarketStrategy(PolymarketStrategy):
def should_buy_yes(self) -> bool:
"""Check if conditions met for YES token purchase"""
# Return True to buy YES token
def should_buy_no(self) -> bool:
"""Check if conditions met for NO token purchase"""
# Return True to buy NO token
def go_yes(self):
"""Execute YES token purchase with position sizing"""
# Calculate position size
# Buy YES token
def go_no(self):
"""Execute NO token purchase with position sizing"""
# Calculate position size
# Buy NO token def should_sell_yes(self) -> bool:
"""Exit YES position"""
# Return True to sell YES tokens
def should_sell_no(self) -> bool:
"""Exit NO position"""
# Return True to sell NO tokens
def on_market_resolution(self):
"""Handle market settlement"""
# Called when market resolves
# Settle P&LHigh liquidity: >$50k volume
- Tight spreads
- Easy entry/exit
- Reliable pricing
Low liquidity: <$10k volume
- Wide spreads
- Difficult exits
- Slippage risk
Recommendation: Start with high-volume marketsGOOD: "Will BTC close above $100k at 5pm EST on Jan 1, 2025?"
- Objective resolution source (price data)
- Specific date and time
- No ambiguity
BAD: "Will crypto have a good year in 2025?"
- Subjective ("good" is undefined)
- Ambiguous resolution criteria
- Dispute riskCheck resolution source:
- Data-driven (prices, scores, votes) → Good
- Subjective judgment → Bad
- "Community decides" → High dispute risk
Research past market resolutions:
- Were resolutions fair?
- Any disputed outcomes?
- Market maker credibilityExample: Probability arbitrage strategy
Entry logic:
- Buy YES if price <40% (undervalued)
- Buy NO if price <40% (YES >60%, overvalued)
Exit logic:
- Sell YES at 55% (15% profit target)
- Sell NO at 55% (symmetric)
- Stop loss at 25% (37.5% loss, preserve capital)Fixed percentage:
- 5% of capital per market
- Max 10 simultaneous positions = 50% deployed
- Conservative, predictable
Kelly Criterion:
- Size based on edge and odds
- More aggressive, optimal growth
- Requires accurate probability estimationProfit targets:
- Sell at X% gain (e.g., 15% above entry)
Time-based exits:
- Close position Y hours before resolution
- Avoid last-minute volatility
Stop losses:
- Sell if price drops below Z% (e.g., 60% of entry)
- Preserve capital on wrong predictionsPer market: 5-10% of capital
- Limits single-market exposure
- Diversifies risk
Total exposure: 50-70% of capital
- Leaves cash buffer
- Allows for new opportunities
- Prevents overtradingDon't concentrate in one category:
- 3 crypto markets
- 2 politics markets
- 2 sports markets
→ Diversified across event types
Avoid:
- 10 BTC rolling markets
→ All correlated, high concentration riskCheck before entry:
- Current volume
- Bid/ask spread
- Order book depth
If liquidity drops:
- May be unable to exit
- Accept mark-to-market loss
- Or hold until resolution1. Browse crypto rolling markets:
get_all_prediction_events(market_category="crypto_rolling")
→ Lists BTC, ETH rolling markets with intervals
2. Check data availability:
get_data_availability(data_type="polymarket", asset="BTC")
→ Verify sufficient history for backtesting
3. Analyze specific market:
get_prediction_market_data(
condition_id="0x123...",
timeframe="1m",
limit=5000
)
→ Study YES/NO token price patterns
4. Identify strategy:
- YES token often overshoots (>60%)
- Mean reversion opportunity
- Buy NO when YES >65%, exit at 55%
5. Create strategy:
create_prediction_market_strategy(
strategy_name="BTCRollingMeanRev_M",
description="Buy NO token when YES >65%, exit at 55%..."
)
6. Backtest strategy:
run_prediction_market_backtest(
strategy_name="BTCRollingMeanRev_M",
asset="BTC",
interval="1h",
start_date="2024-01-01",
end_date="2024-12-31"
)1. Browse politics markets:
get_all_prediction_events(market_category="politics")
→ Find election markets
2. Analyze candidate X market:
get_prediction_market_data(condition_id="election_123")
→ Study YES token price leading up to election
3. Identify pattern:
- YES token very volatile
- Spikes on good news, drops on bad news
- Opportunities to buy dips, sell spikes
4. Create strategy:
create_prediction_market_strategy(
strategy_name="ElectionDipBuy_M",
description="Buy YES when price drops >15% in 24h,
sell when recovers to pre-drop level..."
)
5. Backtest (limited data for one-time events):
- May have insufficient data for thorough backtest
- Analyze manually or use similar past events
6. Trade carefully:
- Event markets have less data
- Higher uncertainty
- Start with smaller position sizes1. Identify multiple opportunities:
- BTC 1h rolling (crypto)
- Fed decision (economics)
- Championship game (sports)
2. Create strategies for each:
- Strategy 1: BTC rolling mean reversion
- Strategy 2: Fed decision probability arbitrage
- Strategy 3: Sports underdog value
3. Backtest all strategies:
run_prediction_market_backtest(...) for each
4. Allocate capital:
- BTC rolling: 15% (more data, higher confidence)
- Fed decision: 10% (one-time event, moderate confidence)
- Sports: 5% (less data, lower confidence)
Total: 30% deployed, 70% cash
5. Monitor performance:
- Track each strategy independently
- Rebalance based on results
- Stop underperformersactive_only=Falsetest-trading-strategiesimprove-trading-strategiesdeploy-live-trading