Virtual → Live Migration
PolySimulator is designed so your entire bot codebase works unchanged when switching from virtual (paper) trading to live (real-money) trading on Polymarket.Comparison
| Aspect | Virtual Mode | Live Mode |
|---|---|---|
| Money at risk | None (simulated $1,000) | Real funds |
| Order execution | Local ledger | Polymarket CLOB |
| Market data | Real prices from Polymarket | Real prices from Polymarket |
| API surface | Full HFT API v1 | CLOB trading API (different endpoint paths) |
| Settlement | Automatic on resolution | Polymarket blockchain |
Migration Steps
Test thoroughly in virtual mode
Run your bot through multiple market cycles. Verify:
- Order placement works correctly
- Error handling covers all edge cases
- P&L tracking is accurate
- WebSocket reconnection is stable
Get Polymarket API credentials
Polymarket uses two-layer authentication — both are required for live trading:L1 (wallet-level): Your Polygon wallet’s private key signs an EIP-712 message to derive L2 credentials. Each order also requires an EIP-712 signature from this key.L2 (API-level): HMAC credentials derived from L1 — used to authenticate all CLOB requests:See Polymarket’s authentication docs for full details.
- API Key (
POLY_API_KEY) - API Secret (used to generate
POLY_SIGNATURE) - API Passphrase (
POLY_PASSPHRASE)
- A Polygon wallet (MetaMask, Rabby, etc.) with a funded private key
- USDC.e tokens on Polygon for trading capital
- Token approval on the Polymarket Exchange contract
Update environment variables
Change your credentials and client configuration for live mode. Order payload
structure stays highly portable, but endpoint paths/auth handling differ:
There is no single
TRADING_MODE flag. Migration is achieved by switching
to Polymarket credentials/client setup and routing order placement through
Polymarket’s CLOB API flow.Use CLOB-compatible endpoint (recommended for migration)
The CLOB-compatible endpoint mirrors Polymarket’s real CLOB API schema.
Your bot code stays identical — only the base URL and auth header change:
Auth difference: PolySimulator uses
X-API-Key header.
Polymarket uses L2 HMAC headers (POLY_ADDRESS, POLY_SIGNATURE,
POLY_TIMESTAMP, POLY_API_KEY, POLY_PASSPHRASE) plus EIP-712
signing for each order. The Polymarket SDK handles the complexity —
only the client initialisation changes, not the order fields.CLOB Compatibility Layer
ThePOST /v1/clob/order endpoint accepts the same request body as Polymarket’s POST /order:
| Field | Type | Description |
|---|---|---|
token_id | string | CLOB outcome token ID |
side | string | BUY or SELL (uppercase) |
price | string | Limit price as decimal string (“0.01”–“0.99”) |
size | string | Number of shares as decimal string |
order_type | string | GTC (default), FOK, IOC, GTD |
Rollback
To return to virtual mode, change your bot’s environment variables back:Checklist
- Bot tested across multiple market scenarios in virtual mode
- Error handling verified (network errors, rate limits, slippage)
- Polymarket API credentials obtained and secured
- Environment variables updated
- Initial live test with minimal order size
- Monitoring and alerting configured for live trading