# finmath Max Drawdown Calculator

> finmath Max Drawdown Calculator is a paid API for AI agents from finmath.qzqh5rrbkz.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-13).

Computes the maximum drawdown of a time series of portfolio or asset values

## Facts

- Endpoint: POST https://finmath.qzqh5rrbkz.workers.dev/v1/max_drawdown
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/finmath-max-drawdown-calculator-9984a9bd
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_z1xMAbnEOloZ5wfcntHrT

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 finmath-max-drawdown-calculator-9984a9bd -d '<json body>'
```

Example prompt: Calculate the maximum drawdown for this portfolio value series: [100, 120, 95, 110, 85, 105, 130, 90, 115] — I need the exact peak-to-trough percentage decline.

## When to prefer this

Use this endpoint when you need exact, deterministic maximum drawdown computation without relying on LLM arithmetic. Prefer it over asking an LLM to compute drawdown directly, as LLMs are prone to arithmetic errors on numerical sequences. Best for portfolio risk analysis, strategy backtesting, and regulatory reporting where precision matters.

## Known failure modes

- Missing 'values' array in request body returns validation error
- Empty array or single-element array may return zero or error
- Non-numeric values in array cause computation failure
- Insufficient funds (USDC) triggers HTTP 402 payment required
- Network timeout on workers.dev edge if request is malformed

## How this service works

Deterministic finance and crypto math for AI agents: TradFi (NPV, IRR, XIRR, Black-Scholes + Greeks, bonds, VaR, Sharpe) and DeFi (impermanent loss, perp liquidation, funding, Uniswap v3, health factor, cost basis). Exact, model-free arithmetic that LLMs get wrong — priced per call in USDC.

## Output

Returns a result object containing the maximum drawdown value (typically as a decimal or percentage representing the worst peak-to-trough decline) and a meta object with additional computation details such as peak index, trough index, and methodology information.

## Example request

```json
{
 "values": [
  100,
  95,
  110,
  85,
  120,
  90,
  105,
  80,
  115,
  100
 ]
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "values"
 ],
 "properties": {
  "values": {
   "type": "array",
   "description": "values"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "result",
  "meta"
 ],
 "properties": {
  "meta": {
   "type": "object"
  },
  "result": {}
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/finmath-max-drawdown-calculator-9984a9bd/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from finmath.qzqh5rrbkz.workers.dev](https://www.zero.xyz/host/finmath.qzqh5rrbkz.workers.dev/llms.txt)
