{"id":50996197,"url":"https://github.com/casatrick/polymarket-arbitrage-bot","last_synced_at":"2026-06-20T09:35:18.283Z","repository":{"id":339436619,"uuid":"1146066886","full_name":"casatrick/polymarket-arbitrage-bot","owner":"casatrick","description":"polymarket arbitrage bot - arbitrage bot for Polymarket crypto prediction markets. Implements 5 strategies with merge/redeem for big profit,  multi-timeframe analysis, and comprehensive risk management - polymarket arbitrage trading bot.","archived":false,"fork":false,"pushed_at":"2026-02-20T14:29:10.000Z","size":141,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-19T07:36:50.223Z","etag":null,"topics":["arbitrage","arbitrage-bot","arbitrage-trading-bot","polymarket","polymarket-arbitrage-bot","polymarket-arbitrage-trading","trading-bot"],"latest_commit_sha":null,"homepage":"https://polymarket.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/casatrick.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-30T15:25:32.000Z","updated_at":"2026-05-15T11:33:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/casatrick/polymarket-arbitrage-bot","commit_stats":null,"previous_names":["roswelly/polymarket-arbitrage-bot","casatrick/polymarket-arbitrage-bot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/casatrick/polymarket-arbitrage-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casatrick%2Fpolymarket-arbitrage-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casatrick%2Fpolymarket-arbitrage-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casatrick%2Fpolymarket-arbitrage-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casatrick%2Fpolymarket-arbitrage-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/casatrick","download_url":"https://codeload.github.com/casatrick/polymarket-arbitrage-bot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casatrick%2Fpolymarket-arbitrage-bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34565240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arbitrage","arbitrage-bot","arbitrage-trading-bot","polymarket","polymarket-arbitrage-bot","polymarket-arbitrage-trading","trading-bot"],"created_at":"2026-06-20T09:35:17.558Z","updated_at":"2026-06-20T09:35:18.278Z","avatar_url":"https://github.com/casatrick.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Polymarekt Arbitrage Trading Strategies\n\nThis polymarket arbitrage trading bot utilizes the five arbitrage strategies implemented in the bot.\n\n## Overview\n\nThe polymarket arbitrage trading bot uses multiple strategies to identify arbitrage opportunities on Polymarket prediction markets. Each strategy targets different market inefficiencies and operates across multiple timeframes (5m, 15m, 1h).\n\n## For consulting with strategies and purchase, contact me at [@roswellecho](https://t.me/ewindmer)\n\n## Strategy 1: Intra-Market Arbitrage\n\nIn binary prediction markets, YES and NO tokens should always sum to $1.00. When the combined price of YES + NO is less than $1.00 (after fees), you can buy both outcomes and guarantee a profit.\n\n### Execution\n\nBuy both YES and NO tokens simultaneously, then:\n1. Buy YES and NO tokens separately through the CLOB API\n2. Merge tokens into complete sets\n3. Redeem complete sets immediately for $1.00 per share\n4. Profit is realized immediately (no waiting for resolution)\n\n### Configuration\n\n- `min_spread_pct`: Minimum profit % required (default: 1.5%)\n- `max_position_usd`: Maximum position size (default: $500)\n- `fee_pct`: Polymarket fee percentage (default: 2.0%)\n\n---\n\n## Strategy 2: Combinatorial Arbitrage\n\nFor markets with multiple outcomes (e.g., price ranges), the sum of all outcome prices should equal $1.00. When the total is less than $1.00, buy all outcomes for guaranteed profit.\n\n### Execution\n\nBuy all outcome tokens in the market, then:\n1. Buy all outcome tokens separately through the CLOB API\n2. Merge tokens into complete sets\n3. Redeem complete sets immediately for $1.00 per share\n4. Profit is realized immediately (no waiting for resolution)\n\n### Configuration\n\n- `min_deviation_pct`: Minimum deviation from $1.00 (default: 2.0%)\n- `max_position_usd`: Maximum position size (default: $300)\n- `min_outcomes`: Minimum number of outcomes required (default: 3)\n\n---\n\n## Strategy 3: Cross-Platform Arbitrage\n\nCompares Polymarket prediction prices with actual spot prices from exchanges (Binance/CoinGecko). When there's a significant discrepancy, trade on the assumption that Polymarket will converge to the fair price.\n\n### Fair Probability Calculation\n\nThe strategy estimates fair probability based on:\n- Distance of spot price from strike price\n- Price momentum (recent price changes)\n- Time to market expiry\n\n### Execution\n\nBuy the underpriced outcome (YES or NO) and wait for market correction.\n\n### Configuration\n\n- `min_price_diff_pct`: Minimum price difference to trigger (default: 3.0%)\n- `max_position_usd`: Maximum position size (default: $1000)\n- `stale_threshold_sec`: Maximum age of price data (default: 30s)\n\n---\n\n## Strategy 4: Endgame Arbitrage\n\nWhen a market is close to resolution and one outcome has very high probability (\u003e93%), buy that outcome for a small but near-certain profit.\n\n### Execution\n\nBuy the high-probability outcome and hold until resolution.\n\n### Configuration\n\n- `min_probability`: Minimum outcome probability (default: 0.93)\n- `max_time_to_resolution_hrs`: Maximum hours until resolution (default: 48)\n- `min_annualized_return_pct`: Minimum annualized return (default: 100%)\n- `max_position_usd`: Maximum position size (default: $2000)\n\n---\n\n## Strategy 5: Momentum/Mean-Reversion\n\nTracks Polymarket YES/NO prices as a price series and applies technical indicators:\n- Z-score: Measures how far current price is from mean\n- RSI: Relative Strength Index (oversold/overbought)\n- Rate of Change: Price momentum\n- VWAP divergence: Price vs volume-weighted average\n\n### Entry Conditions\n\n**Mean Reversion Buy (Oversold):**\n- Z-score \u003c -threshold\n- RSI \u003c 35\n- Rate of change \u003e -0.5%\n- Action: Buy YES (expect price to revert up)\n\n**Mean Reversion Sell (Overbought):**\n- Z-score \u003e +threshold\n- RSI \u003e 65\n- Rate of change \u003c 0.5%\n- Action: Buy NO (expect YES price to revert down)\n\n### Timeframe Parameters\n\n**5-minute (Scalping):**\n- Lookback: 12 candles (1 hour)\n- Entry Z-score: ±2.0σ\n- Take profit: 1.5%\n- Stop loss: 1.0%\n\n**15-minute (Swing):**\n- Lookback: 16 candles (4 hours)\n- Entry Z-score: ±1.8σ\n- Take profit: 3.0%\n- Stop loss: 2.0%\n\n**1-hour (Position):**\n- Lookback: 24 candles (1 day)\n- Entry Z-score: ±1.5σ\n- Take profit: 5.0%\n- Stop loss: 3.0%\n\n### Configuration\n\nEach timeframe has its own parameters in `MomentumConfig`:\n- `tf_5m_lookback`, `tf_5m_entry_zscore`, `tf_5m_take_profit_pct`, `tf_5m_stop_loss_pct`\n- `tf_15m_*` (same pattern)\n- `tf_1h_*` (same pattern)\n\n---\n\n## Signal Ranking\n\nThe `StrategyAggregator` ranks signals using a composite score based on:\n\n- **Expected profit %** (30% weight)\n- **Confidence** (25% weight)\n- **Strategy priority** (20% weight)\n- **Urgency** (15% weight)\n- **Risk/reward ratio** (10% weight)\n\nStrategy priorities:\n1. Intra-market: 1.0 (highest)\n2. Combinatorial: 0.95\n3. Endgame: 0.90\n4. Cross-platform: 0.80\n5. Momentum/Mean-reversion: 0.70\n\n## Risk Management\n\n- Maximum position size per trade\n- Maximum portfolio exposure\n- Daily loss limits\n- Stop-loss and take-profit levels\n- Consecutive loss protection\n\nSee `risk_manager.py` for details.\n\n## How Strategies Are Combined\n\nThe bot runs all applicable strategies on each market simultaneously, then combines and ranks the results.\n\n### Scanning Process\n\n1. **Market Discovery**: Bot discovers all crypto markets for BTC, ETH, XRP, SOL\n2. **Parallel Scanning**: For each market, all applicable strategies run in parallel:\n   - Intra-Market (if binary market)\n   - Combinatorial (if 3+ outcomes)\n   - Cross-Platform (if strike price can be extracted)\n   - Endgame (all markets)\n   - Momentum/Mean-Reversion (all binary markets, per timeframe)\n\n3. **Signal Collection**: All signals from all strategies are collected into a single list\n\n4. **Filtering**: Low-quality signals are filtered out:\n   - Minimum confidence: 0.35 (35%)\n   - Minimum profit: 0.5%\n\n5. **Ranking**: Remaining signals are ranked by composite score\n\n6. **Execution**: Top-ranked signals are executed (max 3 per scan cycle)\n\n### Composite Scoring Formula\n\nEach signal gets a composite score (0.0 to 1.0) calculated as:\n\n```\nscore = (profit_score × 0.30) +\n        (confidence_score × 0.25) +\n        (strategy_priority × 0.20) +\n        (urgency_score × 0.15) +\n        (risk_reward_score × 0.10)\n```\n\nWhere:\n- **profit_score**: Expected profit % / 10 (capped at 1.0)\n- **confidence_score**: Signal confidence (0.0 to 1.0)\n- **strategy_priority**: Strategy type priority (see below)\n- **urgency_score**: HIGH=1.0, MEDIUM=0.67, LOW=0.33\n- **risk_reward_score**: Risk/reward ratio × 5 (capped at 1.0)\n\n### Strategy Priority Weights\n\nStrategies are weighted by their inherent reliability:\n\n1. **Intra-market**: 1.0 (risk-free arbitrage)\n2. **Combinatorial**: 0.95 (risk-free arbitrage)\n3. **Endgame**: 0.90 (high probability)\n4. **Cross-platform**: 0.80 (directional, requires convergence)\n5. **Momentum/Mean-reversion**: 0.70 (technical analysis, less certain)\n\n### Example: Multiple Signals on One Market\n\nA single market might generate multiple signals:\n\n**Market**: \"Will BTC be above $100k by Friday?\"\n\n1. **Intra-Market Signal**: YES=$0.45, NO=$0.50 → Combined=$0.95 → Arbitrage opportunity\n   - Score: 0.85 (high priority, good profit)\n\n2. **Cross-Platform Signal**: Spot price suggests 70% probability, but YES is $0.45\n   - Score: 0.72 (medium priority, good mispricing)\n\n3. **Momentum Signal (5m)**: Oversold condition detected\n   - Score: 0.58 (lower priority, technical signal)\n\n4. **Endgame Signal**: Market resolves in 2 hours, YES at $0.96\n   - Score: 0.91 (high priority, near-certain profit)\n\n**Result**: Signals ranked: Endgame (0.91) → Intra-Market (0.85) → Cross-Platform (0.72) → Momentum (0.58)\n\nThe bot would execute the Endgame signal first, then Intra-Market if capital allows.\n\n### Signal Deduplication\n\nThe bot can generate multiple signals for the same market from different strategies. The risk manager prevents duplicate positions in the same market, so only the highest-ranked signal will execute.\n\n### Timeframe Handling\n\nSome strategies (Cross-Platform, Momentum) run across multiple timeframes (5m, 15m, 1h). Each timeframe generates a separate signal, allowing the bot to:\n- Capture short-term scalping opportunities (5m)\n- Identify swing trades (15m)\n- Take position trades (1h)\n\n## Configuration\n\nStrategy parameters can be adjusted in `config.py`. Each strategy has its own configuration class:\n\n- `IntraMarketConfig`\n- `CombinatorialConfig`\n- `CrossPlatformConfig`\n- `EndgameConfig`\n- `MomentumConfig`\n\nStrategies can be enabled/disabled individually via the `enabled` flag in each config.\n\n### Adjusting Strategy Weights\n\nTo change how strategies are prioritized, modify `STRATEGY_PRIORITY` in `StrategyAggregator` class:\n\n```python\nSTRATEGY_PRIORITY = {\n    \"intra_market\": 1.0,        # Increase for more risk-free arb focus\n    \"combinatorial\": 0.95,\n    \"endgame\": 0.90,\n    \"cross_platform\": 0.80,     # Increase for more directional trades\n    \"momentum_mean_reversion\": 0.70,  # Increase for more technical trades\n}\n```\n\n### Adjusting Composite Score Weights\n\nTo change what factors matter most, modify the weights in `_composite_score()`:\n\n```python\ncomposite = (\n    profit_score * 0.30 +      # Increase for profit-focused\n    confidence_score * 0.25 +   # Increase for confidence-focused\n    strategy_score * 0.20 +    # Increase for strategy-type preference\n    urgency_score * 0.15 +     # Increase for time-sensitive trades\n    rr_score * 0.10            # Increase for risk/reward focus\n)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasatrick%2Fpolymarket-arbitrage-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcasatrick%2Fpolymarket-arbitrage-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasatrick%2Fpolymarket-arbitrage-bot/lists"}