# Treasury Risk Analyzer — Portfolio Risk Analysis

> Treasury Risk Analyzer — Portfolio Risk Analysis is a paid API for AI agents from portfolio-risk-analyzer-g9ao.onrender.com, paid per call via x402, $0.1/call, status unknown (last checked 2026-12-02).

Runs deterministic portfolio risk analysis (volatility, VaR, Sharpe/Sortino, stress tests, benchmark metrics) on a submitted portfolio of return series and weights, paid per call in USDC via x402.

## Facts

- Endpoint: POST https://portfolio-risk-analyzer-g9ao.onrender.com/analyze?utm_source=zero.xyz
- Price: $0.1/call
- Payment: x402
- Status: unknown
- Last checked: 2026-12-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/treasury-risk-analyzer-portfolio-risk-analysis-5ecdf66b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Q51o_sOmuUfgymXP_FwXi

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 treasury-risk-analyzer-portfolio-risk-analysis-5ecdf66b -d '<json body>'
```

Example prompt: Analyze the risk of my portfolio: BTC weighted 60% with daily returns [0.01, -0.02, 0.03, -0.01, 0.02] and ETH weighted 40% with daily returns [0.02, -0.03, 0.01, 0.00, 0.015], using 365 periods per year, a 4% risk-free rate, and VaR at 95% and 99% confidence levels.

## When to prefer this

Use this endpoint when you need deterministic, auditable portfolio risk metrics — VaR, Expected Shortfall, Sharpe/Sortino ratios, stress tests — with no LLM estimation involved. Prefer it over LLM-based financial summaries when you need mathematically exact outputs suitable for autonomous treasury or CFO agent decision-making. It is particularly well-suited for agents that must justify risk decisions with reproducible quantitative evidence. The x402 pay-per-call model means no account setup is required.

## Known failure modes

- 400 Bad Request (free, no charge): invalid input such as mismatched symbol sets between returns and weights, weights not summing to 1, return series of different lengths, unsupported confidence levels — returns descriptive error message
- Payment failure: x402 or Circle Gateway payment not confirmed — request not processed
- Return series too short (fewer than 2 observations): 400 error
- Stress scenario names a symbol not in the portfolio: scenario may produce empty directShocks or limited propagation
- Render.com cold-start latency on first request after idle period

## How this service works

Deterministic financial intelligence for autonomous AI Treasury/CFO agents, paid per call in USDC on Base via x402 — no account, no API key. Two payment rails are accepted on every paid route: Circle Gateway batched payments and standard x402 `exact` (EIP-3009) payments, so any x402 v2 client can pay. Exposes three atomic capabilities — treasury/portfolio risk analysis, FX exposure analysis, and liquidity forecasting — plus a composite POST /treasury-decision endpoint that orchestrates all three to answer "can we safely execute this payment today?" All share one deterministic engine and one agent-native response format. No LLM is used to produce or estimate a financial value. Requests are validated before payment: invalid input returns a free 400 and is never charged.

## Output

Returns a JSON object with a UUID analysis ID, timestamp, portfolio summary (asset count, base currency), computed risk metrics (volatility, VaR and Expected Shortfall at requested confidence levels, Sharpe ratio, Sortino ratio), stress test results with direct and propagated shocks per symbol (including propagation diagnostics), benchmark correlation and beta if supplied, concentration analysis by sector/currency/geography if supplied, plus warnings and methodology notes describing any limitations.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "returns",
  "weights"
 ],
 "properties": {
  "returns": {
   "type": "object",
   "description": "Per-period historical return series by symbol. All series must be the same length (≥2 observations)."
  },
  "weights": {
   "type": "object",
   "description": "Portfolio weights by symbol. Must cover exactly the same symbols as `returns` and sum to 1."
  },
  "baseCurrency": {
   "type": "string"
  },
  "riskFreeRate": {
   "type": "number",
   "description": "Annualized risk-free rate, e.g. 0.04 for 4%."
  },
  "periodsPerYear": {
   "type": "number",
   "description": "Periods per year in the return series (252 for daily equities, 365 for daily crypto)."
  },
  "sectorExposure": {
   "type": "object",
   "description": "Optional weight distribution by sector, for concentration analysis."
  },
  "stressScenarios": {
   "type": "array",
   "description": "Optional stress scenarios. Shocks on the listed symbols propagate to unshocked symbols via covariance-based beta mapping (correlated impact), alongside the direct-only impact."
  },
  "benchmarkReturns": {
   "type": "array",
   "description": "Optional per-period benchmark series (same length as each `returns` series) to compute beta and correlation."
  },
  "confidenceLevels": {
   "type": "array",
   "description": "Confidence levels for VaR/Expected Shortfall. Supported: 0.9, 0.95, 0.975, 0.99, 0.995."
  },
  "currencyExposure": {
   "type": "object",
   "description": "Optional weight distribution by currency, for concentration analysis."
  },
  "geographyExposure": {
   "type": "object",
   "description": "Optional weight distribution by geography, for concentration analysis."
  },
  "minimumAcceptableReturn": {
   "type": "number",
   "description": "Per-period MAR used for downside deviation / Sortino ratio."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "status": {
   "enum": [
    "success"
   ],
   "type": "string"
  },
  "warnings": {
   "type": "array",
   "items": {
    "type": "string"
   }
  },
  "portfolio": {
   "type": "object",
   "properties": {
    "assets": {
     "type": "integer"
    },
    "base_currency": {
     "type": "string"
    }
   }
  },
  "timestamp": {
   "type": "string",
   "format": "date-time"
  },
  "analysis_id": {
   "type": "string",
   "format": "uuid"
  },
  "limitations": {
   "type": "array",
   "items": {
    "type": "string"
   }
  },
  "methodology": {
   "type": "object",
   "additionalProperties": {
    "type": "string"
   }
  },
  "stress_test": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string"
     },
     "propagation": {
      "type": "object",
      "description": "Per unshocked symbol, why its implied shock is what it is. `propagated` only when the regression on the usable drivers is significant (F-test p < 0.05); `not_significant` (implied shock 0), `zero_variance` (the symbol never moved historically), or `no_usable_driver` (every shocked symbol was excluded, see excludedDrivers).",
      "additionalProperties": {
       "type": "object",
       "properties": {
        "pValue": {
         "type": "number",
         "nullable": true
        },
        "status": {
         "enum": [
          "propagated",
          "not_significant",
          "zero_variance",
          "no_usable_driver"
         ],
         "type": "string"
        },
        "rSquared": {
         "type": "number",
         "nullable": true
        }
       }
      }
     },
     "directShocks": {
      "type": "object",
      "description": "The user-specified shocks that matched a portfolio symbol.",
      "additionalProperties": {
       "type": "number"
      }
     },
     "impliedShocks": {
      "type": "object",
      "description": "Shocks inferred for portfolio symbols not directly named in the scenario, via factor-beta mapping on the historical covariance matrix of the directly-shocked symbols. Empty if every portfolio symbol was directly shocked, or if none of the scenario's shocks matched a portfolio symbol. A value is exactly 0 when the relationship was not propagated — see `propagation` for the reason.",
      "additionalProperties": {
       "type": "number"
      }
     },
     "excludedDrivers": {
      "type": "array",
      "items": {
       "type": "object",
 
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/treasury-risk-analyzer-portfolio-risk-analysis-5ecdf66b/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from portfolio-risk-analyzer-g9ao.onrender.com](https://www.zero.xyz/host/portfolio-risk-analyzer-g9ao.onrender.com/llms.txt)
