# Deflate

`POST https://firm.wealthnow.io/api/v3/validation/deflate`

- Plan: Starter and up
- Price: 3 credits per call (failed requests are free)
- MCP tool: `deflate`
- Source: https://app.wealthnow.io/docs/reference/deflate

Deflates a supplied Sharpe ratio using the registry's lifetime trial count (no need to pass trials yourself). Call this for a multiple-testing-honest Sharpe on work tracked by this system; use deflated_sharpe when you have your own trials and moments. Refuses rather than deflating against a count it does not have: 503 dataset_unavailable (refunded) when the registry holds no trials, 409 insufficient_trials when the family has none (pass n_trials_override, >= 1). The registered count is a FLOOR on trials actually run; the registry block names the corpus publication it came from (corpus) and the archived earlier research-loop cycles merged behind it (archive), each trial counted once. The Sharpe is read as annualised over periods_per_year (default 252).

## Body (application/json)

| Field | Type | Required | Description |
|---|---|---|---|
| `strategy_family` | string | yes | Registry family key whose lifetime trial count deflates the Sharpe. |
| `sharpe` | number | yes | The observed annualised Sharpe (pass periods_per_year 1 for a per-period Sharpe) Range -1000 to 1000. |
| `n_obs` | integer | no | Number of return periods the Sharpe was measured on. Default `252`. Range 30 to 1000000000000. |
| `skewness` | number | no | Default `0`. Range -1000 to 1000. |
| `kurtosis` | number | no | Raw (Pearson) kurtosis of the per-period returns: a normal distribution is 3.0; excess kurtosis (pandas .kurt(), scipy's default) is 3 lower. Every distribution has kurtosis >= skewness^2 + 1; moments that break it can make the Sharpe estimator's variance negative, which is refused (422 moments_inconsistent) Default `3`. Range 1 to 1000000. |
| `periods_per_year` | number | no | Periods per year of the returns behind sharpe and n_obs (252 daily, 52 weekly, 12 monthly); 1 if sharpe is per-period. Default `252`. Range 1 to 525600. |
| `n_trials_override` | integer or null | no | Bypass the registry count. Range 1 to 1000000000000. |

## Example request

```bash
curl -X POST "https://firm.wealthnow.io/api/v3/validation/deflate" \
  -H "Authorization: Bearer $WEALTHNOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "strategy_family": "oos_backtest_top_decile",
    "sharpe": 1.6,
    "n_obs": 504
  }'
```

## Errors

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_ticker` | The request is malformed, for example a ticker that is not a symbol: `invalid_ticker`, refused before any credit is reserved, with `param` naming the parameter. Not billed. |
| 401 | `unauthorized` | Missing or invalid API key. |
| 402 | `plan_required` | Your plan does not include this tool, you are out of credits, or your workspace's spend cap paused its keys. `plan_required` names the plan that unlocks the tool; `usage_exceeded` means the credit balance is spent; `spend_cap_reached` means the key is paused until the cap resets or is raised: `detail` names the cap and the reset, `cap_usd` and `resets_at` (ISO 8601) carry them, and `doc_url` links pricing and credits. Not billed. |
| 403 | `scope_denied` | This API key is limited to some products and this tool is not one of them. `product` names the tool's product and `scopes` the key's products. An upgrade does not change it: use a key whose scopes include the product, or change this key's scopes. Not billed. |
| 404 | `not_found` | No such resource. Not billed. |
| 422 | `validation` | A parameter is missing, out of range or the wrong type; `param` names it. Not billed. |
| 429 | `rate_limited` | Your plan's rate limit is spent for this window. Retry after `Retry-After` seconds. Not billed. |
| 503 | `paid_data_unavailable` | The data could not be served completely right now; retry later. Not billed. |
| 504 | `request_timeout` | The request ran past the server's time budget; retry. Not billed. |
