Horizon supports trading on multiple exchanges simultaneously from a single strategy. This enables cross-exchange arbitrage, hedging, and diversified market making.Documentation Index
Fetch the complete documentation index at: https://mathematicalcompany.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Quick Start
How It Works
Register exchanges
The first exchange in the
exchanges list becomes the primary exchange (default for routing). Additional exchanges are added via add_exchange().Market resolution
Each market is resolved against the appropriate exchange. Markets with
exchange="polymarket" resolve via Gamma API, exchange="kalshi" resolve via ticker mapping.Order routing
Orders are routed to the correct exchange based on
market.exchange. The pipeline’s _process_result() reads market.exchange and passes it to submit_quotes().Engine API
Adding exchanges
Querying exchanges
Explicit routing
Netting Pairs
Netting pairs allow correlated positions across exchanges to offset for risk purposes. This reduces the effective portfolio notional when positions are hedged.Configuration
How Netting Works
For each netting pair (market_a, market_b):- Compute the absolute exposure for each market
- The hedged amount is
min(exposure_a, exposure_b) - Reduce the portfolio notional by
hedged * 0.5(prediction markets are 0-1 priced)
Example
If you hold:- 50 contracts on Polymarket
will-btc-hit-100k(exposure = 50) - 30 contracts on Kalshi
KXBTC-25FEB16(exposure = 30)
min(50, 30) = 30, reducing notional by 30 * 0.5 = 15.0. This allows larger total positions because 30 contracts are effectively hedged.
Cross-Exchange Strategy Pattern
Unified Position Tracking
ThePositionTracker maintains positions from all exchanges in a single map. Each position carries its exchange field: