Skip to main content
Pro Feature. Requires a Pro or Ultra subscription. Get started at api.mathematicalcompany.com

Cross-Exchange Arbitrage

Buy on one exchange where the price is low, sell on another where it’s high. Horizon’s executor handles both legs atomically with auto-rollback on failure.

How It Works

When the same market is priced differently across exchanges (e.g., Polymarket bid > Kalshi ask), you can buy on the cheap exchange and sell on the expensive one for risk-free profit.

Engine Methods

scan_arbitrage

The tuple format is (feed_name, exchange_name, fee_rate).

execute_arbitrage

Behavior:
  1. Both legs go through the full risk pipeline
  2. Orders use Fill-Or-Kill (FOK) time-in-force
  3. If the buy succeeds but the sell fails, the buy is automatically canceled
  4. Returns (buy_order_id, sell_order_id) on success

Pipeline: arb_scanner

Stores ArbResult in ctx.params["last_arb"] on execution.

One-Shot: arb_sweep

Returns ArbResult or None.

Example: Full Cross-Exchange Bot

Cross-exchange arb requires active accounts on both exchanges with sufficient margin. The atomic rollback only cancels the buy leg. It cannot guarantee cancel success if the order was already filled.