Skill: lukebaze/polymarket-analysis (version 2.1.0)

--- name: polymarket-analysis description: Analyze Polymarket prediction markets for trading edges. Pair Cost arbitrage, whale tracking, sentiment analysis, momentum signals, user profile tracking. No execution. version: 2.1.0 --- # Polymarket Analysis Identify trading advantages in Polymarket prediction markets through multi-modal analysis. **Scope:** Analysis and opportunity identification only. No trade execution. ## Modes | Mode | Description | Reference | |------|-------------|-----------| | **Analyze** | One-time market analysis | This file | | **Monitor** | 24/7 market monitoring | `references/market-monitoring-setup.md` | | **Profile** | Track user wallet positions | `scripts/fetch-polymarket-user-profile.py` | ## Scripts ```bash # Monitor market for alerts python3 scripts/monitor-polymarket-market.py <market_url_or_id> # Fetch user profile/positions python3 scripts/fetch-polymarket-user-profile.py <wallet_address> [--trades] [--pnl] ``` ## Quick Start ### Market Analysis 1. Get market URL from user 2. Fetch via `https://gamma-api.polymarket.com/markets?slug={slug}` 3. Run multi-strategy analysis ### User Profile ```bash # From profile URL: polymarket.com/profile/0x... python3 scripts/fetch-polymarket-user-profile.py 0x7845bc5e15bc9c41be5ac0725e68a16ec02b51b5 ``` ## Core Strategies | Strategy | Description | Reference | |----------|-------------|-----------| | Pair Cost Arbitrage | YES+NO < $1.00 | `references/pair-cost-arbitrage.md` | | Momentum | RSI, MA signals | `references/momentum-analysis.md` | | Whale Tracking | Large trades | `references/whale-tracking.md` | | Sentiment | News/social | `references/sentiment-analysis.md` | ## Alert Thresholds | Event | Threshold | |-------|-----------| | Price change | ±5% in 1h | | Large trade | >$5,000 | | Pair cost | <$0.98 | | Volume spike | >2x avg | ## APIs | API | Base URL | Use | |-----|----------|-----| | Gamma | `gamma-api.polymarket.com` | Markets, prices | | Data | `data-api.polymarket.com` | User positions, trades, P&L | | CLOB | `clob.polymarket.com` | Order books, trading | See `references/polymarket-api.md` for full endpoint reference. ## References - `references/polymarket-api.md` - API endpoints (Gamma, Data, CLOB) - `references/market-monitoring-setup.md` - 24/7 cron monitoring - `references/pair-cost-arbitrage.md` - Arbitrage detection - `references/momentum-analysis.md` - Technical analysis - `references/whale-tracking.md` - Smart money tracking - `references/sentiment-analysis.md` - Sentiment aggregation

path: references/pair-cost-arbitrage.md
content: # Pair Cost Arbitrage Strategy

Exploit pricing inefficiencies where YES + NO shares cost less than guaranteed $1.00 payout.

## Mathematical Foundation

```
Pair Cost = (Total_Cost_YES / Qty_YES) + (Total_Cost_NO / Qty_NO)

If Pair Cost < 1.00:
  Guaranteed Profit = min(Qty_YES, Qty_NO) - (Cost_YES + Cost_NO)
```

## Detection Process

### Step 1: Fetch Order Book
```bash
curl "https://gamma-api.polymarket.com/markets/{market_id}"
```

Extract: `outcomePrices`, `bestBid`, `bestAsk` for both outcomes.

### Step 2: Calculate Pair Cost

```
YES_price + NO_price = Pair Cost
Target: Pair Cost < 0.99 (1% margin minimum)
```

### Step 3: Simulate Fill

Account for slippage across order book depth:
- Small orders (<$500): Use best bid/ask
- Large orders (>$500): Walk the book, calculate avg fill price

### Step 4: Profit Calculation

```
Example:
- Buy 1000 YES @ $0.52 = $520
- Buy 1000 NO @ $0.47 = $470
- Total Cost = $990
- Pair Cost = 0.52 + 0.47 = 0.99
- Guaranteed Payout = $1000
- Profit = $10 (1.01% return)
```

## Opportunity Criteria

| Metric | Threshold | Rationale |
|--------|-----------|-----------|
| Pair Cost | < 0.99 | Minimum 1% gross margin |
| Liquidity | > $1000 each side | Ensure executable size |
| Time to Resolution | < 24h preferred | Faster capital turnover |
| Spread | < 3% | Avoid illiquid markets |

## Risk Factors

- **Slippage:** Large orders move price; simulate book depth
- **Timing:** Prices change rapidly; stale data = failed arb
- **Resolution Risk:** Market cancelled/voided = funds locked
- **Gas Fees:** MATIC network fees reduce thin margins

## Output Format

```markdown
### Pair Cost Opportunity

**Market:** [Name]
**Pair Cost:** $X.XX (X.X% below $1.00)
**Max Size:** $X,XXX (based on book depth)
**Est. Profit:** $XX.XX
**Confidence:** [High/Med/Low]
**Risk:** [Key concern]
```

## API Endpoints

- Markets list: `GET /markets`
- Market details: `GET /markets/{id}`
- Order book: `GET /book/{token_id}`


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (HIGH)