Polymarket Optimizer

v1.0.0

Automatic parameter optimizer for polymarket-executor. Reads performance_metrics.json every 6 hours, analyzes win rates and P&L per strategy, adjusts learned...

0· 277·0 current·0 all-time
byWesley Armando@georges91560
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
medium confidence
Purpose & Capability
Name/description match what the code and SKILL.md do: read workspace metrics, analyze strategies, and write learned_config.json and optimizer_log.jsonl. Required binary (python3) and optional TELEGRAM/WORKSPACE envs are consistent with purpose.
Instruction Scope
Runtime instructions and code limit actions to workspace files (performance_metrics.json, paper_trades.json, portfolio.json, live_trades.jsonl) and local logs; Telegram messages are optional. Documentation includes systemd/cron guidance that suggests running docker exec or loading a shared .env — following those instructions without care could expose unrelated environment variables or grant broad host-level execution privileges, so treat the docs as higher-risk operational guidance rather than a property of the skill itself.
Install Mechanism
No install spec (instruction-only with an included Python script). No remote downloads or package installs are present in the bundle; risk from install mechanism is low.
Credentials
The skill declares no required secrets and only optionally uses TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID, and WORKSPACE. That is proportionate. However, the provided systemd docs advise loading a global .env (EnvironmentFile) and running as root/docker exec; if you follow that, unrelated secrets in that .env could be exposed to the process—limit the environment to only the variables this skill needs.
Persistence & Privilege
always is false and the skill is user-invocable. It does not request persistent elevated platform privileges. The systemd docs propose running as root and using docker exec (operational recommendation) — this is optional and not required by the skill, but follow-up caution is advised if you adopt those instructions.
Assessment
This skill appears to do what it says: read local executor metrics, compute adjustments, write learned_config.json, and optionally post Telegram reports. Before installing: (1) review the full Python source (the file was truncated in the bundle listing) to confirm there are no additional network endpoints or hidden behaviors, (2) run it in a staging environment against sample metrics to validate logic and prevent bad allocations, (3) avoid loading a shared .env containing other service credentials—only provide TELEGRAM_* and WORKSPACE if needed, (4) prefer running under a dedicated, non-root user or inside the OpenClaw container rather than enabling the root systemd example, and (5) lock down file permissions on the WORKSPACE so the optimizer can only access intended files. If you want higher assurance, request the full untruncated source for a complete audit or run the script under a network-restricted environment to confirm it only contacts api.telegram.org when tokens are set.

Like a lobster shell, security has layers — review code before you run it.

Runtime requirements

🧠 Clawdis
Binspython3
latestvk972vnyp95857mbeg9kgkagwqx82bp88
277downloads
0stars
1versions
Updated 1mo ago
v1.0.0
MIT-0

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
  • paper_trades.json — all simulated trade records
  • portfolio.json — capital, positions, daily P&L

Output files (read by executor at next startup):

  • learned_config.json — updated thresholds, Kelly fraction, allocations
  • optimizer_log.jsonl — full history of every optimization run

⚡ QUICK START

cd /data/.openclaw/workspace/skills/polymarket-optimizer
python3 polymarket_optimizer.py

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
PoorReduce allocation (min 5–10%)
ExcellentIncrease allocation (max 50–70%)

Allocations always normalized to sum to 100%.

Kelly Fraction

Portfolio healthAction
Critical (return < -10%)Reduce Kelly → smaller positions
Excellent (return > 10%, WR > 65%)Increase Kelly → larger positions

Scan Frequency

ConditionAction
WR > 80% + 20+ tradesScan faster (min 120s)
Portfolio warning/criticalScan slower (max 600s)

📊 LIVE READINESS ASSESSMENT

Every run evaluates whether paper trading results justify going live.

4 criteria must ALL pass:

CriterionThreshold
Resolved trades≥ 30
Win rate≥ 55%
Total P&LPositive
Circuit breakerNot active

Telegram report includes readiness status automatically.


📱 TELEGRAM REPORT

🧠 POLYMARKET OPTIMIZER REPORT
🕐 2026-03-05 14:00 UTC
🔄 Optimization #4

Portfolio Health: 🟢 HEALTHY
💰 Capital: $108.45
📈 Return: 8.5%
🎯 Win Rate: 76.9%
📊 Total Trades: 20

Strategy Performance:
  🚀 parity_arbitrage: 100.0% WR | 8 trades | P&L: +0.523
  ✅ tail_end: 75.0% WR | 12 trades | P&L: +0.312

Adjustments Made:
  🚀 parity_arb excellent → min_profit 0.020 → 0.015
  📈 parity_arb allocation 30% → 40%
  ⚖️ Allocations renormalized

Live Trading Readiness:
🔴 NOT YET READY
  ❌ Need 30+ resolved trades
  📊 Progress: 20/30 trades
  🎯 Win rate: 76.9% (need 55%+) ✅

📁 FILES

FileLocationDescription
polymarket_optimizer.pyskills/polymarket-optimizer/Main optimizer script
learned_config.jsonWORKSPACE/Output — read by executor
optimizer_log.jsonlWORKSPACE/Full optimization history

⏰ CRON JOB

Add to OpenClaw cron configuration:

# Run optimizer every 6 hours
0 */6 * * * docker exec openclaw-yyvg-openclaw-1 python3 /data/.openclaw/workspace/skills/polymarket-optimizer/polymarket_optimizer.py

Version: 1.0.0 | License: MIT | Author: Georges Andronescu (Wesley Armando)

Comments

Loading comments...