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_KEYPOLYMARKET_WALLET_ADDRESSEXECUTION_MODE=paper|liveAUTO_TRADE=true|falseLIVE_MAX_ORDERS_PER_DAY=<int>
Optional:
POLYMARKET_FUNDERDISCORD_WEBHOOK_URLPOLYMARKET_HOSTPOLYMARKET_CHAIN_IDPOLYMARKET_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_pctvolume_spike_multiplesignal_score_thresholdpoll_interval_secstatus_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:
- Private key is configured
- Market and token id can be resolved
- Risk control thresholds pass
- Execute order placement
- 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:
- Update the project memory file (if the workspace has a MEMORY system)
git add/commitcommit- 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 &