# Decimal-Exact Monte Carlo Tail Risk (VaR 99 & CVaR 99) API

- **Canonical HTML**: https://quantdesk.fastmesh.dev/seo_geo/decimal-exact-monte-carlo-tail-risk-var-99-cvar-99-api.html
- **Target Query**: `Decimal exact Monte Carlo VaR 99 CVaR 99 API` (`calculator`)
- **Source Family**: `ecb_fx` | **MCP Tool**: `quantdesk_risk_simulate` | **Pricing**: $0.05 per 10,000-trial Decimal tail audit ($0 on 422)
- **Seed**: `42` | **Trials**: `10000` | **Receipt SHA-256**: `02a4ee032256182ab84d0145cddf7ee6a2adc95f80afc1002fa449ed5b36c041`

## Direct Answer
Quantify extreme 1-in-100 tail losses (VaR 99 and CVaR 99 Expected Shortfall) using pure Python decimal.Decimal quantization and seeded jump-diffusion paths—eliminating IEEE-754 float drift and guaranteeing reproducible risk reporting across audit pipelines.

## 99% Expected Shortfall (CVaR 99) vs Gaussian VaR Under Tail Jumps
- Empirical VaR 99: var_99 = -R_(floor(0.01 * N)) across N = 10,000 sorted terminal return paths.
- Empirical CVaR 99 (Expected Shortfall): cvar_99 = -(1 / k) * sum_{i=1..k}(R_(i)) over the worst 1% tail (k = 100 paths for N = 10,000).
- Decimal Exact Serialization: Every quantile, drawdown, and capital figure is quantized via decimal.Decimal and mirrored verbatim inside decimal_exact.

## Deterministic 10,000-Trial Risk Metrics (Seed 42)
- P5 / P50 / P95 Return: -13.83% / +3.06% / +18.14%
- Mean / Std Return: +2.83% / 9.77%
- VaR 95 / CVaR 95: 13.83% / 20.07%
- VaR 99 / CVaR 99: 24.25% / 28.10%
- Max Drawdown (95th) / Ruin Probability: 16.45% / 0.03%
- Half-Kelly Cap: 25.00%
- Top Tornado Driver: `jump_severity` (swing 8.98%, variance share 58.9%)

## Key Engineering Capabilities
- Captures coherent tail risk (CVaR 99 >= VaR 99) where simple Gaussian VaR systematically understates binary event-driven losses.
- Runs 10,000 trials in sub-second latency with zero NumPy/SciPy native binary dependency drift.
- Outputs histogram_bins directly consumable by dashboards, SVG renderers, and risk alerts.

## Remote `/mcp` Invocation Example
```bash
curl -fsSL -X POST "https://quantdesk.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "quantdesk_risk_simulate", "arguments": {"expected_return": 0.04, "volatility": 0.28, "jump_prob": 0.07, "jump_mean": -0.2, "horizon_days": 21, "initial_capital": 1000000, "seed": 42, "trials": 10000}}}'
```

## Frequently Asked Questions
### Why is CVaR 99 (Expected Shortfall) superior to VaR 95 for catalyst trading?
VaR 95 only marks the 5th percentile boundary and ignores how catastrophic losses get beyond that line. CVaR 99 averages the worst 1% of jump-diffusion outcomes, exposing true binary-catalyst tail severity.

### Why use Python decimal.Decimal instead of raw float64?
Financial audit ledgers and deterministic SHA-256 receipts break when cross-platform float formatting shifts in the final decimal places. Quantizing into decimal_exact strings guarantees deterministic reconciliation.

### Can I run more than 10,000 trials?
Yes. The trials parameter accepts 100 to 100,000 deterministic seeded trials per request.

## Compliance & Zero-Resale Policy
Agent-WallStreet-Desk is a deterministic quantitative public-disclosure extraction and Monte Carlo risk modeling engineering tool only. It is NOT investment advice under the U.S. Investment Advisers Act of 1940, NOT a broker-dealer, and provides ZERO asset management, trade execution, or custody. 100% legal public regulatory disclosures and public market data only (zero MNPI, zero paywall bypass). Strictly $0 billed on empty, unchanged, fake-200, SSRF-blocked, or HTTP 422 responses. Zero client trading strategy, portfolio holdings, or watchlist retention or resale (zero_resale_policy: true). Support: support@fastmesh.dev.
