analyze_risk
Calculate portfolio Value-at-Risk and Conditional VaR from historical asset returns, accounting for cross-asset correlation. Ideal for risk attribution and regulatory capital sizing.
Instructions
[Premium] Compute portfolio Value-at-Risk (VaR) and Conditional VaR (Expected Shortfall) from historical asset return series, accounting for cross-asset correlation. Use for portfolio risk attribution, regulatory capital sizing, drawdown scenario analysis. Returns are matrix [asset][time] of period returns. For simulating outcomes from a parametric distribution rather than historical data, use simulate_montecarlo. Requires ORACLAW_API_KEY.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| returns | Yes | [asset][time] matrix of period returns (e.g. daily). Each row same length. | |
| weights | Yes | Portfolio weights per asset. Length must equal returns.length. Should sum to 1. | |
| confidence | No | VaR confidence level (default: 0.95). | |
| horizonDays | No | Horizon in days, scales VaR by sqrt(horizon) (default: 1). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| var | Yes | Value-at-Risk at the requested confidence (loss expressed as positive number). | |
| cvar | Yes | Conditional VaR (mean loss beyond VaR threshold). | |
| expectedReturn | Yes | ||
| volatility | Yes | ||
| confidence | No | ||
| horizonDays | No | ||
| assets | No |