Loading...
Loading...
Self-evolving Polymarket trading bot. Design strategy with user, run paper trading, auto-improve until edge target met, then ask to switch to live.
npx skill4agent add storyclaw-official/talenthub storyclaw-polymarket-tradingcredentials/{USER_ID}.json{
"private_key": "0x...",
"funder_address": "0x...",
"dry_run": true
}USER_IDTELEGRAM_USER_IDPOLYMARKET_PRIVATE_KEYUSER_ID=$TELEGRAM_USER_ID python3 {baseDir}/scripts/polymarket.py checkUSER_ID=$TELEGRAM_USER_ID python3 {baseDir}/scripts/polymarket.py setupUSER_ID=$TELEGRAM_USER_ID python3 {baseDir}/scripts/strategy_manager.py create --json '{
"name": "<strategy name>",
"market_filter": {
"keywords": ["<keywords>"],
"min_liquidity_usdc": 1000,
"max_days_to_expiry": 30,
"min_days_to_expiry": 1
},
"signal": {
"method": "orderbook_imbalance",
"params": { "threshold": 0.15, "max_entry_price": 0.60 }
},
"sizing": { "max_size_usdc": 5 },
"targets": { "min_sample_size": 30, "min_edge": 0.05 }
}'SKILL_PATH={baseDir}
STRATEGY_ID=<id from step 4>
# Signal scan: every 15 minutes
(crontab -l 2>/dev/null; echo "*/15 * * * * USER_ID=$TELEGRAM_USER_ID python3 $SKILL_PATH/scripts/signal_cron.py $STRATEGY_ID >> $SKILL_PATH/state/$TELEGRAM_USER_ID.$STRATEGY_ID.log 2>&1") | crontab -
# Performance review: daily at 09:00 UTC
(crontab -l 2>/dev/null; echo "0 9 * * * USER_ID=$TELEGRAM_USER_ID python3 $SKILL_PATH/scripts/review_cron.py $STRATEGY_ID >> $SKILL_PATH/state/$TELEGRAM_USER_ID.review.log 2>&1") | crontab -dry_run → improving → pending_live → liveedge = win_rate - avg_entry_price >= min_edgetotal_pnl > 0USER_ID=$TELEGRAM_USER_ID python3 {baseDir}/scripts/strategy_manager.py status
USER_ID=$TELEGRAM_USER_ID python3 {baseDir}/scripts/strategy_manager.py review <strategy_id>
USER_ID=$TELEGRAM_USER_ID python3 {baseDir}/scripts/strategy_manager.py activate-live <strategy_id>| Condition | Action |
|---|---|
| edge < min_edge - 10% | Raise threshold (fewer but stronger signals) |
| edge < min_edge - 3% | Lower max_entry_price (cheaper entries) |
| 3+ adjustments still failing | Notify user to reconsider |
| edge >= min_edge AND pnl > 0 | Mark pending_live, notify user |
| Method | Best for |
|---|---|
| orderbook_imbalance | Any liquid market with active orderbook |
scripts/signals.py| Error | Solution |
|---|---|
| py-clob-client not installed | |
| USER_ID not set | Add |
| No config found | Run |
| API Error 401 | Re-run setup to re-derive keys |
| No markets found | Broaden keywords or lower min_liquidity_usdc |
polymarket-trading/
├── SKILL.md
├── scripts/
│ ├── strategy_manager.py # Lifecycle: create/review/status/activate-live
│ ├── signal_cron.py # Cron: scan markets, run signals, record trades
│ ├── review_cron.py # Cron: daily review + auto-improve
│ ├── signals.py # Pluggable signal methods
│ ├── market_scanner.py # Gamma API market discovery
│ └── polymarket.py # CLOB API primitives
├── credentials/
│ └── {USER_ID}.json
├── strategies/
│ └── {USER_ID}/{strategy_id}.json
└── state/
└── {USER_ID}.{strategy_id}.perf.json