{"uid":"cap_oa5RcJQCJTSfc1tfmYzk7","slug":"portfolio-stats-maximum-drawdown-0f91746d","name":"Portfolio Stats – Maximum Drawdown","description":"Maximum drawdown of a price or return series you supply, with peak, trough and recovery indices or dates.","url":"https://portfolio-stats.x402tookit.com/max-drawdown?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"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"]}}},"reasons":{"type":["array","null"],"items":{"type":"string"}},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"recovery":{"type":["null","object"],"properties":{"date":{"type":["null","string"]},"index":{"type":["null","number"]},"level":{"type":["null","number"]}}},"indexBase":{"type":["null","string"]},"inputKind":{"type":["null","string"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"maxDrawdown":{"type":["null","number"]},"observations":{"type":["null","number"]},"maxDrawdownPct":{"type":["null","number"]},"educationalOnly":{"type":["null","string"]},"currentDrawdownPct":{"type":["null","number"]},"periodsPeakToTrough":{"type":["null","number"]},"periodsTroughToRecovery":{"type":["null","number"]}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_-DTUeGfh6nShfPYVlo2d6","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Calculates the maximum drawdown of a price or return series, returning peak, trough, and recovery indices or dates.","exampleAgentPrompt":"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.","exampleUseCases":[{"title":"Equity portfolio drawdown audit","prompt":"Here are the monthly NAV levels for my equity fund over the last three years: [1000, 1050, 1020, 980, 910, 930, 970, 1010, 1060, 1090, 1040, 1000, 1080]. Can you compute the maximum drawdown and tell me when the peak and trough occurred? Use periodsPerYear 12."},{"title":"Return series worst-loss analysis","prompt":"I have a series of daily decimal returns for a hedge fund strategy: [0.005, -0.003, 0.007, -0.02, -0.015, -0.008, 0.004, 0.01]. What was the maximum drawdown, and what were the peak and trough indices?"},{"title":"Backtested strategy risk review","prompt":"For these weekly returns (in percent) from my backtested strategy — [1.2, -0.5, 2.1, -3.4, -2.0, 0.8, 1.5, 2.3, -1.1] — calculate the max drawdown using percent units and 52 periods per year, so I can assess the worst losing streak."}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-30T00:30:45.876Z","isFirstParty":false,"canonicalSlug":"portfolio-stats-maximum-drawdown-0f91746d"}