Trade Polymarket BTC/ETH/SOL 5-minute and 15-minute fast markets using multi-signal CEX momentum. Adds funding rate confirmation, order book imbalance, time-...
---
name: polymarket-fast-loop-improved
displayName: Polymarket FastLoop Trader (Improved)
description: Trade Polymarket BTC/ETH/SOL 5-minute and 15-minute fast markets using multi-signal CEX momentum. Adds funding rate confirmation, order book imbalance, time-of-day filtering, volatility-adjusted sizing, win-rate calibration, and fee-accurate EV math. Use when user wants to trade sprint/fast markets with a more rigorous edge filter.
metadata: {"clawdbot":{"emoji":"⚡","requires":{"env":["SIMMER_API_KEY"],"pip":["simmer-sdk"]},"cron":null,"autostart":false,"automaton":{"managed":true,"entrypoint":"fastloop_improved.py"}}}
authors:
- Based on Simmer (@simmer_markets) original, enhanced
version: "1.0.0"
published: false
---
# Polymarket FastLoop Trader — Improved
An enhanced version of the Simmer FastLoop skill with rigorous edge filtering, multi-signal confirmation, and real calibration tracking.
> **Default is paper mode.** Use `--live` for real trades. Always run 100+ paper trades first to validate your win rate before going live.
> ⚠️ Fast markets carry Polymarket's 10% fee. Your signal needs to be right **63%+ of the time** to profit. This skill will tell you your actual win rate.
## Key Improvements Over Original
| Feature | Original | Improved |
|---------|----------|----------|
| Fee math | Approximate | Exact breakeven with configurable buffer |
| Signal | Binance momentum only | Momentum + funding rate + order book |
| Momentum threshold | 0.5% (too low) | 1.0% default, calibration-driven |
| Time filtering | None | Skips low-liquidity hours |
| Position sizing | Fixed | Volatility-adjusted |
| Win rate tracking | None | Logs outcomes, reports calibration |
| Market selection | Soonest expiry | Configurable sweet-spot window |
| Stats | None | Full P&L, win rate, signal breakdown |
## Quick Start
```bash
# Install dependency
pip install simmer-sdk
# Set API key
export SIMMER_API_KEY="your-key-here"
# Paper mode — see what would happen (default)
python fastloop_improved.py
# Go live
python fastloop_improved.py --live
# Check calibration stats (win rate, P&L, signal accuracy)
python fastloop_improved.py --stats
# Resolve any expired paper trades against real outcomes
python fastloop_improved.py --resolve
# Quiet mode for cron
python fastloop_improved.py --live --quiet
```
## How to Run on a Loop
**OpenClaw native cron:**
```bash
openclaw cron add \
--name "FastLoop Improved" \
--cron "*/5 * * * *" \
--tz "UTC" \
--session isolated \
--message "Run improved fast loop: cd /path/to/skill && python fastloop_improved.py --live --quiet. Show output summary." \
--announce
```
**Linux crontab:**
```
*/5 * * * * cd /path/to/skill && python fastloop_improved.py --live --quiet
```
## Configuration
```bash
# Raise momentum threshold (recommended: 1.0–2.0%)
python fastloop_improved.py --set min_momentum_pct=1.5
# Require order book confirmation
python fastloop_improved.py --set require_orderbook=true
# Set sweet-spot window for market selection (seconds remaining)
python fastloop_improved.py --set target_time_min=90 --set target_time_max=180
# Disable time-of-day filter (trade 24/7)
python fastloop_improved.py --set time_filter=false
```
### All Settings
| Setting | Default | Description |
|---------|---------|-------------|
| `entry_threshold` | 0.05 | Min divergence from 50¢ |
| `min_momentum_pct` | 1.0 | Min % BTC move (raised from 0.5) |
| `max_position` | 5.0 | Max $ per trade |
| `signal_source` | binance | binance or coingecko |
| `lookback_minutes` | 5 | Candle lookback window |
| `min_time_remaining` | 60 | Skip if less than N seconds left |
| `target_time_min` | 90 | Prefer markets with ≥ N seconds left |
| `target_time_max` | 210 | Prefer markets with ≤ N seconds left |
| `asset` | BTC | BTC, ETH, or SOL |
| `window` | 5m | 5m or 15m |
| `volume_confidence` | true | Skip low-volume signals |
| `require_funding` | false | Require funding rate confirmation |
| `require_orderbook` | false | Require order book imbalance confirmation |
| `time_filter` | true | Skip low-liquidity hours (02:00–06:00 UTC) |
| `vol_sizing` | true | Adjust size by recent volatility |
| `fee_buffer` | 0.05 | Extra edge required above fee breakeven |
| `daily_budget` | 10.0 | Max spend per UTC day |
| `starting_balance` | 1000.0 | Paper portfolio starting balance |
## Signal Logic
Three signals are evaluated independently. The momentum signal is always required. Funding and order book are optional confirmation layers.
### 1. Momentum (always on)
- Fetch N one-minute Binance candles
- `momentum = (close_now - open_then) / open_then * 100`
- Must exceed `min_momentum_pct`
### 2. Funding Rate (optional, `require_funding=true`)
- Fetch Binance perpetual funding rate for the asset
- Positive funding + upward momentum = longs crowded, signal is weaker → SKIP
- Negative funding + upward momentum = confirmation → TRADE
- Logic inverted for downward momentum
### 3. Order Book Imbalance (optional, `require_orderbook=true`)
- Fetch top 20 levels of Binance L2 book
- `imbalance = (bid_depth - ask_depth) / (bid_depth + ask_depth)`
- Imbalance > 0.1 confirms upward momentum
- Imbalance < -0.1 confirms downward momentum
### Fee-Accurate EV
```
entry_price = market price of chosen side
win_profit = (1 - entry_price) × (1 - fee_rate)
breakeven = entry_price / (win_profit + entry_price)
required_div = (breakeven - 0.50) + fee_buffer
```
Trade only fires if `actual_divergence ≥ required_div`.
### Time-of-Day Filter
Skips 02:00–06:00 UTC by default. US session (13:00–21:00 UTC) is the highest-liquidity window for crypto prediction markets.
### Volatility-Adjusted Sizing
```
24h_vol = std(hourly_returns_last_24h) × √24
size = max_position × min(1.0, 0.02 / 24h_vol)
```
High volatility → smaller position. Low volatility with strong trend → full size.
## Win Rate Calibration
The skill tracks every paper and live trade in `fastloop_ledger.json`. After market expiry, run `--resolve` to fetch the actual Polymarket outcome and log it. After 50+ trades, `--stats` shows your real win rate broken down by momentum threshold, time of day, and asset — so you can tune settings based on actual data rather than guessing.
## Troubleshooting
All troubleshooting from the original skill applies. Additional:
**"Funding rate fetch failed"**
- Binance futures API may be rate-limited. Skill falls back to momentum-only.
**"Order book imbalance: neutral"**
- Market is balanced, signal is ambiguous — skipped if `require_orderbook=true`.
**"Time filter: low liquidity window"**
- Current UTC hour is in the 02–06 block. Set `time_filter=false` to override.
don't have the plugin yet? install it then click "run inline in claude" again.
this skill trades Polymarket's 5-minute and 15-minute fast markets on BTC, ETH, and SOL by detecting CEX momentum divergence from the 50-cent midpoint, confirmed via funding rate and order book signals. use it when you want to scalp sprint markets with rigorous edge filtering, fee-accurate profit math, and real win-rate tracking. default runs paper mode to validate calibration before live trading.
environment variables:
SIMMER_API_KEY (required): Simmer SDK authentication key. get this from your Simmer account dashboard. stored in .env or shell export.external connections:
local files:
fastloop_ledger.json: persistent trade log. created on first run. contains entry price, signals fired, outcome, P&L, timestamp, and win-rate stats by asset/threshold/hour.fastloop_config.json (optional): stores user-set overrides. skill uses defaults if missing.runtime dependencies:
initialization: load config from fastloop_config.json or apply defaults. check SIMMER_API_KEY is set; fail with clear message if not. initialize empty trade ledger if missing. log session start with timestamp and mode (paper vs. live).
fetch CEX data: call binance REST API for last N 1-minute candles (N = lookback_minutes). extract open and close prices. compute momentum = (close_now - open_then) / open_then * 100. log raw candle data for audit.
evaluate momentum signal: if momentum >= min_momentum_pct, momentum signal fires. if momentum < min_momentum_pct, skip all downstream logic and loop back to step 2 after 5 seconds. output: momentum_pct, signal_fired (bool).
time-of-day filter: if time_filter=true and current UTC hour is in [02, 03, 04, 05] (02:00-06:00 UTC), log "low liquidity window, skipping" and loop back to step 2. if time_filter=false, proceed. output: hour_utc, filter_passed (bool).
optional: funding rate confirmation: if require_funding=true, fetch Binance perpetual funding rate for asset. if momentum is upward and funding > 0, log "crowded longs, signal degraded" and skip to step 2. if momentum is upward and funding <= 0, log "funding confirms upside" and proceed. invert logic for downward momentum. output: funding_rate, confirmation (bool).
optional: order book confirmation: if require_orderbook=true, fetch Binance L2 book top 20 bids/asks. compute imbalance = (bid_depth - ask_depth) / (bid_depth + ask_depth). if momentum is upward and imbalance >= 0.1, log "book confirms upside" and proceed. if momentum is upward and imbalance < 0.1, log "book neutral or inverted, skipping". invert for downward momentum. output: imbalance, confirmation (bool).
list polymarket fast markets: query Polymarket CLOB API for 5-minute and 15-minute markets on the chosen asset (BTC, ETH, or SOL). filter by time remaining: exclude if less than min_time_remaining seconds. rank by preference: pick market closest to target_time_min to target_time_max window. output: market_id, seconds_to_expiry, mid_price.
fee breakeven calculation: given mid_price and momentum direction (long or short), compute entry_price as mid_price plus/minus entry_threshold. for long: win_profit = (1 - entry_price) * (1 - 0.10). breakeven = entry_price / (win_profit + entry_price). required_divergence = (breakeven - 0.50) + fee_buffer. actual_divergence = abs(entry_price - 0.50). if actual_divergence < required_divergence, log "insufficient edge, skipping" and loop to step 2. output: entry_price, required_div, actual_div, edge_ok (bool).
volatility-adjusted sizing: fetch last 24 hours of hourly close prices for the asset from Binance. compute realized vol = std(hourly % returns) * sqrt(24). size = max_position * min(1.0, 0.02 / vol). if size <= 0.01 (too small), log "volatility too high, skip" and loop to step 2. output: vol_24h, position_size_usd.
daily budget check: sum all fills (live or paper) from last 24 UTC hours in ledger. if cumulative >= daily_budget, log "daily budget exhausted" and loop to step 2. otherwise proceed. output: cumulative_spend_24h, budget_remaining.
submit order: build order on Polymarket. side = YES if momentum is upward, NO if downward. amount = position_size_usd. price = entry_price. order_type = limit. if paper mode, simulate fill immediately at limit price (assume liquidity exists). if live mode, submit via Polymarket CLOB and wait up to 10 seconds for fill. if no fill after 10 seconds, cancel and log "no fill, timeout" and loop to step 2. output: order_id, fill_price, fill_time_utc, trade_status.
ledger entry: append trade to fastloop_ledger.json with fields: timestamp, mode (paper/live), asset, window (5m/15m), market_id, side (YES/NO), entry_price, position_size, all signals (momentum_pct, funding_rate, imbalance), fee_buffer used, outcome (null initially), pnl (null initially). output: ledger_written (bool).
loop back: wait 5 seconds. go to step 2. if running in --quiet mode, suppress all logs except errors and final summary. if running as cron job, exit cleanly after one loop.
if momentum < min_momentum_pct: skip all downstream checks, loop to step 2 after 5 seconds.
if time_filter=true and current UTC hour in [02,03,04,05]: skip trade, loop to step 2.
if require_funding=true and funding rate contradicts momentum: skip trade, loop to step 2. else if require_funding=false, skip funding check and proceed to order book.
if require_orderbook=true and order book imbalance does not confirm momentum (threshold +/- 0.1): skip trade, loop to step 2. else if require_orderbook=false, skip order book check and proceed to fee math.
if actual_divergence < required_divergence (fee math fails): skip trade, log reason, loop to step 2.
if vol is too high (size would be < $0.01): skip trade, loop to step 2.
if daily spend >= daily_budget: skip trade, loop to step 2.
if live mode and no fill within 10 seconds: cancel order, log "no fill", loop to step 2.
if paper mode: simulate fill immediately at limit price and record in ledger.
on --resolve flag: scan ledger for expired markets (timestamp + market expiry >= now). fetch outcome from Polymarket API. update ledger with outcome and compute PnL. update win_rate_pct = (wins / total_trades) * 100.
on --stats flag: read ledger, group by asset / momentum_threshold / hour_utc. display win rate, avg PnL, sample size, and recommendation (e.g. "raise threshold to 1.5%") for each group.
console output (live and paper):
fastloop_ledger.json format:
[
{
"timestamp": "2025-01-15T14:23:45Z",
"mode": "paper",
"asset": "BTC",
"window": "5m",
"market_id": "0x1234...",
"seconds_to_expiry": 120,
"side": "YES",
"entry_price": 0.52,
"position_size_usd": 4.85,
"momentum_pct": 1.2,
"funding_rate": 0.0015,
"funding_required": false,
"funding_passed": null,
"orderbook_imbalance": 0.08,
"orderbook_required": false,
"orderbook_passed": null,
"time_filter_passed": true,
"fee_buffer": 0.05,
"breakeven_div": 0.068,
"actual_div": 0.02,
"edge_passed": true,
"vol_24h_pct": 2.1,
"order_id": "order_789",
"fill_price": 0.52,