# Portfolio Stats – Simple & Log Returns

> Portfolio Stats – Simple & Log Returns 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).

Calculates simple returns, log returns, and cumulative return from a user-supplied price series

## Facts

- Endpoint: GET https://portfolio-stats.x402tookit.com/returns?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-simple-log-returns-01996a70
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_4nAhcwQXYXsyEc4MGSYM-

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-simple-log-returns-01996a70
```

Example prompt: Can you calculate the simple and log returns, plus the cumulative return, for this price series: 100, 103, 101, 106, 110?

## When to prefer this

Use this endpoint when you need quick, reliable calculation of period-by-period simple and log returns plus cumulative return from a raw price series, without building the arithmetic yourself. It is ideal for educational explorations, backtest preprocessing, or validating return calculations. Prefer it over the volatility or Sharpe endpoints when you only need the return series itself, not derived risk metrics.

## Known failure modes

- Fewer than 2 prices supplied — endpoint requires at least 2 values to compute returns
- Prices contain zero or negative values — all prices must be above zero
- Malformed prices string — if the JSON or comma-separated list cannot be parsed, the call fails
- Too many prices — more than 1000 values exceeds the allowed range
- Payment failure — x402 payment of $0.02 USDC not completed results in 402 response

## How this service works

Simple and log returns from a price series you supply, with cumulative return. Educational arithmetic, not advice.

## Output

Returns an object containing an array of simple returns and log returns for each period, mean simple and log returns, cumulative simple and cumulative log returns, the first and last price, the count of prices, and an educational disclaimer. All values are numerical arrays or scalars. Also includes an educationalOnly flag and a disclaimer noting results are not investment 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": [
      "prices"
     ],
     "properties": {
      "prices": {
       "type": "string",
       "description": "Price series, oldest first, JSON like [100,102,101] or 100,102,101 (2 to 1000 values, all above zero)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "count": {
       "type": [
        "null",
        "number"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "lastPrice": {
       "type": [
        "null",
        "number"
       ]
      },
      "disclaimer": {
       "type": [
        "null",
        "string"
       ]
      },
      "firstPrice": {
       "type": [
        "null",
        "number"
       ]
      },
      "logReturns": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "number"
       }
      },
      "notChecked": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "meanLogReturn": {
       "type": [
        "null",
        "number"
       ]
      },
      "simpleReturns": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "number"
       }
      },
      "educationalOnly": {
       "type": [
        "null",
        "string"
       ]
      },
      "meanSimpleReturn": {
       "type": [
      
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/portfolio-stats-simple-log-returns-01996a70/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)
