PolyClaw Trading is deliberately fail-closed: the system never places a real order unless you complete each step in this guide in order. The default configuration (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.
LIVE_TRADING=0) records every decision in daily ledgers so behavior is fully auditable before a single real dollar is at risk. Work through every step below before touching LIVE_TRADING=1.
Prerequisites checklist
Fund the wallet with only what you can afford to lose
Transfer only the amount you are genuinely prepared to lose entirely. PolyClaw micro-orders default to
MIN_TRADE_USD=0.25 and MAX_TRADE_USD=1.00, but the bankroll engine can execute up to MAX_TRADES_PER_DAY=6 per day and MAX_OPEN_EXPOSURE_PCT=20 of the working bankroll at once.Set BANK_USD and BANKROLL_USD in .env.local to match your actual funded balance before enabling live mode.Complete the manual PolyClaw wallet approval step
The PolyClaw CLI requires a one-time wallet approval on-chain before it can submit orders. Run the approval interactively (substitute your actual market ID and amount):This step is deliberately manual. The engine will not attempt to approve the wallet automatically. Until approval is confirmed, any live execution attempt will be rejected by the PolyClaw subprocess.
Verify the PolyClaw CLI is installed and configured
Confirm that the PolyClaw binary is installed and that The engine reads
POLYCLAW_PATH in .env.local points to it:POLYCLAW_PATH (or the backward-compatible alias POCLAW_PATH) at execution time. If the path is unset or the binary is missing, every live execution attempt will fail closed.Set rotated API keys in .env.local
Copy Minimum required secrets for live trading:The secret-scanner test (
.env.example to .env.local (which is gitignored) and fill in the secrets required for live trading. Never commit these values to version control.tests/test_secret_scanner.py) fails the build if secret-like patterns appear in any tracked file. Keep all keys in .env.local only.Run the full audit
Before any live pass, verify the engine and all safety contracts pass their tests:The audit runs the full
unittest suite covering deterministic boundaries, risk rules, contract validation, and execution safety. A failing audit must be resolved before proceeding.Run multiple dry-run passes and inspect the execution ledger
Run several complete dry-run cycles and inspect the daily execution ledger to confirm the engine is making sensible decisions on your markets and configuration:After each pass, inspect the daily execution ledger. The file is created whether trading is live or not:Dry-run executions are recorded with
"dry_run": true so the ledger is fully auditable before going live.Inspect decisions.json and bankroll_state.json
Verify that the engine is reading your bankroll correctly and that decisions look reasonable:Check that
equity_usd, working_bank_usd, and free_balance_usd in bankroll_state.json match your actual funded balance. Check that decisions in decisions.json have realistic confidence scores and correctly-sized amount_usd values relative to your bankroll.Set LIVE_TRADING=1 in .env.local
When you are satisfied with dry-run behavior, enable live trading by editing The
.env.local:dry-run mode of scripts/run_pipeline.py forcibly resets LIVE_TRADING to 0 and ALLOW_REDEEM to 0, even if .env.local says otherwise. To run live, use scripts/run_pipeline.py live --confirm-live or uv run python -m polyclaw_engine loop (which inherits the environment you have set).Optionally enable automatic redeem
If you want the engine to automatically redeem resolved markets, set:Like
LIVE_TRADING, this must be the exact string "1". Leave it at 0 if you prefer to redeem manually.What happens at live execution
Immediately before launching the PolyClaw subprocess, theexecute stage rereads the following state fresh from disk — it does not rely on values cached earlier in the same cycle:
- Bankroll state (
runtime/bankroll_state.json) - Risk gate state (
runtime/trade_gate_status.json) - Trade registry (open positions and daily counters)
- Market expiry and semantic mapping
- Pattern and quality scores
- Per-market cooldown status
Partial failure handling
The PolyClaw CLI performs two on-chain operations: a contract split and a CLOB sell. These can succeed and fail independently:- If the on-chain split succeeds but the CLOB sell fails, the engine records the outcome as
partial_failurein the execution ledger. - The affected market is reserved and a cooldown is activated (
FAILED_ORDER_COOLDOWN_SEC, default1800seconds). - The engine does not retry automatically. Inspect the ledger and resolve manually.
Offline fixtures are forbidden in live mode
The--fixture flag is accepted only by fetch, cycle, or loop and only when LIVE_TRADING=0. Attempting to use --fixture in live mode raises a ConfigError and blocks execution. This prevents accidentally trading against stale or fabricated market data.
Returning to dry-run
To stop live trading at any time:dry-run mode of the subprocess runner also hard-forces dry-run mode without requiring a file edit:
runtime/executions/ and are not deleted when you switch modes.