# finmath Sortino Ratio Calculator

> finmath Sortino Ratio 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-15).

Computes the Sortino ratio from a series of periodic returns, annualizing downside risk relative to a target return.

## Facts

- Endpoint: POST https://finmath.qzqh5rrbkz.workers.dev/v1/sortino_ratio
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/finmath-sortino-ratio-calculator-c580cec6
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_TgzziBkK_KE1JuLs48VIM

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-sortino-ratio-calculator-c580cec6 -d '<json body>'
```

Example prompt: Calculate the Sortino ratio for these monthly portfolio returns [0.02, -0.01, 0.03, -0.005, 0.015, -0.02, 0.04, 0.01, -0.03, 0.025, 0.01, -0.008] using a target return of 0.0 and 12 periods per year.

## When to prefer this

Use this endpoint when you need a precise, deterministic Sortino ratio calculation without LLM rounding errors — especially for performance reporting, backtesting, or compliance contexts where accuracy matters. Prefer this over Sharpe ratio endpoints when you want to penalize only downside volatility, not total volatility.

## Known failure modes

- Empty or too-short returns array causing division by zero or undefined ratio
- Non-numeric values in the returns array causing a 400 validation error
- Missing required 'returns' field returns a 422 or 400 error
- Insufficient USDC payment returns a 402 Payment Required response
- All returns above the target (zero downside deviation) may yield infinity or null result

## 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 JSON object with a 'result' field containing the computed Sortino ratio (a number reflecting annualized excess return over target divided by downside deviation), plus a 'meta' object with calculation metadata such as inputs used and intermediate statistics.

## Example request

```json
{
 "target": 0.01,
 "returns": [
  0.02,
  0.015,
  -0.01,
  0.03,
  0.01,
  -0.005,
  0.025,
  0.012
 ],
 "periods_per_year": 252
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "returns"
 ],
 "properties": {
  "target": {
   "type": "number",
   "description": "target"
  },
  "returns": {
   "type": "array",
   "description": "returns"
  },
  "periods_per_year": {
   "type": "number",
   "description": "periods_per_year"
  }
 }
}
```

## 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-sortino-ratio-calculator-c580cec6/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)
