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

# Risk Budgeting

> Fund-level VaR budgets, cross-strategy correlation, and dynamic risk allocation.

Risk Budgeting goes beyond per-strategy `RiskConfig` and per-order compliance limits. It manages risk at the fund level, allocating a total risk budget across strategies and dynamically rebalancing as conditions change. The fund-level risk layer is fully operational.

## Why It's Needed

Per-strategy risk management has blind spots:

* **Strategy A** and **Strategy B** might both be long on the same thesis
* Each passes its own limits, but together they create concentrated risk
* A fund-wide drawdown can happen even if no single strategy breaches its limits
* Capital allocation should be proportional to expected risk-adjusted return

## Risk Budget Architecture

<CardGroup cols={2}>
  <Card title="Strategy A -- 30%" icon="chart-simple">
    **Used:** 22% • **Available:** 8%
  </Card>

  <Card title="Strategy B -- 25%" icon="chart-simple">
    **Used:** 25% (at limit) • **Available:** 0%
  </Card>

  <Card title="Strategy C -- 20%" icon="chart-simple">
    **Used:** 10% • **Available:** 10%
  </Card>

  <Card title="Reserve -- 25%" icon="vault">
    Unallocated budget held for new opportunities.
  </Card>
</CardGroup>

The total fund VaR budget is split across strategies. Each strategy draws from its allocation as it takes positions. When a strategy hits its limit, it cannot add risk without reallocation.

## Components

### VaR Budget Allocation

```python theme={null}
# Configure VaR budget
risk_budget = RiskBudget(
    total_var=50_000,  # Max daily VaR for the fund
    allocation={
        "mm_strategy": 0.30,
        "arb_strategy": 0.25,
        "directional": 0.20,
    },
    reserve=0.25,  # Kept for new strategies
)
```

### Dynamic Reallocation

| Condition                                  | Action                                    |
| ------------------------------------------ | ----------------------------------------- |
| Strategy using \< 50% of budget for 7 days | Shrink allocation, expand reserve         |
| Strategy consistently at budget limit      | Consider increasing if Sharpe > threshold |
| New high-conviction opportunity            | Allocate from reserve                     |
| Correlation spike between strategies       | Reduce combined allocation                |

### Marginal Risk Contribution

Before adding a new strategy, compute how much risk it adds to the fund:

```python theme={null}
# Compute marginal risk contribution
marginal = risk_budget.marginal_contribution(
    new_strategy="crypto_mm",
    expected_returns=[0.01, -0.005, 0.02, ...],
    existing_correlations=fund.correlation_matrix(),
)
# {"var_increase": 2500, "diversification_benefit": -800, "net_contribution": 1700}
```

## Fund-Wide Risk Controls

| Control                    | Description                                    |
| -------------------------- | ---------------------------------------------- |
| **Daily drawdown limit**   | If fund is down > X% today, halt new positions |
| **Weekly drawdown limit**  | Reduce all exposure by 50% if weekly loss > Y% |
| **Monthly drawdown limit** | Activate kill switch if monthly loss > Z%      |
| **Gross exposure limit**   | Total notional across all strategies \< max    |
| **Net exposure limit**     | Net directional exposure \< max                |
| **Sector concentration**   | Max % in any one market category               |
| **Exchange concentration** | Max % on any single exchange                   |
| **Liquidity coverage**     | Must be able to liquidate 80% within 4 hours   |

## Stress Testing at Fund Level

Existing stress tests (`stress_test()`) work per-strategy. Fund-level stress applies scenarios across all strategies simultaneously:

```python theme={null}
# Run fund-level stress tests
results = fund_stress_test(
    fund=fund,
    scenarios=[
        AllMarketsDown(magnitude=0.20),
        CorrelationSpike(rho=0.90),
        ExchangeOutage(exchange="polymarket", duration_hours=4),
        LiquidityCrisis(depth_reduction=0.80),
    ],
)
```

## MCP Tools

| Tool                 | Description                               |
| -------------------- | ----------------------------------------- |
| `risk_dashboard`     | Current VaR usage, limits, stress results |
| `risk_budget_status` | Per-strategy budget utilization           |
| `stress_test_fund`   | Run fund-level stress scenarios           |
| `correlation_matrix` | Cross-strategy correlation heatmap        |
