# 24K Labs Return & Risk Metrics Calculator

> 24K Labs Return & Risk Metrics Calculator is a paid API for AI agents from api.24klabs.ai, paid per call via x402, $0.003/call, status unknown (last checked 2026-09-13).

Computes CAGR, total return, annualized volatility, Sharpe ratio, and maximum drawdown from a value series or start/end/years inputs.

## Facts

- Endpoint: POST https://api.24klabs.ai/api/return-cagr-drawdown
- Price: $0.003/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/24k-labs-return-risk-metrics-calculator-bc3fa2f5
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_REn-JWlaq0sSf98mCt2uz

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 24k-labs-return-risk-metrics-calculator-bc3fa2f5 -d '<json body>'
```

Example prompt: Calculate the CAGR, annualized volatility, Sharpe ratio, and maximum drawdown for this price series [100, 112, 108, 125, 140, 132, 155] using a risk-free rate of 2%.

## When to prefer this

Choose this endpoint when you need a complete set of standard investment return and risk metrics in a single call — especially CAGR, Sharpe ratio, and maximum drawdown together. It is ideal for portfolio analytics pipelines, fund evaluation workflows, or any agent task where the user wants a rigorous quantitative summary of an asset's historical performance. It accepts either a raw value series or simple start/end/years inputs, making it flexible for both detailed and summarized data sources.

## Known failure modes

- Insufficient data points in the value series for meaningful volatility calculation
- Missing required inputs (no series and no start/end/years combination provided)
- Risk-free rate not provided when Sharpe ratio is requested
- Non-numeric or malformed values in the series causing computation errors
- Zero or negative values causing logarithmic return calculation failures
- Years value of zero causing division-by-zero in CAGR computation

## How this service works

From a value series (or start/end/years): CAGR, total return, annualized volatility, Sharpe ratio (given risk-free) and maximum drawdown.

## Output

Returns a structured JSON object containing: CAGR (compound annual growth rate as a percentage), total return (absolute percentage gain/loss), annualized volatility (standard deviation of returns scaled to annual), Sharpe ratio (risk-adjusted return given the supplied risk-free rate), and maximum drawdown (largest peak-to-trough decline in the series).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "series": {
   "type": "array"
  },
  "risk_free": {
   "type": "number"
  },
  "periods_per_year": {
   "type": "number"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "cagr_pct": 94.6,
  "max_drawdown_pct": -5.56,
  "total_return_pct": 35
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/24k-labs-return-risk-metrics-calculator-bc3fa2f5/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.24klabs.ai](https://www.zero.xyz/host/api.24klabs.ai/llms.txt)
