Calculate Maximum Drawdown
risk.maximum_drawdown
Overview
Performs exact bounded risk arithmetic from caller-supplied values without inferring observation frequency, return-series alignment, benchmark selection, or annualization conventions.
You receive deterministic risk arithmetic with explicit annualization and alignment for risk.maximum_drawdown.
Reliability
DECIMAL_INVALID means a decimal is malformed or over limit; correct it. RISK_INPUT_INVALID means series alignment, variance mode, or annualization input is invalid; correct it. ZERO_DENOMINATOR means benchmark variance is zero; provide a varying benchmark series. ITEM_LIMIT_EXCEEDED means a series exceeds 10,000; reduce it. This guidance applies specifically to risk.maximum_drawdown.
Context footprint
The compact result replaces repeated risk arithmetic for risk.maximum_drawdown. A successful call costs 1 execution credit.
When to use it
When a wealth or return path must report the worst peak-to-trough decline.
When you need volatility or beta rather than a path-dependent drawdown.
Scope
Non-goals
- Does not infer observation frequency, align dates, or source returns for risk.maximum_drawdown.
- Does not select a benchmark or investment-risk methodology for risk.maximum_drawdown.
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content, but it does not target sensitive data and returns only a structured non-sensitive result.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response does not contain submitted content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| orderedValues | array | Yes | Required one through 10,000 aligned plain-decimal return strings; null elements are invalid. |
| seriesType | string | Yes | Required VALUE or WEALTH_INDEX. |
| tieBreakRule | string | Yes | Required literal EARLIEST; equal drawdowns retain the lowest zero-based trough index. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| maximumDrawdown | string | Yes | Most negative normalized drawdown. |
| peakIndex | integer | Yes | Zero-based earliest peak index. |
| troughIndex | integer | Yes | Zero-based earliest trough index. |
| recoveryIndex | integer | No | First later recovery index; omitted when unrecovered. |
| count | integer | Yes | Validated input count. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"risk.maximum_drawdown","input":{"orderedValues":["100","80","100"],"seriesType":"VALUE","tieBreakRule":"EARLIEST"}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("risk.maximum_drawdown", {"tieBreakRule":"EARLIEST","seriesType":"VALUE","orderedValues":["100","80","100"]});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| DECIMAL_INVALID | 400 | No | The request payload failed this skill's input validation. |
| RISK_INPUT_INVALID | 400 | No | The request payload failed this skill's input validation. |
| ITEM_LIMIT_EXCEEDED | 429 | No | A size, quota, rate, or time limit was exceeded. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not infer observation frequency, align dates, or source returns for risk.maximum_drawdown.
- Does not select a benchmark or investment-risk methodology for risk.maximum_drawdown.
- Benchmark selection, date alignment, forecasting, or investment advice for risk.maximum_drawdown.
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "risk.maximum_drawdown",
"input": {
"tieBreakRule": "EARLIEST",
"seriesType": "VALUE",
"orderedValues": [
"100",
"80",
"100"
]
}
}Examples
Verified primary
{
"tieBreakRule": "EARLIEST",
"seriesType": "VALUE",
"orderedValues": [
"100",
"80",
"100"
]
}{
"troughIndex": 1,
"maximumDrawdown": "-0.2",
"peakIndex": 0,
"recoveryIndex": 2,
"count": 3
}Verified alternative
{
"tieBreakRule": "EARLIEST",
"seriesType": "WEALTH_INDEX",
"orderedValues": [
"100",
"90"
]
}{
"troughIndex": 1,
"maximumDrawdown": "-0.1",
"count": 2,
"peakIndex": 0
}Recommended use cases
- Exact risk-metric reperformance for risk.maximum_drawdown.
- Independent bounded analytics evidence for risk.maximum_drawdown.
Avoid for
- Benchmark selection, date alignment, forecasting, or investment advice for risk.maximum_drawdown.
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.