# Investing Math – Period Return Statistics

> Investing Math – Period Return Statistics is a paid API for AI agents from invest-math.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-10-30).

Computes performance statistics from a series of period returns: mean, volatility, Sharpe ratio, Sortino ratio, CAGR, max drawdown, win rate, and more.

## Facts

- Endpoint: GET https://invest-math.x402tookit.com/return-stats?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-30
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/investing-math-period-return-statistics-28d337f1
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap__gRQEmkOIFJYK7gqYBdv0

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 investing-math-period-return-statistics-28d337f1
```

Example prompt: Calculate the performance stats for my monthly portfolio returns — 2.1, -1.3, 3.4, 0.8, -2.0, 1.5, 4.2, -0.5, 2.8, 1.1, -1.8, 3.0 — using a 4% annual risk-free rate and 12 periods per year. I want the Sharpe, Sortino, CAGR, max drawdown, and volatility.

## When to prefer this

Use this endpoint when you need a comprehensive suite of investment performance metrics computed from a raw list of period returns in a single call. It is ideal for backtesting analysis, strategy evaluation, or portfolio reporting where you need risk-adjusted ratios (Sharpe, Sortino), growth metrics (CAGR), and drawdown figures together. Prefer it over manual calculation or multi-step pipelines when your data is already in percent-return series form.

## Known failure modes

- Fewer than 3 returns provided — endpoint requires at least 3 data points
- Non-numeric values in returnsPct string cause parsing errors
- Invalid periodsPerYear value (e.g. 0 or negative) causes computation failure
- Missing required returnsPct parameter returns an error response
- Sortino ratio may be null if there are no negative periods (no downside deviation)

## How this service works

Performance stats from period returns: average, volatility, Sharpe, Sortino, compound growth and max drawdown.

## Output

A JSON object with comprehensive performance metrics including: mean return per period, annualised mean, volatility per period, annualised volatility, Sharpe ratio, Sortino ratio, CAGR (cagrPct), max drawdown, total return, win rate, best and worst period, plus a summary verdict and any warnings about data quality (degraded flag, reasons, disclaimer).

## 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": [
      "returnsPct"
     ],
     "properties": {
      "returnsPct": {
       "type": "string",
       "description": "Period returns in percent, comma separated, at least 3"
      },
      "riskFreePct": {
       "type": "number",
       "description": "Annual risk-free rate in percent, default 0"
      },
      "periodsPerYear": {
       "type": "integer",
       "description": "12 monthly (default), 52 weekly, 252 daily, 4 quarterly, 1 yearly"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "sharpe": {
       "type": [
        "null",
        "number"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "cagrPct": {
       "type": [
        "null",
        "number"
       ]
      },
      "periods": {
       "type": [
        "null",
        "number"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "sortino": {
       "type": [
        "null",
        "number"
       ]
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "disclaimer": {
       "type": [
        "null",
        "string"
       ]
      },
      "notChecked": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "winRatePct": {
       "type": [
        "null",
        "number"
       ]
      },
      "bestPeriodPct": {
       "type": [
        "null",
        "number"
       ]
      },
      "meanReturnPct": 
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/investing-math-period-return-statistics-28d337f1/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from invest-math.x402tookit.com](https://www.zero.xyz/host/invest-math.x402tookit.com/llms.txt)
