Skip to main content

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

AspectVirtual ModeLive Mode
Money at riskNone (simulated $1,000)Real funds
Order executionLocal ledgerPolymarket CLOB
Market dataReal prices from PolymarketReal prices from Polymarket
API surfaceFull HFT API v1Same endpoints
SettlementAutomatic on resolutionPolymarket blockchain
Live mode executes real trades with real money on Polymarket. Ensure your strategy is thoroughly tested in virtual mode before migrating.

Migration Steps

1

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
2

Get Polymarket API credentials

Obtain your Polymarket CLOB API credentials:
  • API Key
  • API Secret
  • API Passphrase
See Polymarket’s documentation for credential setup.
3

Update environment variables

Change only the environment variables — no code changes required:
# Before (virtual mode)
TRADING_MODE=virtual

# After (live mode)
TRADING_MODE=live
POLYMARKET_API_KEY=your_api_key
POLYMARKET_API_SECRET=your_api_secret
POLYMARKET_API_PASSPHRASE=your_api_passphrase
4

Use CLOB-compatible endpoint (optional)

For bots already targeting the Polymarket CLOB API, use the CLOB compatibility endpoint which mirrors Polymarket’s schema:
# PolySimulator CLOB-compat endpoint
POST /v1/clob-compat/order

# Same request body works on both:
{
  "token_id": "71321045...",
  "side": "BUY",
  "price": "0.50",
  "size": "10"
}
This means you can swap only the base URL to switch between virtual and live:
# Virtual
BASE_URL = "https://api.polysimulator.com"

# Live — same code, different URL
BASE_URL = "https://clob.polymarket.com"
5

Verify with small orders

Start with minimal order sizes to verify live execution:
# Start with quantity=1 to verify connectivity
place_order(market_id, "BUY", "Yes", quantity=1)

CLOB Compatibility Layer

The CLOB-compat endpoint translates between PolySimulator’s virtual ledger and Polymarket’s CLOB schema:
PolySimulator FieldCLOB FieldNotes
market_idtoken_idSame underlying identifier
sidesideBUY / SELL
quantitysizeString numeric
priceprice0–1 range
order_typetypemarket / limit / GTC / GTD

Rollback

To return to virtual mode:
TRADING_MODE=virtual
# Remove or comment out Polymarket credentials
# POLYMARKET_API_KEY=...
Restart the API server and your bot resumes paper trading with the simulated balance.

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