Polymarket Optimizer — Adaptive Parameter Tuner
🧠 WHAT IT DOES
Reads trading performance from polymarket-executor, analyzes what works, and adjusts parameters automatically.
Runs every 6 hours via OpenClaw cron job. Zero manual intervention required.
Input files (written by executor):
- -
performance_metrics.json — per-strategy win rates, P&L, trade counts - INLINECODE2 — all simulated trade records
- INLINECODE3 — capital, positions, daily P&L
Output files (read by executor at next startup):
- -
learned_config.json — updated thresholds, Kelly fraction, allocations - INLINECODE5 — full history of every optimization run
⚡ QUICK START
CODEBLOCK0
Expected output:
============================================================
POLYMARKET OPTIMIZER v1.0.0
Run time: 2026-03-05 14:00:00 UTC
============================================================
[CONFIG] Loaded. Optimization #1
[PORTFOLIO] Health: HEALTHY
[PORTFOLIO] Capital: $102.34 | Return: 2.3%
[ANALYSIS] parity_arbitrage: EXCELLENT | WR=100.0% | Trades=8 | P&L=+0.523
[ANALYSIS] tail_end: GOOD | WR=75.0% | Trades=12 | P&L=+0.312
[OPTIMIZER] 2 adjustments made:
🚀 parity_arb excellent → min_profit 0.020 → 0.015
📈 parity_arb allocation 30% → 40%
[READINESS] Resolved trades: 8/30
[READINESS] Win rate: 84.6% (need 55%+)
[TELEGRAM] Report sent.
============================================================
OPTIMIZER COMPLETE
============================================================
🔧 WHAT IT ADJUSTS
Strategy Thresholds
| If strategy is... | Action |
|---|
| Poor (WR < 50%) | Raise threshold → trade only best opportunities |
| Underperforming (WR 50–65%) |
Slight threshold increase |
| Average (WR 65–80%) | No change |
| Good (WR 65–80%, positive P&L) | No change |
| Excellent (WR > 80%) | Lower threshold → capture more volume |
Capital Allocation
| If strategy is... | Action |
|---|
| Poor | Reduce allocation (min 5–10%) |
| Excellent |
Increase allocation (max 50–70%) |
Allocations always normalized to sum to 100%.
Kelly Fraction
| Portfolio health | Action |
|---|
| Critical (return < -10%) | Reduce Kelly → smaller positions |
| Excellent (return > 10%, WR > 65%) |
Increase Kelly → larger positions |
Scan Frequency
| Condition | Action |
|---|
| WR > 80% + 20+ trades | Scan faster (min 120s) |
| Portfolio warning/critical |
Scan slower (max 600s) |
📊 LIVE READINESS ASSESSMENT
Every run evaluates whether paper trading results justify going live.
4 criteria must ALL pass:
| Criterion | Threshold |
|---|
| Resolved trades | ≥ 30 |
| Win rate |
≥ 55% |
| Total P&L | Positive |
| Circuit breaker | Not active |
Telegram report includes readiness status automatically.
📱 TELEGRAM REPORT
CODEBLOCK2
📁 FILES
| File | Location | Description |
|---|
| INLINECODE6 | INLINECODE7 | Main optimizer script |
| INLINECODE8 |
WORKSPACE/ | Output — read by executor |
|
optimizer_log.jsonl |
WORKSPACE/ | Full optimization history |
⏰ CRON JOB
Add to OpenClaw cron configuration:
CODEBLOCK3
Version: 1.0.0 |
License: MIT |
Author: Georges Andronescu (Wesley Armando)
Polymarket Optimizer — 自适应参数调优器
🧠 功能说明
读取来自 polymarket-executor 的交易表现数据,分析有效策略,并自动调整参数。
每 6 小时 通过 OpenClaw 定时任务运行一次,无需人工干预。
输入文件(由执行器写入):
- - performancemetrics.json — 各策略胜率、盈亏、交易数量
- papertrades.json — 所有模拟交易记录
- portfolio.json — 资金、持仓、每日盈亏
输出文件(执行器下次启动时读取):
- - learnedconfig.json — 更新后的阈值、凯利比例、资金分配
- optimizerlog.jsonl — 每次优化运行的完整历史记录
⚡ 快速启动
bash
cd /data/.openclaw/workspace/skills/polymarket-optimizer
python3 polymarket_optimizer.py
预期输出:
============================================================
POLYMARKET OPTIMIZER v1.0.0
运行时间:2026-03-05 14:00:00 UTC
============================================================
[配置] 已加载。优化 #1
[投资组合] 健康状态:健康
[投资组合] 资金:$102.34 | 收益率:2.3%
[分析] 套利策略:优秀 | 胜率=100.0% | 交易数=8 | 盈亏=+0.523
[分析] 长尾策略:良好 | 胜率=75.0% | 交易数=12 | 盈亏=+0.312
[优化器] 已进行 2 项调整:
🚀 套利策略表现优秀 → 最小利润 0.020 → 0.015
📈 套利策略资金分配 30% → 40%
[就绪状态] 已结算交易:8/30
[就绪状态] 胜率:84.6%(需达到 55%+)
[电报] 报告已发送。
============================================================
优化完成
============================================================
🔧 调整内容
策略阈值
| 策略表现 | 操作 |
|---|
| 差(胜率 < 50%) | 提高阈值 → 仅交易最佳机会 |
| 欠佳(胜率 50–65%) |
略微提高阈值 |
| 一般(胜率 65–80%) | 不做调整 |
| 良好(胜率 65–80%,盈利为正) | 不做调整 |
| 优秀(胜率 > 80%) | 降低阈值 → 捕捉更多交易量 |
资金分配
增加分配(最高 50–70%) |
所有分配始终归一化至总和为 100%。
凯利比例
| 投资组合健康状态 | 操作 |
|---|
| 危急(收益率 < -10%) | 降低凯利比例 → 更小仓位 |
| 优秀(收益率 > 10%,胜率 > 65%) |
提高凯利比例 → 更大仓位 |
扫描频率
| 条件 | 操作 |
|---|
| 胜率 > 80% + 20 笔以上交易 | 加快扫描(最低 120 秒) |
| 投资组合警告/危急 |
减慢扫描(最高 600 秒) |
📊 实盘就绪评估
每次运行评估模拟交易结果是否具备实盘条件。
4 项标准必须全部满足:
≥ 55% |
| 总盈亏 | 为正 |
| 断路器 | 未激活 |
电报报告自动包含就绪状态。
📱 电报报告
🧠 POLYMARKET OPTIMIZER 报告
🕐 2026-03-05 14:00 UTC
🔄 优化 #4
投资组合健康状态:🟢 健康
💰 资金:$108.45
📈 收益率:8.5%
🎯 胜率:76.9%
📊 总交易数:20
策略表现:
🚀 套利策略:100.0% 胜率 | 8 笔交易 | 盈亏:+0.523
✅ 长尾策略:75.0% 胜率 | 12 笔交易 | 盈亏:+0.312
已做调整:
🚀 套利策略表现优秀 → 最小利润 0.020 → 0.015
📈 套利策略资金分配 30% → 40%
⚖️ 分配已重新归一化
实盘交易就绪状态:
🔴 尚未就绪
❌ 需要 30+ 笔已结算交易
📊 进度:20/30 笔交易
🎯 胜率:76.9%(需达到 55%+)✅
📁 文件
| 文件 | 位置 | 描述 |
|---|
| polymarketoptimizer.py | skills/polymarket-optimizer/ | 主优化脚本 |
| learnedconfig.json |
WORKSPACE/ | 输出文件 — 由执行器读取 |
| optimizer_log.jsonl | WORKSPACE/ | 完整优化历史记录 |
⏰ 定时任务
添加到 OpenClaw 定时任务配置:
每 6 小时运行一次优化器
0
/6 docker exec openclaw-yyvg-openclaw-1 python3 /data/.openclaw/workspace/skills/polymarket-optimizer/polymarket_optimizer.py
版本: 1.0.0 |
许可证: MIT |
作者: Georges Andronescu (Wesley Armando)