> ## Documentation Index
> Fetch the complete documentation index at: https://mathematicalcompany.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Arbitrage

> 8 arbitrage methods from basic parity to expert composite scanning, organized in tier progression.

<Note>
  **Pro Feature.** Requires a Pro or Ultra subscription. Latency Arb and Composite Scanner require Ultra. [Get started at api.mathematicalcompany.com](https://api.mathematicalcompany.com)
</Note>

# Arbitrage Methods

Horizon provides 8 arbitrage methods covering every exploitable inefficiency in prediction markets. Methods are organized in tiers from basic same-exchange parity to expert composite meta-scanning.

## Tier Progression

| Tier | Method                                              | What It Does                                | Tier Required |
| ---- | --------------------------------------------------- | ------------------------------------------- | ------------- |
| 1    | [Parity Arb](/arbitrage/parity)                     | YES + NO on same exchange \< \$1.00         | Pro           |
| 1    | [Cross-Exchange Arb](/arbitrage/cross-exchange)     | Buy low on exchange A, sell high on B       | Pro           |
| 2    | [Multi-Outcome Arb](/arbitrage/multi-outcome)       | N outcomes sum != \$1.00                    | Pro           |
| 2    | [Spread Convergence](/arbitrage/spread-convergence) | Mean-reversion between correlated markets   | Pro           |
| 3    | [Statistical Arb](/arbitrage/stat-arb)              | Cointegration-based pairs trading           | Pro           |
| 3    | [MM Arb](/arbitrage/mm-arb)                         | Quote on one exchange, hedge on another     | Pro           |
| 4    | [Latency Arb](/arbitrage/latency)                   | Fast feed detects moves before book updates | Ultra         |
| 4    | [Composite Scanner](/arbitrage/composite)           | Meta-scanner scoring all methods            | Ultra         |

## Which Method to Use

<CardGroup cols={2}>
  <Card title="Same-exchange mispricing?" icon="equals">
    Use **Parity Arb** - guaranteed profit when YES + NO asks sum to less than \$1.00.
  </Card>

  <Card title="Price differs across exchanges?" icon="arrows-split-up-and-left">
    Use **Cross-Exchange Arb** - buy on the cheap exchange, sell on the expensive one.
  </Card>

  <Card title="Multi-outcome event mispriced?" icon="chart-pie">
    Use **Multi-Outcome Arb** - buy or sell all outcomes when they don't sum to \$1.00.
  </Card>

  <Card title="Two markets move together?" icon="wave-sine">
    Use **Spread Convergence** (simple) or **Stat Arb** (rigorous) to trade mean-reversion.
  </Card>

  <Card title="Want to earn spread + hedge?" icon="scale-balanced">
    Use **MM Arb** - market-make on one exchange, hedge delta on another.
  </Card>

  <Card title="Want speed edge?" icon="bolt">
    Use **Latency Arb** - front-run slow book updates with fast external feeds.
  </Card>

  <Card title="Run everything at once?" icon="layer-group">
    Use **Composite Scanner** - scores all methods and routes capital to the best.
  </Card>
</CardGroup>

## Quick Start

```python theme={null}
import horizon as hz

# Tier 1: Parity arb - guaranteed profit
parity = hz.parity_arb_scanner(
    "election-winner",
    exchange="polymarket",
    feed_name="polymarket",
    auto_execute=True,
)

# Tier 1: Cross-exchange arb
cross = hz.arb_scanner(
    "election-winner",
    exchanges=["polymarket", "kalshi"],
    feed_map={"polymarket": "polymarket", "kalshi": "kalshi"},
    auto_execute=True,
)

# Tier 2: Spread convergence
spread = hz.spread_convergence(
    "gop-senate", "gop-house",
    "gop_senate_feed", "gop_house_feed",
    entry_zscore=2.0, auto_execute=True,
)

# Run all together
hz.run(
    name="arb_suite",
    exchanges=[
        hz.Polymarket(private_key="0x..."),
        hz.Kalshi(api_key="..."),
    ],
    markets=["election-winner"],
    feeds={
        "polymarket": hz.PolymarketBook("election-winner"),
        "kalshi": hz.KalshiBook("KXELECTION-25"),
        "gop_senate_feed": hz.PolymarketBook("gop-senate"),
        "gop_house_feed": hz.PolymarketBook("gop-house"),
    },
    pipeline=[parity, cross, spread],
    interval=0.5,
)
```

## Architecture

All arbitrage methods share:

* **Rust core** for detection (`src/parity.rs`) - branchless hot-path computation
* **Engine methods** for scanning and execution with atomic rollback
* **Python pipeline functions** compatible with `hz.run()`
* **Cooldown timers** to prevent over-trading
* **Result storage** in `ctx.params` for downstream inspection

The module is structured as a Python package (`horizon.arb`) with backward-compatible re-exports:

```python theme={null}
# All of these work:
from horizon import arb_scanner, parity_arb_scanner, stat_arb
from horizon.arb import arb_scanner, parity_arb_scanner
from horizon.arb._parity import parity_arb_scanner  # internal
```

<Warning>
  Arbitrage in live prediction markets involves real financial risk. Paper-test all strategies thoroughly before deploying with real capital. Atomic rollback cannot guarantee cancel success on live exchanges if orders were already filled.
</Warning>
