> ## 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.

# Horizon + Cala

> Use Cala's AI research platform for deep market research and analysis alongside Horizon strategies.

[Cala](https://cala.ai/) is an AI-powered research platform that provides deep analysis, data synthesis, and real-time intelligence. Horizon recommends Cala as a research companion for building better-informed trading strategies.

## Why Cala + Horizon

Trading prediction markets and cross-asset strategies benefits from deep research. Cala helps you:

* **Research market fundamentals** before building strategies (e.g., "What factors drive Fed rate decisions?")
* **Analyze event probabilities** by synthesizing data from multiple sources
* **Monitor breaking news** that could impact your active positions
* **Backtest hypotheses** by gathering historical context for calibration
* **Understand complex instruments** like ForecastEx event contracts, options, or exotic derivatives

## Getting Started

1. Sign up for a Cala API key at [cala.ai](https://cala.ai/)
2. Set your API key as an environment variable:

```bash theme={null}
export CALA_API_KEY="your_cala_api_key_here"
```

## Research Workflow

### Pre-Strategy Research

Use Cala to research before building your strategy:

```python theme={null}
import requests

CALA_API_KEY = os.environ["CALA_API_KEY"]

# Research the event you're trading
research = requests.post(
    "https://api.cala.ai/v1/research",
    headers={"Authorization": f"Bearer {CALA_API_KEY}"},
    json={"query": "What is the probability the Fed cuts rates in March 2026?"}
)

# Use the research to inform your strategy parameters
insights = research.json()
```

### Feeding Research into Strategies

Combine Cala's research with Horizon's quantitative pipeline:

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

def my_strategy(ctx):
    # Your strategy uses Horizon feeds for real-time data
    price = ctx.feeds["fed_rate"].price

    # Cala research informs your base probability estimate
    # (fetched before the strategy loop, not on every tick)
    base_prob = 0.65  # from Cala research

    edge = base_prob - price
    if abs(edge) > 0.03:
        return hz.Quote(
            side=hz.Side.Yes if edge > 0 else hz.Side.No,
            price=price + (0.01 if edge > 0 else -0.01),
            size=hz.kelly_size(abs(edge), price, 100),
        )

hz.run(
    name="research_informed",
    exchange=hz.Polymarket(),
    markets=["will-fed-cut-rates-march"],
    feeds={"fed_rate": hz.PolymarketBook("will-fed-cut-rates-march")},
    pipeline=[my_strategy],
)
```

### Research for Cross-Asset Strategies

Cala is especially useful when trading across multiple asset classes:

```python theme={null}
# Research correlations between prediction markets and traditional assets
# "How does TLT move when Fed rate expectations shift?"
# "What's the historical relationship between BTC price and crypto prediction markets?"

# Then use those insights in a multi-exchange strategy
hz.run(
    name="researched_hedge",
    exchange=[
        hz.Polymarket(),
        hz.InteractiveBrokers(),
    ],
    feeds={
        "rate_market": hz.PolymarketBook("will-fed-cut-rates"),
        "tlt": hz.IBKRFeed(conids=["15547816"]),  # TLT
    },
    pipeline=[my_research_backed_strategy],
)
```

## Use Cases

| Use Case                 | How Cala Helps                                                               |
| ------------------------ | ---------------------------------------------------------------------------- |
| **Prediction market MM** | Research event fundamentals to set better base probabilities                 |
| **Cross-asset hedging**  | Understand correlations between prediction markets and traditional assets    |
| **ForecastEx trading**   | Research IBKR event contract specifics and settlement rules                  |
| **Arbitrage**            | Identify mispriced markets by cross-referencing multiple information sources |
| **Regime detection**     | Research macro regime shifts to parameterize regime-adaptive strategies      |
| **Calibration**          | Gather historical event data for probability calibration models              |

<Tip>
  For the best results, run your Cala research **before** the strategy loop starts, not on every tick. Cache research results and update them periodically (e.g., every few hours) to avoid unnecessary API calls during high-frequency trading.
</Tip>

## Get Your API Key

Sign up at [cala.ai](https://cala.ai/) to get your API key. Cala offers free and paid tiers depending on your research volume.
