# Portfolio Stats – Value-at-Risk & Expected Shortfall

> Portfolio Stats – Value-at-Risk & Expected Shortfall is a paid API for AI agents from portfolio-stats.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-10-30).

Computes illustrative historical and parametric Value-at-Risk (VaR) and Expected Shortfall (CVaR) from a user-supplied price or return series.

## Facts

- Endpoint: GET https://portfolio-stats.x402tookit.com/value-at-risk?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-30
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/portfolio-stats-value-at-risk-expected-shortfall-1c581c48
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_6o8F5lQ37fVGJiAdOWPan

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability portfolio-stats-value-at-risk-expected-shortfall-1c581c48
```

Example prompt: Calculate the historical and parametric VaR plus expected shortfall for this daily price series [100,101,99.5,102,98,97,103,105,104,99], at 99% confidence, assuming 252 trading days per year, and express the loss in dollar terms for a $50,000 portfolio.

## When to prefer this

Choose this endpoint when you need a quick, illustrative VaR or Expected Shortfall figure from a raw price or return series you already have, without setting up a full risk analytics platform. It supports both historical simulation and parametric (Gaussian) methods in one call, optionally annualises results, and can express losses in monetary terms — making it ideal for lightweight portfolio risk checks, educational demonstrations, or automated report generation where regulatory-grade precision is not required.

## Known failure modes

- Missing both prices and returns — endpoint requires one of the two
- Fewer than ~20 data points may produce unreliable or degraded estimates flagged in the response
- confidencePct outside 90–99.9 range rejected or clamped
- Malformed JSON array in prices or returns parameter causes a parse error
- Conflicting prices and returns supplied simultaneously

## How this service works

ILLUSTRATIVE historical and parametric Value-at-Risk and expected shortfall from a return series you supply. Not advice.

## Output

Returns an object containing historical VaR and parametric VaR (both as fractions and percentages), expected shortfall, mean return, z-score, number of observations, horizon label, confidence level, optional dollar-denominated losses if portfolioValue was supplied, a plain-language summary, an educational disclaimer, and flags for any degraded or unchecked conditions.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [],
     "properties": {
      "unit": {
       "type": "string",
       "description": "decimal (default, 0.01 = 1%) or percent (1 = 1%); applies to returns only"
      },
      "prices": {
       "type": "string",
       "description": "Price series, oldest first, JSON like [100,101,99.5] or 100,101,99.5 (up to 1000). Give prices OR returns"
      },
      "returns": {
       "type": "string",
       "description": "Period returns, oldest first, decimals by default (0.01 = 1%). Give returns OR prices"
      },
      "confidencePct": {
       "type": "number",
       "description": "Confidence level in percent, 90 to 99.9 (default 95)"
      },
      "periodsPerYear": {
       "type": "integer",
       "description": "Periods per year for annualising: 252 daily (default), 52 weekly, 12 monthly"
      },
      "portfolioValue": {
       "type": "number",
       "description": "Optional amount to express the loss in money terms"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "zScore": {
       "type": [
        "null",
        "number"
       ]
      },
      "horizon": {
       "type": [
        "null",
        "string"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "disclaimer": {
       "type": [
        "null",
        "string"
       ]
      },
      "meanReturn": {
       "ty
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/portfolio-stats-value-at-risk-expected-shortfall-1c581c48/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from portfolio-stats.x402tookit.com](https://www.zero.xyz/host/portfolio-stats.x402tookit.com/llms.txt)
