# Portfolio Stats – Sharpe & Sortino Ratio Calculator

> Portfolio Stats – Sharpe & Sortino Ratio Calculator 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-29).

Computes Sharpe and Sortino ratios for a price or return series you supply, given your chosen risk-free rate and annualization period.

## Facts

- Endpoint: GET https://portfolio-stats.x402tookit.com/sharpe-sortino?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-29
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/portfolio-stats-sharpe-sortino-ratio-calculator-0e664f7b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_L9YK48SPuobMVT2JRPUGk

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-sharpe-sortino-ratio-calculator-0e664f7b
```

Example prompt: Calculate the Sharpe and Sortino ratios for this daily price series [100,102,101,105,103,108,107], using a 4.5% annual risk-free rate and 252 periods per year.

## When to prefer this

Choose this endpoint when you need both Sharpe and Sortino ratios computed together from a raw price or return series without requiring any external data lookup — you supply everything. It is ideal for backtesting, strategy evaluation, or portfolio analytics pipelines where data is already in hand and a quick, cheap ($0.02) risk-adjusted performance computation is needed. Prefer it over broader equity-curve summary endpoints when you specifically need Sharpe/Sortino focus with customizable risk-free rate and annualization period.

## Known failure modes

- Missing or malformed price/return series — returns error if neither prices nor returns are supplied
- Both prices and returns supplied simultaneously — endpoint expects one or the other, not both
- Fewer than 2 data points — insufficient data for meaningful ratio computation
- Invalid JSON format for price/return array — malformed input causes parse errors
- Non-numeric values in the series — will fail or return degraded results
- Conflicting unit parameter with data format — mismatched unit enum causes incorrect computation

## How this service works

Sharpe and Sortino ratios on a price or return series you supply, with your risk-free rate. Not advice.

## Output

Returns Sharpe ratio and Sortino ratio (both annualized), along with supporting metrics: annualized excess return percentage, period volatility, downside deviation per period, mean excess return per period, risk-free rate per period, number of observations, and periods per year used. Also includes a disclaimer noting results are educational only and not financial advice.

## 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"
      },
      "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"
      },
      "riskFreeRatePct": {
       "type": "number",
       "description": "Annual risk-free rate in percent, e.g. 2 for 2% (default 0); you supply it, nothing is looked up"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "disclaimer": {
       "type": [
        "null",
        "string"
       ]
      },
      "notChecked": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "sharpeRatio": {
       "type": [
        "null",
        "number"
       ]
      },
      "observations": {
       "type": [
        "null",
    
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/portfolio-stats-sharpe-sortino-ratio-calculator-0e664f7b/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)
