Docker is the fastest way to run PolyClaw Trading without touching your local Python installation. The includedDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/deniszidbaev-cmyk/polyclaw-trading/llms.txt
Use this file to discover all available pages before exploring further.
Dockerfile and docker-compose.yml give you a reproducible, isolated environment that preserves every dry-run ledger and execution record in a bind-mounted ./runtime directory. The safety default (LIVE_TRADING=0) is unchanged inside Docker — the container never places a real order unless you explicitly opt in.
Prerequisites
- Docker and Docker Compose installed and running
- A copy of the repository cloned locally
- Your API keys and wallet address ready for
.env.local
How It Works
Dockerfile
The image is built frompython:3.12-slim and keeps the environment lean and deterministic:
run_pipeline.py and the default command is dry-run, so the container will never accidentally go live without an explicit override.
docker-compose.yml
The Compose file wires the build context, env file, command, and volume mount together:./runtime directory on your host is bind-mounted to /app/runtime inside the container, so all candle data, decisions, bankroll state, trade history, and execution ledgers persist across container restarts.
Quickstart
Copy and configure the environment file
Copy the example env file and fill in the values you need. Open
LIVE_TRADING defaults to 0 — leave it that way until you have validated behavior in dry-run mode..env.local in your editor and set at minimum:Build the image and start the pipeline
.env.local, and starts the dry-run pipeline. Runtime artifacts accumulate in ./runtime on your host.State Persistence
Theruntime/ directory is bind-mounted from host to container (./runtime:/app/runtime). Everything written by the pipeline — candle snapshots, trade decisions, the bankroll ledger, daily execution records — survives container restarts. The layout is:
| Path | Contents |
|---|---|
runtime/decisions.json | Latest trade decisions |
runtime/bankroll_state.json | Equity and risk limits |
runtime/trade_history.json | Full trade history |
runtime/open_positions_snapshot.json | Current open positions |
runtime/manual_review.json | Fallback when no usable candle feed |
runtime/executions/YYYYMMDD.json | Daily execution ledger |
Dashboard
The Mission Control dashboard is a Flask app (bot/dashboard/) that binds to loopback by default. To expose it outside the container, add a ports entry to docker-compose.yml and set DASHBOARD_PORT in .env.local (default 8080). Always set DASHBOARD_AUTH_TOKEN before exposing the dashboard outside localhost:
Environment Variables
All configuration is injected from.env.local via the env_file directive in docker-compose.yml. Key safety variables:
| Variable | Default | Purpose |
|---|---|---|
LIVE_TRADING | 0 | Hard gate: 0 logs orders, 1 sends them via PolyClaw |
ALLOW_REDEEM | 0 | Automatic redeem on resolved markets (opt-in) |
MIN_TRADE_USD / MAX_TRADE_USD | 0.25 / 1.00 | Micro-order size bounds |
BASE_RISK_PER_TRADE_PCT / MAX_DAILY_RISK_PCT | 1 / 8 | Per-trade and daily risk caps |
MAX_OPEN_EXPOSURE_PCT | 20 | Working-bankroll exposure cap |
MAX_TRADES_PER_DAY | 6 | Daily execution cap |
DASHBOARD_PORT | 8080 | Port the dashboard listens on |
DASHBOARD_AUTH_TOKEN | (unset) | Token required for dashboard access when set |
Enabling Live Mode
Docker does not change the safety model. Live mode requires the same explicit opt-in as any other deployment method: setLIVE_TRADING=1 in .env.local and complete the manual wallet approval step.
docker-compose.yml to pass the live command:
Stopping
./runtime and will be picked up automatically on the next docker compose up.