# Treasury Portfolio Risk Analyzer

> Treasury Portfolio Risk Analyzer 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-11-30).

Performs deterministic treasury/portfolio risk analysis including volatility, Sharpe/Sortino/Calmar ratios, VaR/CVaR, concentration (HHI), risk contribution, and correlated stress scenario testing.

## Facts

- Endpoint: POST https://portfolio-risk-analyzer-g9ao.onrender.com/treasury-risk?utm_source=zero.xyz
- Price: $0.1/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-30
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/treasury-portfolio-risk-analyzer-1d84cf79
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_est7l9X6oCEap1DZN-fEB

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-portfolio-risk-analyzer-1d84cf79 -d '<json body>'
```

Example prompt: Run a full treasury risk analysis on my portfolio — I have three assets (BTC, ETH, USDC) with weights 0.5, 0.3, 0.2 and daily returns data, using a risk-free rate of 0.05, 252 trading periods per year, and stress test against a 2008-style financial crisis scenario where BTC drops 40% and ETH drops 35%.

## When to prefer this

Choose this endpoint when you need deterministic, reproducible quantitative risk metrics for a treasury or investment portfolio — particularly when you need multiple risk measures in a single call (volatility, Sharpe/Sortino/Calmar, VaR/CVaR, concentration, stress scenarios). Prefer this over general-purpose analytics when you need structured financial risk output ready for treasury reporting or risk dashboards, and when you want correlated multi-asset stress testing alongside concentration analysis in one response.

## Known failure modes

- Missing or mismatched returns/weights keys causing validation error
- Insufficient data points in returns arrays for meaningful statistical computation
- Weights not summing to 1.0 causing normalization issues
- Invalid confidence levels (must be between 0 and 1)
- Stress scenario shocks referencing asset keys not present in returns
- All-zero or constant returns arrays causing division-by-zero in ratio calculations
- Network timeout on the Render.com cold-start container

## How this service works

Treasury Risk Analyzer — Deterministic treasury/portfolio risk analysis: volatility, Sharpe/Sortino/Calmar, VaR/CVaR, concentration (HHI), risk contribution, correlated stress scenarios.

## Output

Returns a structured risk report including: annualized volatility, Sharpe ratio, Sortino ratio, Calmar ratio, Value at Risk (VaR) and Conditional VaR (CVaR) at specified confidence levels, Herfindahl-Hirschman Index (HHI) for concentration, per-asset risk contributions, and profit/loss estimates for each named stress scenario.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "returns": {
   "type": "object",
   "additionalProperties": {
    "type": "array",
    "items": {
     "type": "number"
    }
   }
  },
  "weights": {
   "type": "object",
   "additionalProperties": {
    "type": "number"
   }
  },
  "baseCurrency": {
   "type": "string",
   "default": "USD"
  },
  "riskFreeRate": {
   "type": "number",
   "default": 0
  },
  "periodsPerYear": {
   "type": "number",
   "default": 252
  },
  "sectorExposure": {
   "type": "object",
   "additionalProperties": {
    "type": "number"
   }
  },
  "stressScenarios": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string"
     },
     "shocks": {
      "type": "object",
      "additionalProperties": {
       "type": "number"
      }
     }
    }
   }
  },
  "benchmarkReturns": {
   "type": "array",
   "items": {
    "type": "number"
   }
  },
  "confidenceLevels": {
   "type": "array",
   "items": {
    "type": "number"
   },
   "default": [
    0.95,
    0.99
   ]
  },
  "currencyExposure": {
   "type": "object",
   "additionalProperties": {
    "type": "number"
   }
  },
  "geographyExposure": {
   "type": "object",
   "additionalProperties": {
    "type": "number"
   }
  },
  "minimumAcceptableReturn": {
   "type": "number",
   "default": 0
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "status": "success",
  "warnings": [
   "Some implied stress shocks were set to 0 because the historical relationship with the shocked sym..."
  ],
  "portfolio": {
   "assets": 5,
   "base_currency": "USD"
  },
  "timestamp": "2026-11-05T06:08:41.989Z",
  "analysis_id": "76a84772-6734-4c27-88df-26702f37be08",
  "stress_test": [
   {
    "name": "EUR -10% vs USD",
    "propagation": {},
    "directShocks": {},
    "impliedShocks": {},
    "excludedDrivers": [],
    "portfolioImpact": -0.02854865948571069,
    "directOnlyImpact": -0.025,
    "unmatchedSymbols": []
   }
  ],
  "risk_metrics": {
   "hhi": 0.2958000000000001,
   "beta": null,
   "calmar_ratio": 0.02604240703810475,
   "max_drawdown": -0.06069587440031432,
   "sharpe_ratio": 0.06906128441729663,
   "sortino_ratio": 0.09688576748812007,
   "value_at_risk": {
    "0.95": {},
    "0.99": {}
   },
   "annualized_return": 0.001580666666666668,
   "expected_shortfall": {
    "0.95": {},
    "0.99": {}
   },
   "annualized_volatility": 0.02288788400047168,
   "diversification_ratio": 1.257848902454925,
   "correlation_to_benchmark": null,
   "annualized_downside_deviation": 0.01631474578410586
  },
  "concentration": {
   "asset": {
    "hhi": 0.2958000000000001,
    "effectiveCount": 3.380662609871534
   },
   "currency": {
    "hhi": 0.4950000000000001,
    "effectiveCount": 2.02020202020202
   }
  },
  "risk_contribution": {
   "USDC": 0.00005250741794303742,
   "SUKUK": -0.01387419668716468,
   "EURCASH": 0.810126104389689,
   "GBPCASH": 0.2036955848795325,
   "USDCASH": 0
  },
  "risk_classification": {
   "level": "LOW",
   "score": 13
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/treasury-portfolio-risk-analyzer-1d84cf79/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)
