# Portfolio Stats – Rolling Mean Return & Annualized Volatility

> Portfolio Stats – Rolling Mean Return & Annualized Volatility 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 rolling mean return and rolling annualized volatility over a sliding window from a user-supplied price or return series.

## Facts

- Endpoint: GET https://portfolio-stats.x402tookit.com/rolling?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-rolling-mean-return-annualized-volatility-85afb00e
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_W3BRLJVlhG9Zh2IbJA0zO

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-rolling-mean-return-annualized-volatility-85afb00e
```

Example prompt: Calculate the rolling mean return and annualized volatility for these daily closing prices [100, 101, 99.5, 102, 103, 101.5, 104] using a 5-period window, with 252 periods per year.

## When to prefer this

Choose this endpoint when you need time-series risk monitoring over a sliding window rather than a single aggregate stat. It's ideal for charting how volatility or mean return evolves through time, detecting regime changes, or feeding rolling inputs into downstream models like rolling Sharpe. Prefer this over the single-pass volatility endpoint when temporal structure of risk matters.

## Known failure modes

- Missing required 'window' parameter returns a 400 error
- Supplying both prices and returns simultaneously causes a validation error
- Window length larger than the number of returns (or greater than 500) is rejected
- Fewer data points than the window size produces no full windows (empty rolling arrays)
- Invalid JSON in prices or returns query parameter causes a parse error
- Returns denominated in percent without specifying unit=percent yields incorrect calculations

## How this service works

Rolling mean return and rolling annualized volatility over a window, from a price or return series you supply.

## Output

Returns an array of rolling mean returns and rolling annualized volatility percentages, plus the latest values of each, the min/max annualized volatility seen across all windows, the number of complete windows, total observations, and metadata including window size, periods per year, and any disclaimers or educational notes.

## 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": [
      "window"
     ],
     "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"
      },
      "window": {
       "type": "integer",
       "description": "Window length in periods, 2 up to the number of returns (at most 500)"
      },
      "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"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "window": {
       "type": [
        "null",
        "number"
       ]
      },
      "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"
       }
      },
      "fullWindows": {
       "type": [
        "null",
        "number"
       
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/portfolio-stats-rolling-mean-return-annualized-volatility-85afb00e/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)
