Porting a Bot to Polymarket
PolySimulator only simulates trades, with virtual money. It does not place orders on Polymarket or on any other venue, and it has no live-trading mode. If you decide to trade on Polymarket, you do that with your own Polymarket account, your own wallet and your own code, which talks directly to Polymarket’s API. PolySimulator is not involved in those trades. This page shows what changes in a bot’s code when you port it from PolySimulator’s API to Polymarket’s.Comparison
Migration Steps
1
Test in PolySimulator
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
2
Get Polymarket API credentials
Polymarket uses two-layer authentication — both are required to trade on Polymarket: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
3
Update environment variables
Your ported bot needs Polymarket credentials and client configuration. Order payload
structure stays highly portable, but endpoint paths/auth handling differ:
PolySimulator has no live mode and no
TRADING_MODE switch. Porting means
your code uses Polymarket’s own client and credentials and sends its orders
to Polymarket’s CLOB API itself.4
Use CLOB-compatible endpoint (recommended for porting)
The CLOB-compatible endpoint takes the same order fields as Polymarket’s CLOB API,
so the order itself carries over. The client setup and authentication 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.5
Check your integration on Polymarket
These calls go to Polymarket and use real money from your wallet. Minimal order
sizes are enough to check that your integration works:
CLOB Compatibility Layer
ThePOST /v1/clob/order endpoint accepts the same request body as Polymarket’s POST /order:
See CLOB Compatibility for full schema details and response format.
Switching Back to PolySimulator
To go back to simulated trading, change your bot’s environment variables back:Checklist
- Bot tested across multiple market scenarios in PolySimulator
- Error handling verified (network errors, rate limits, slippage)
- Polymarket API credentials obtained and secured
- Environment variables updated
- First Polymarket orders placed at minimal size
- Monitoring and alerting configured for your Polymarket bot