All PolyClaw Trading configuration is environment-driven. There are no config files, no registry entries, and no hard-coded defaults that silently override your intent. Every tunable parameter — from wallet credentials to risk caps to LLM timeouts — is read from the process environment at startup, validated strictly, and never echoed or logged.Documentation 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.
.env.local is gitignored by design and must never be committed. It is the only place secrets should live. If you accidentally commit credentials, rotate them immediately and run uv run python run_pipeline.py audit to confirm the secret scanner test passes.Getting started
The repository ships.env.example as the exhaustive, up-to-date template. Copy it to .env.local and fill in only the values you need:
env_local.py, which exposes two functions:
load_env_file(path)— parses the file and returns a dictionary of key/value pairs.inject_into_environment(mapping)— writes parsed values into the process environment without echoing or logging any value.
tests/test_secret_scanner.py) fails the CI build if any secret-like pattern appears in tracked files.
Variable groups
Wallet & API keys
Wallet & API keys
These variables authenticate the system against Polymarket and your blockchain node. Leave them blank to run in dry-run mode with no on-chain activity.
| Variable | Default | Purpose |
|---|---|---|
POLYMARKET_WALLET_ADDRESS | (empty) | EVM wallet address used to own positions |
POLYCLAW_PRIVATE_KEY | (empty) | Private key for signing PolyClaw CLI transactions |
CHAINSTACK_NODE | (empty) | RPC endpoint for on-chain reads (Chainstack or equivalent) |
POLYCLAW_PATH must point to the PolyClaw CLI executable. The legacy spelling POCLAW_PATH is accepted as a backward-compatible alias; if both are set, POLYCLAW_PATH takes precedence.LLM providers
LLM providers
PolyClaw Trading supports four cloud LLM providers plus a local Ollama-compatible endpoint. You only need API keys for the providers you actually use. See LLM Orchestration for per-role model assignment.
| Variable | Purpose |
|---|---|
OPENROUTER_API_KEY | OpenRouter multi-provider gateway key |
OPENROUTER_BASE_URL | Override OpenRouter base URL (optional) |
OPENAI_API_KEY | OpenAI or OpenAI-compatible (e.g. local Ollama) key |
OPENAI_BASE_URL | Override OpenAI base URL; also used for local Qwen/Ollama |
ANTHROPIC_API_KEY | Anthropic Claude API key |
ANTHROPIC_BASE_URL | Override Anthropic base URL (e.g. Tokenator gateway) |
GEMINI_API_KEY | Google Gemini API key |
ANTHROPIC_VERSION | Anthropic API version header (default: 2023-06-01) |
Safety gates
Safety gates
These three boolean flags are the primary safety controls. All default to
The
0 (off). Set them explicitly in .env.local; do not rely on unset being equivalent to 0 in production.| Variable | Default | Purpose |
|---|---|---|
LIVE_TRADING | 0 | Hard execution gate: 0 = dry-run only, 1 = send real orders via PolyClaw |
ALLOW_REDEEM | 0 | Automatic redemption of resolved positions (opt-in) |
PANIC_STOP | 0 | Immediately halts all trade-gate execution when set to 1 |
PANIC_STOP flag is also tripped automatically when runtime/panic_stop.flag exists on disk — which is created after PANIC_AUTO_THRESHOLD consecutive failed live orders (default 5). Set PANIC_AUTO_THRESHOLD=0 to disable the automatic circuit breaker entirely.Bankroll
Bankroll
Both
All per-trade and daily risk variables are expressed as percentages of this bankroll.
BANK_USD and BANKROLL_USD represent the initial trading bankroll in USD. BANKROLL_USD takes precedence when both are set. Defaults to 100 if neither is provided.| Variable | Default | Purpose |
|---|---|---|
BANK_USD | 100 | Initial bankroll (legacy name) |
BANKROLL_USD | 100 | Initial bankroll (preferred; overrides BANK_USD if present) |
Integrations
Integrations
| Variable | Default | Purpose |
|---|---|---|
HTTPS_PROXY | (empty) | Optional HTTP/S proxy for all outbound calls (LLM APIs, market data) |
HTTP_TIMEOUT_SEC | 20 | Timeout in seconds for all outbound HTTP requests (market data, price history) |
CLOB_MAX_RETRIES | 10 | Maximum retry attempts for CLOB API requests before the call is abandoned |
DASHBOARD_HOST | 127.0.0.1 | Mission Control dashboard bind address |
DASHBOARD_PORT | 8080 | Mission Control dashboard port |
DASHBOARD_AUTH_TOKEN | (empty) | Bearer / X-Auth-Token auth for non-loopback dashboard hosts |
TELEGRAM_BOT_TOKEN | (empty) | Telegram bot token for trade notifications |
TELEGRAM_CHAT_ID | (empty) | Destination chat ID for Telegram messages |
TELEGRAM_DELIVERY_ENABLED | 1 | Enable Telegram delivery when credentials are present |
TELEGRAM_DELIVERY_MIN_INTERVAL_SEC | 300 | Minimum seconds between Telegram messages |
OPENCLAW_GATEWAY_URL | (empty) | OpenClaw gateway URL |
OPENCLAW_GATEWAY_TOKEN | (empty) | Auth token for the OpenClaw gateway |
Key safety variables at a glance
The table below reproduces the quick-reference from the README with every variable that directly governs whether and how real money moves.| 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 | 0.25 | Minimum micro-order size in USD |
MAX_TRADE_USD | 1.00 | Maximum micro-order size in USD |
BASE_RISK_PER_TRADE_PCT | 1 | Per-trade risk as a percentage of bankroll |
MAX_DAILY_RISK_PCT | 8 | Daily risk cap as a percentage of bankroll |
MAX_OPEN_EXPOSURE_PCT | 20 | Working-bankroll open-exposure cap |
MAX_TRADES_PER_DAY | 6 | Maximum trade executions per calendar day |
MIN_MARKET_MINUTES_TO_EXPIRY | 30 | Skip markets within this many minutes of resolution |
FAILED_ORDER_COOLDOWN_SEC | 1800 | Pause after a failed live order (seconds) |
MIN_EXECUTION_CONFIDENCE | 0.72 | Minimum deterministic signal confidence required to trade |
Runtime directory
RUNTIME_DIR (default: runtime) sets the working state directory. All generated JSON files — candles, decisions, bankroll state, ledgers — are written here. This directory is never a source of secrets and can be freely committed or inspected.