# Portfolio Stats – Maximum Drawdown

> Portfolio Stats – Maximum Drawdown is a paid API for AI agents from portfolio-stats.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-10-30).

Calculates the maximum drawdown of a price or return series, returning peak, trough, and recovery indices or dates.

## Facts

- Endpoint: GET https://portfolio-stats.x402tookit.com/max-drawdown?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-30
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/portfolio-stats-maximum-drawdown-0f91746d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_oa5RcJQCJTSfc1tfmYzk7

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 portfolio-stats-maximum-drawdown-0f91746d
```

Example prompt: Calculate the maximum drawdown for this daily price series: 100, 105, 103, 98, 90, 95, 102, 110 — use ISO dates 2024-01-01 through 2024-01-08 so I can see which dates correspond to the peak, trough, and recovery, with 252 periods per year.

## When to prefer this

Choose this endpoint when you need a precise maximum drawdown calculation with clearly labeled peak, trough, and recovery points — especially when you have dates to attach to those events. It is purpose-built for drawdown analysis rather than being one metric among many in a broader summary. Prefer it over the equity-curve summary endpoint when drawdown detail (not a full suite of metrics) is the primary need, and when recovery date identification matters.

## Known failure modes

- Missing required prices or returns parameter — returns error asking for input series
- Both prices and returns supplied simultaneously — API expects one or the other
- Malformed price/return array (non-numeric values) — returns parsing error
- Dates array length mismatch with prices length — labeling fails or is ignored
- Series too long (over 1000 points) — may be rejected or truncated
- No drawdown possible (monotonically increasing series) — returns zero drawdown with matching peak and trough at end

## How this service works

Maximum drawdown of a price or return series you supply, with peak, trough and recovery indices or dates.

## Output

Returns a structured object with the maximum drawdown magnitude, plus peak, trough, and recovery objects each containing an index, optional ISO date, and price/return level. Also includes a summary string, verdict, inputKind, indexBase, and optional disclaimer or degraded flag.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [],
     "properties": {
      "unit": {
       "type": "string",
       "description": "decimal (default, 0.01 = 1%) or percent (1 = 1%); applies to returns only"
      },
      "dates": {
       "type": "string",
       "description": "Optional ISO dates, one per price (prices only), to label the peak, trough and recovery"
      },
      "prices": {
       "type": "string",
       "description": "Price series, oldest first, JSON like [100,101,99.5] or 100,101,99.5 (up to 1000). Give prices OR returns"
      },
      "returns": {
       "type": "string",
       "description": "Period returns, oldest first, decimals by default (0.01 = 1%). Give returns OR prices"
      },
      "periodsPerYear": {
       "type": "integer",
       "description": "Periods per year for annualising: 252 daily (default), 52 weekly, 12 monthly"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "peak": {
       "type": [
        "null",
        "object"
       ],
       "properties": {
        "date": {
         "type": [
          "null",
          "string"
         ]
        },
        "index": {
         "type": [
          "null",
          "number"
         ]
        },
        "level": {
         "type": [
          "null",
          "number"
         ]
        }
       }
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "trough": {
       "type": [
        "null",
        "object"
       ],
       "properties": {
        "date": {
         "type": [
          "null",
          "string"
         ]
        },
        "index": {
         "type": [
          "null",
          "number"
         ]
        },
        "level": {
         "type": [
          "null",
          "number"
         ]
        }
       }

… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/portfolio-stats-maximum-drawdown-0f91746d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from portfolio-stats.x402tookit.com](https://www.zero.xyz/host/portfolio-stats.x402tookit.com/llms.txt)
