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.
Pro Feature. Requires a Pro or Ultra subscription. Get started at api.mathematicalcompany.com
Multi-Outcome Arbitrage
When an event has N outcomes (e.g., 4 candidates in an election), the sum of all YES prices should equal $1.00. If it doesn’t, there’s an arbitrage opportunity.How It Works
- Sum < $1.00 - fees: Buy all outcomes. One will resolve to $1.00, so you profit the difference.
- Sum > $1.00 + fees: Sell all outcomes (buy all NOs). You collect more than $1.00 upfront.
Engine Methods
scan_event_arb
execute_event_arb
proportional=True: cheaper outcomes get more contracts so cost is balanced across legs.
Pipeline: event_arb_scanner
| Parameter | Type | Default | Description |
|---|---|---|---|
event_id | str | required | Registered event ID |
min_edge | float | 0.01 | Minimum net edge |
max_size | float | 50.0 | Maximum total size |
fee_rate | float | 0.002 | Fee rate per outcome |
auto_execute | bool | False | Auto-execute |
cooldown | float | 10.0 | Seconds between executions |
proportional | bool | True | Inverse-proportional sizing |
EventArbitrageOpportunity in ctx.params["last_event_arb"].
One-Shot: event_arb_sweep
EventArbResult or None.
EventArbResult
| Field | Type | Description |
|---|---|---|
event_id | str | Event identifier |
direction | str | "buy_all" or "sell_all" |
price_sum | float | Sum of all outcome prices |
net_edge | float | Edge after fees |
size | float | Trade size |
order_ids | list[str] | Order IDs for each leg |
timestamp | float | Execution timestamp |
Register events with
engine.register_event(event_id, market_ids) before scanning. Each market needs a corresponding feed for price data.Logical Arb Scanners
Beyond price-sum arbitrage, Horizon detects logical relationship violations between related markets.hz.implication_arb_scanner
For markets where A implies B (e.g., “Biden wins” implies “Democrat wins”), the price of A must be less than or equal to the price of B. Violations are arbs.| Parameter | Type | Description |
|---|---|---|
markets | list[str] | Market IDs to monitor |
implications | list[tuple[str, str]] | (A, B) pairs where A implies B |
min_edge | float | Minimum price violation to flag (default 0.01) |
hz.contradiction_arb_scanner
For mutually exclusive markets (e.g., “Trump wins” and “Biden wins”), the sum of prices must be at most 1.0. IfP(A) + P(B) > 1, sell both.
| Parameter | Type | Description |
|---|---|---|
markets | list[str] | Market IDs to monitor |
contradictions | list[tuple[str, str]] | (A, B) pairs that are mutually exclusive |
min_edge | float | Minimum sum violation above 1.0 to flag (default 0.01) |