{"uid":"cap_4nAhcwQXYXsyEc4MGSYM-","slug":"portfolio-stats-simple-log-returns-01996a70","name":"Portfolio Stats – Simple & Log Returns","description":"Simple and log returns from a price series you supply, with cumulative return. Educational arithmetic, not advice.","url":"https://portfolio-stats.x402tookit.com/returns?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"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":["null","number"]},"cumulativeLogReturn":{"type":["null","number"]},"cumulativeSimpleReturn":{"type":["null","number"]}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_vltBrBblPNpIC-VeXMYci","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Calculates simple returns, log returns, and cumulative return from a user-supplied price series","exampleAgentPrompt":"Can you calculate the simple and log returns, plus the cumulative return, for this price series: 100, 103, 101, 106, 110?","exampleUseCases":[{"title":"Stock performance review from closing prices","prompt":"I have a list of daily closing prices for a stock over the past month: 150, 152, 149, 155, 158, 157, 162. Can you compute the simple and log returns for each period and tell me the overall cumulative return?"},{"title":"Crypto asset return analysis","prompt":"Here are weekly Bitcoin prices from oldest to newest: 28000, 29500, 27800, 31000, 30500. What are the simple and log returns for each week, and what's the total cumulative return across the whole series?"},{"title":"Backtesting return baseline for a trading strategy","prompt":"I'm building a simple backtest and need to verify my return calculations. Can you run these prices through the returns calculator and give me both simple and log returns along with the mean and cumulative returns: 200, 204, 201, 207, 210, 215?"}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-29T13:12:42.108Z","isFirstParty":false,"canonicalSlug":"portfolio-stats-simple-log-returns-01996a70"}