SuperAPI AI Directory

polymarket-openclaw-trader

Agents & models

View repository

Updated 10-16 03:09

About this skill

Polymarket + OpenClaw Automated Trading (Publishable General Version)

0) Prerequisites (Check First)

  • Python 3.10+
  • A usable Polymarket project directory (including cli_bot.py / web_app.py)
  • Have a legally tradable region (otherwise geoblock will be triggered)
  • Only write the private key when the user explicitly authorizes it

First confirm the project path (do not hardcode an absolute path):

pwd
ls -la

If the user has not provided a path, ask and agree on one:<PROJECT_DIR>。

Subsequent commands are all based on:

cd <PROJECT_DIR>

1) Initialize Configuration (Sensitive Information Only Goes into .env)

Required items:

  • POLYMARKET_PRIVATE_KEY
  • POLYMARKET_WALLET_ADDRESS
  • EXECUTION_MODE=paper|live
  • AUTO_TRADE=true|false
  • LIVE_MAX_ORDERS_PER_DAY=<int>

Optional:

  • POLYMARKET_FUNDER
  • DISCORD_WEBHOOK_URL
  • POLYMARKET_HOST
  • POLYMARKET_CHAIN_ID
  • POLYMARKET_SIGNATURE_TYPE

Requirements:

  • It is forbidden to write the private key into code or logs
  • When replying externally, the private key may only be shown as "configured/not configured"; the original text must not be echoed

2) Start/Stop and Inspection

Start:

nohup env PYTHONUNBUFFERED=1 python3 cli_bot.py loop > logs/runner_v2.log 2>&1 < /dev/null &

Inspection:

ps -ef | grep 'python3 cli_bot.py loop' | grep -v grep
tail -n 120 logs/runner_v2.log

If the process is not running: automatically restart and verify again.


3) Strategy Parameters (Non-Sensitive, Recommended to Be Adjustable via Panel/Runtime)

Prefer writing to runtime/settings.json:

  • price_move_threshold_pct
  • volume_spike_multiple
  • signal_score_threshold
  • poll_interval_sec
  • status_every_minutes

Restart the strategy process after modification.


4) Reporting Standards (Must Be Truthful)

Reporting should prioritize real sources:

  • Real positions, position value, unrealized PnL (wallet query)
  • Bot ledger fields (such as dailyPnlUsd/openMarkets) must be clearly labeled as "bot ledger"

It is forbidden to disguise estimated balances as real account balances.


5) Order Execution Specifications

Check in sequence before execution:

  1. Private key is configured
  2. Market and token id can be resolved
  3. Risk control thresholds pass
  4. Execute order placement
  5. Return the complete result (success receipt or failure reason)

If geoblock / region restriction is returned:

  • Immediately stop trading attempts
  • Clearly inform about compliance restrictions
  • Do not provide methods to bypass regional restrictions

6) Web Console and Deployment

Local:

python3 web_app.py

Vercel:

vercel --prod --yes

If the Flask entry point reports an error, check whether app.py exists and its content is:

from web_app import app

7) Persistence and Delivery

After each key change:

  1. Update the project memory file (if the workspace has a MEMORY system)
  2. git add/commit commit
  3. If the user requests it, package the skill:
python3 <skill_creator_scripts>/package_skill.py <skill_dir> <out_dir>

8) Minimal Startup Instruction Template for End Users

cd <PROJECT_DIR>
python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# 填写必要环境变量后
nohup env PYTHONUNBUFFERED=1 python3 cli_bot.py loop > logs/runner_v2.log 2>&1 < /dev/null &