Tech/Trade Execution

Trade Execution

Automated order placement via Polymarket CLOB API

Polymarket CLOB API

Polymarket uses a Central Limit Order Book (CLOB) on the Polygon blockchain. The CLOB allows limit orders with specified prices and sizes. Orders are matched on-chain, providing transparent and verifiable execution. The API supports both market and limit order types.

py-clob-client Integration

The py-clob-client Python library handles authentication, order creation, and position management. It abstracts away the complexity of EIP-712 typed data signatures and Polygon transaction formatting. The client manages nonces, gas estimation, and order status polling automatically.

Signature type 1: proxy wallet (delegated signing)
neg_risk=True for weather markets (required for multi-outcome)
Automatic nonce management and retry logic
Position tracking via the API's portfolio endpoint

Order Flow

When a signal is detected, the system computes the Kelly-optimal position size, converts to CLOB order parameters (side, price, size), and submits a limit order at the current best price. BUY YES orders bet on the model's predicted bracket. BUY NO orders bet against brackets the model considers overpriced. A 2% fee is deducted from winning positions.

BUY YES: model_prob > market_price + 0.07
BUY NO: market_price > model_prob + 0.07
Position size: bankroll x kelly_fraction x 0.50
2% Polymarket fee on winning trades only