# Animica Portfolio Risk Analytics API

> Animica Portfolio Risk Analytics API is a paid API for AI agents from animica.dev, paid per call via x402, $0.006/call, status unknown (last checked 2026-09-14).

Computes portfolio risk metrics (VaR, Expected Shortfall, correlations) for a multi-asset position set using historical returns or prices.

## Facts

- Endpoint: POST https://animica.dev/x402/alpha/risk
- Price: $0.006/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/animica-portfolio-risk-analytics-api-53f0d05c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_mTVRfuorkGteXF0eK0T1A

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 animica-portfolio-risk-analytics-api-53f0d05c -d '<json body>'
```

Example prompt: Analyze the risk of my portfolio: BTC at 60% weight with 252 daily returns [0.01, -0.02, ...], ETH at 40% weight with matching returns, using a 0.95 confidence level, 252 periods per year, and a total book value of $500,000 — give me the VaR and Expected Shortfall in dollars.

## When to prefer this

Choose this endpoint when you need on-demand, quantitative portfolio risk metrics (VaR, ES, correlations) for up to 64 named positions without standing up your own risk infrastructure. It is particularly suited for AI agents that need to embed risk analysis in automated workflows, support multi-asset books including shorts, and require dollar-denominated risk figures with provenance timestamps. Prefer it over generic statistics APIs when the specific financial risk framing (VaR, ES, annualisation) and multi-position correlation output are needed.

## Known failure modes

- Misaligned return series (different lengths or periods) result in meaningless correlations — API requires all series to cover the same periods
- Fewer than 20 observations per position triggers rejection or unreliable estimates
- Confidence level at or above 1.0 or at or below 0.0 is invalid
- Missing periods_per_year means no annualisation is returned — not an error but a silent omission
- 99% confidence level with short series produces statistically unreliable results
- Malformed position weights or missing returns/prices fields cause schema validation errors

## How this service works

Animica Python Cloud: deploy a Python function to animica.dev, get a public endpoint, and earn ANM every time someone runs it. Free AI (OpenAI-compatible, no key), free scheduled Workers, and an 80/20 developer split.

## Output

Returns a JSON object containing Value at Risk (VaR) and Expected Shortfall (ES) at the requested confidence level, correlation matrix across positions, annualised risk statistics (when periods_per_year is supplied), dollar-denominated risk figures (when portfolio_value_usd is provided), and provenance metadata including the data_timestamp so the agent can assess how current the analysis is.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "positions": {
   "type": "object",
   "description": "up to 64 positions keyed by name: {\"BTC\": {\"weight\": 0.6, \"returns\": [...]}}. Supply either returns[] (simple, oldest first) or prices[] and we derive them. At least 20 observations per position, and every series must cover the SAME periods — misaligned series make every correlation meaningless. Negative weight is a short."
  },
  "confidence": {
   "type": "number",
   "description": "VaR/ES confidence level in (0,1), default 0.95. 0.99 needs a longer series to mean anything."
  },
  "data_timestamp": {
   "type": "string",
   "description": "ISO timestamp of the most recent observation. Carried through to provenance so an agent can judge how old the analysis is."
  },
  "periods_per_year": {
   "type": "integer",
   "description": "periods per year for annualisation (252 daily, 8760 hourly, 52 weekly). Omit it and nothing is annualised — we do not guess the frequency of a series we did not collect, because a daily series annualised as hourly is wrong by about 5x and looks plausible."
  },
  "portfolio_value_usd": {
   "type": "number",
   "description": "total book value; when given, VaR and expected shortfall are also returned in dollars."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json"
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/animica-portfolio-risk-analytics-api-53f0d05c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from animica.dev](https://www.zero.xyz/host/animica.dev/llms.txt)
