{"openapi":"3.1.0","info":{"title":"Portfolio Stats","version":"1.0.0","description":"Return, risk and drawdown statistics computed on a price or return series that you supply. One call, one computed answer, no accounts or API keys. Machine-payable over x402.","x-guidance":"Portfolio Stats: Return, risk and drawdown statistics computed on a price or return series that you supply. Every endpoint takes a series you supply: prices (comma list or JSON) or returns (decimals, or percent with unit=percent), plus periodsPerYear (252 daily, 52 weekly, 12 monthly). Use /returns for simple and log returns, /cagr for compound annual growth, /volatility for annualized volatility, /sharpe-sortino for risk-adjusted ratios with your risk-free rate, /max-drawdown for the worst peak-to-trough fall with indices or dates, /correlation-beta for correlation and beta of two series, /rolling for rolling mean and volatility, /value-at-risk for illustrative historical and parametric VaR, /kelly for the Kelly fraction of a stated edge (arithmetic, not advice) and /equity-curve for a one-call summary. Each paid GET returns a computed verdict with the reasons, the source and what was NOT checked. A verdict of UNVERIFIED means a lookup failed: treat it as unknown. No account or key: pay per call in USDC over x402."},"servers":[{"url":"https://portfolio-stats.x402tookit.com"}],"paths":{"/cagr":{"get":{"operationId":"cagr","summary":"Compound annual growth rate from start and end values over years, or dates, or periods. Arithmetic on your numbers, not advice.","description":"Compound annual growth rate from start and end values over years, or dates, or periods. Arithmetic on your numbers, not advice.","tags":["cagr","growth","compound","annualized"],"parameters":[{"name":"startValue","in":"query","required":true,"description":"Starting value, above zero","schema":{"type":"number"}},{"name":"endValue","in":"query","required":true,"description":"Ending value, zero or more","schema":{"type":"number"}},{"name":"years","in":"query","required":false,"description":"Elapsed years (give exactly one of years, startDate with endDate, or periods)","schema":{"type":"number"}},{"name":"startDate","in":"query","required":false,"description":"ISO start date like 2020-01-01 (use with endDate)","schema":{"type":"string"}},{"name":"endDate","in":"query","required":false,"description":"ISO end date like 2025-01-01","schema":{"type":"string"}},{"name":"periods","in":"query","required":false,"description":"Number of periods elapsed (use with periodsPerYear)","schema":{"type":"number"}},{"name":"periodsPerYear","in":"query","required":false,"description":"Periods per year when periods is given (252, 52 or 12)","schema":{"type":"integer"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"cagrPct":{"type":["null","number"]},"cagr":{"type":["null","number"]},"totalReturnPct":{"type":["null","number"]},"growthMultiple":{"type":["null","number"]},"years":{"type":["null","number"]},"doublingTimeYears":{"type":["null","number"]},"educationalOnly":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"GROWTH","summary":"100 to 200 over 5 years is a CAGR of 14.8698355% a year (total change 100%).","reasons":["CAGR = (end / start)^(1 / years) - 1: the single constant yearly rate that would produce the same end value.","Time span: years as given.","…1 more"],"cagrPct":14.8698355,"cagr":0.148698355,"totalReturnPct":100,"growthMultiple":2,"years":5,"doublingTimeYears":5,"educationalOnly":"Educational arithmetic on the numbers you supplied. Not investment advice: it does not say what to buy, sell, hold or how much to risk, and a supplied or past series does not predict the future.","degraded":false,"notChecked":["the path between the two values (volatility, drawdowns, deposits and withdrawals are ignored)","fees, taxes and inflation","…1 more"],"source":"computed locally","asOf":"2026-10-12T00:57:39.046Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/cagr"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/cagr"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/cagr"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/cagr"}}]}}},"/correlation-beta":{"get":{"operationId":"correlation_beta","summary":"Correlation, beta, R-squared and alpha of one return or price series against another you supply. Not advice.","description":"Correlation, beta, R-squared and alpha of one return or price series against another you supply. Not advice.","tags":["correlation","beta","regression","alpha"],"parameters":[{"name":"a","in":"query","required":true,"description":"Asset series, oldest first, JSON like [0.01,-0.02,0.03] or 0.01,-0.02,0.03","schema":{"type":"string"}},{"name":"b","in":"query","required":true,"description":"Benchmark series, same length as a","schema":{"type":"string"}},{"name":"kind","in":"query","required":false,"description":"returns (default) or prices: what a and b contain","schema":{"type":"string"}},{"name":"unit","in":"query","required":false,"description":"decimal (default) or percent; applies when kind is returns","schema":{"type":"string"}},{"name":"periodsPerYear","in":"query","required":false,"description":"Periods per year for annualising alpha (default 252)","schema":{"type":"integer"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"correlation":{"type":["null","number"]},"beta":{"type":["null","number"]},"rSquared":{"type":["null","number"]},"alphaPerPeriod":{"type":["null","number"]},"alphaAnnualizedSimplePct":{"type":["null","number"]},"covariance":{"type":["null","number"]},"volatilityAPeriod":{"type":["null","number"]},"volatilityBPeriod":{"type":["null","number"]},"observations":{"type":["null","number"]},"inputKind":{"type":["null","string"]},"lowSample":{"type":["boolean","null"]},"educationalOnly":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"STRONG_POSITIVE","summary":"Correlation 0.9957842227, beta 1.401225115 of a on b over 6 paired returns (R-squared 0.9915862182).","reasons":["Pearson correlation = covariance / (sd a * sd b); beta = covariance(a, b) / variance(b), the slope of a regressed on b.","Alpha per period = mean(a) - beta * mean(b): the regression intercept, with no risk-free rate subtracted.","…1 more"],"correlation":0.9957842227,"beta":1.401225115,"rSquared":0.9915862182,"alphaPerPeriod":-0.0006707503828,"alphaAnnualizedSimplePct":-16.90290965,"covariance":0.000122,"volatilityAPeriod":0.01313011805,"volatilityBPeriod":0.009330952077,"observations":6,"inputKind":"returns","lowSample":true,"educationalOnly":"Educational arithmetic on the numbers you supplied. Not investment advice: it does not say what to buy, sell, hold or how much to risk, and a supplied or past series does not predict the future.","degraded":false,"notChecked":["whether the two series cover the same dates and frequency: only their order and length are compared","stability of beta over time, non-linear relationships and outliers","…1 more"],"source":"computed locally","asOf":"2026-10-12T00:57:39.306Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/correlation-beta"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/correlation-beta"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/correlation-beta"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/correlation-beta"}}]}}},"/equity-curve":{"get":{"operationId":"equity_curve","summary":"Equity-curve summary of a price or return series you supply: CAGR, volatility, Sharpe, drawdown, best and worst period.","description":"Equity-curve summary of a price or return series you supply: CAGR, volatility, Sharpe, drawdown, best and worst period.","tags":["equity-curve","summary","cagr","drawdown","sharpe"],"parameters":[{"name":"prices","in":"query","required":false,"description":"Price series, oldest first, JSON like [100,101,99.5] or 100,101,99.5 (up to 1000). Give prices OR returns","schema":{"type":"string"}},{"name":"returns","in":"query","required":false,"description":"Period returns, oldest first, decimals by default (0.01 = 1%). Give returns OR prices","schema":{"type":"string"}},{"name":"unit","in":"query","required":false,"description":"decimal (default, 0.01 = 1%) or percent (1 = 1%); applies to returns only","schema":{"type":"string"}},{"name":"periodsPerYear","in":"query","required":false,"description":"Periods per year for annualising: 252 daily (default), 52 weekly, 12 monthly","schema":{"type":"integer"}},{"name":"riskFreeRatePct","in":"query","required":false,"description":"Annual risk-free rate in percent for Sharpe and Sortino (default 0)","schema":{"type":"number"}},{"name":"startValue","in":"query","required":false,"description":"Starting value when you give returns (default 100); ignored for prices","schema":{"type":"number"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"periods":{"type":["null","number"]},"years":{"type":["null","number"]},"inputKind":{"type":["null","string"]},"startValue":{"type":["null","number"]},"endValue":{"type":["null","number"]},"totalReturnPct":{"type":["null","number"]},"cagrPct":{"type":["null","number"]},"annualizedVolatilityPct":{"type":["null","number"]},"sharpeRatio":{"type":["null","number"]},"sortinoRatio":{"type":["null","number"]},"calmarRatio":{"type":["null","number"]},"maxDrawdownPct":{"type":["null","number"]},"maxDrawdownPeakIndex":{"type":["null","number"]},"maxDrawdownTroughIndex":{"type":["null","number"]},"recoveredFromMaxDrawdown":{"type":["boolean","null"]},"bestPeriodPct":{"type":["null","number"]},"bestPeriodIndex":{"type":["null","number"]},"worstPeriodPct":{"type":["null","number"]},"worstPeriodIndex":{"type":["null","number"]},"positivePeriodsPct":{"type":["null","number"]},"longestLosingStreakPeriods":{"type":["null","number"]},"riskFreeRatePct":{"type":["null","number"]},"periodsPerYear":{"type":["null","number"]},"indexNote":{"type":["null","string"]},"educationalOnly":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"SUMMARY_COMPUTED","summary":"6 periods (0.5 years): total 15%, CAGR 32.25%, volatility 18.97008139%, max drawdown -5.357142857%.","reasons":["Total return = last / first - 1; CAGR = (last / first)^(1 / years) - 1 with years = periods / periodsPerYear; volatility is the sample standard deviation times sqrt(periodsPerYear).","Sharpe and Sortino use your risk-free rate split evenly across periods; Calmar is CAGR divided by the size of the maximum drawdown.","…1 more"],"periods":6,"years":0.5,"inputKind":"prices","startValue":100,"endValue":115,"totalReturnPct":15,"cagrPct":32.25,"annualizedVolatilityPct":18.97008139,"sharpeRatio":1.463694782,"sortinoRatio":3.111278288,"calmarRatio":6.02,"maxDrawdownPct":-5.357142857,"maxDrawdownPeakIndex":4,"maxDrawdownTroughIndex":5,"recoveredFromMaxDrawdown":true,"bestPeriodPct":8.490566038,"bestPeriodIndex":6,"worstPeriodPct":-5.357142857,"worstPeriodIndex":5,"positivePeriodsPct":66.66666667,"longestLosingStreakPeriods":1,"riskFreeRatePct":2,"periodsPerYear":12,"indexNote":"period k is the return from level k-1 to level k; level 0 is the start","educationalOnly":"Educational arithmetic on the numbers you supplied. Not investment advice: it does not say what to buy, sell, hold or how much to risk, and a supplied or past series does not predict the future.","degraded":false,"notChecked":["everything the other stats shelves say they do not check: this is one supplied series, never fetched or verified","costs, taxes, dividends and cash flows into or out of the account (a simple compounding path is assumed)","…1 more"],"source":"computed locally","asOf":"2026-10-12T00:57:39.570Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/equity-curve"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/equity-curve"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/equity-curve"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/equity-curve"}}]}}},"/kelly":{"get":{"operationId":"kelly","summary":"Kelly criterion fraction for a stated win probability and payoff, with growth rate and overbet threshold. NOT advice.","description":"Kelly criterion fraction for a stated win probability and payoff, with growth rate and overbet threshold. NOT advice.","tags":["kelly","kelly-criterion","edge","growth-rate"],"parameters":[{"name":"p","in":"query","required":true,"description":"Win probability you state, between 0 and 1 (exclusive)","schema":{"type":"number"}},{"name":"b","in":"query","required":true,"description":"Gain on a win as a fraction of the stake (1 = even money, 2 = win twice the stake)","schema":{"type":"number"}},{"name":"a","in":"query","required":false,"description":"Loss on a loss as a fraction of the stake, above 0 and at most 1 (default 1 = lose the whole stake)","schema":{"type":"number"}},{"name":"fractionOfKelly","in":"query","required":false,"description":"Optional multiple of full Kelly to also report, above 0 and at most 1 (0.5 = half Kelly)","schema":{"type":"number"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"fullKelly":{"type":["null","number"]},"formulaValue":{"type":["null","number"]},"expectedValuePerUnitStaked":{"type":["null","number"]},"winProbability":{"type":["null","number"]},"gainFraction":{"type":["null","number"]},"lossFraction":{"type":["null","number"]},"oddsBreakEvenProbability":{"type":["null","number"]},"growthRateAtKelly":{"type":["null","number"]},"halfKelly":{"type":["null","number"]},"growthRateAtHalfKelly":{"type":["null","number"]},"overbetThresholdStake":{"type":["null","number"]},"educationalOnly":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"KELLY_POSITIVE_EDGE","summary":"Stated edge (p 0.6, win 1, lose 1): full Kelly fraction 0.2 of the bankroll; expected log growth 0.02013551355 per bet. Arithmetic only, not advice.","reasons":["Kelly fraction f* = p/a - (1 - p)/b maximises expected log growth for repeated independent bets with exactly these stated odds.","Expected log growth per bet at stake x is p*ln(1 + b*x) + (1 - p)*ln(1 - a*x).","…2 more"],"fullKelly":0.2,"formulaValue":0.2,"expectedValuePerUnitStaked":0.2,"winProbability":0.6,"gainFraction":1,"lossFraction":1,"oddsBreakEvenProbability":0.5,"growthRateAtKelly":0.02013551355,"halfKelly":0.1,"growthRateAtHalfKelly":0.01504190162,"overbetThresholdStake":0.3893906833,"educationalOnly":"Educational arithmetic on the numbers you supplied. Not investment advice: it does not say what to buy, sell, hold or how much to risk, and a supplied or past series does not predict the future.","degraded":false,"notChecked":["NOT ADVICE: the formula assumes your probability and payoff are exactly right and repeat independently, which is almost never true; small errors in p make full Kelly far too aggressive","ruin, drawdowns, taxes, fees, liquidity and your own circumstances","…1 more"],"source":"computed locally","asOf":"2026-10-12T00:57:39.833Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/kelly"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/kelly"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/kelly"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/kelly"}}]}}},"/max-drawdown":{"get":{"operationId":"max_drawdown","summary":"Maximum drawdown of a price or return series you supply, with peak, trough and recovery indices or dates.","description":"Maximum drawdown of a price or return series you supply, with peak, trough and recovery indices or dates.","tags":["drawdown","max-drawdown","risk","peak-to-trough"],"parameters":[{"name":"prices","in":"query","required":false,"description":"Price series, oldest first, JSON like [100,101,99.5] or 100,101,99.5 (up to 1000). Give prices OR returns","schema":{"type":"string"}},{"name":"returns","in":"query","required":false,"description":"Period returns, oldest first, decimals by default (0.01 = 1%). Give returns OR prices","schema":{"type":"string"}},{"name":"unit","in":"query","required":false,"description":"decimal (default, 0.01 = 1%) or percent (1 = 1%); applies to returns only","schema":{"type":"string"}},{"name":"periodsPerYear","in":"query","required":false,"description":"Periods per year for annualising: 252 daily (default), 52 weekly, 12 monthly","schema":{"type":"integer"}},{"name":"dates","in":"query","required":false,"description":"Optional ISO dates, one per price (prices only), to label the peak, trough and recovery","schema":{"type":"string"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"maxDrawdownPct":{"type":["null","number"]},"maxDrawdown":{"type":["null","number"]},"currentDrawdownPct":{"type":["null","number"]},"observations":{"type":["null","number"]},"indexBase":{"type":["null","string"]},"inputKind":{"type":["null","string"]},"peak":{"type":["null","object"],"properties":{"index":{"type":["null","number"]},"date":{"type":["null","string"]},"level":{"type":["null","number"]}}},"trough":{"type":["null","object"],"properties":{"index":{"type":["null","number"]},"date":{"type":["null","string"]},"level":{"type":["null","number"]}}},"recovery":{"type":["null","object"],"properties":{"index":{"type":["null","number"]},"date":{"type":["null","string"]},"level":{"type":["null","number"]}}},"periodsPeakToTrough":{"type":["null","number"]},"periodsTroughToRecovery":{"type":["null","number"]},"educationalOnly":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"DRAWDOWN_RECOVERED","summary":"Maximum drawdown -25% from 2024-02-29 to 2024-03-31; recovered at 2024-05-31.","reasons":["Drawdown at each point = level / highest earlier level - 1; the maximum drawdown is the most negative one.","Peak is the earlier high that the trough fell from; recovery is the first later point at or above that peak.","…1 more"],"maxDrawdownPct":-25,"maxDrawdown":-0.25,"currentDrawdownPct":-20,"observations":6,"indexBase":"index 0 is the first price","inputKind":"prices","peak":{"index":1,"date":"2024-02-29","level":120},"trough":{"index":2,"date":"2024-03-31","level":90},"recovery":{"index":4,"date":"2024-05-31","level":130},"periodsPeakToTrough":1,"periodsTroughToRecovery":2,"educationalOnly":"Educational arithmetic on the numbers you supplied. Not investment advice: it does not say what to buy, sell, hold or how much to risk, and a supplied or past series does not predict the future.","degraded":false,"notChecked":["intra-period moves: only the supplied points are seen, so the true drawdown can be deeper","what caused the drawdown or whether it could recur","…1 more"],"source":"computed locally","asOf":"2026-10-12T00:57:40.098Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/max-drawdown"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/max-drawdown"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/max-drawdown"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/max-drawdown"}}]}}},"/returns":{"get":{"operationId":"returns","summary":"Simple and log returns from a price series you supply, with cumulative return. Educational arithmetic, not advice.","description":"Simple and log returns from a price series you supply, with cumulative return. Educational arithmetic, not advice.","tags":["returns","log-returns","prices","arithmetic"],"parameters":[{"name":"prices","in":"query","required":true,"description":"Price series, oldest first, JSON like [100,102,101] or 100,102,101 (2 to 1000 values, all above zero)","schema":{"type":"string"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"simpleReturns":{"type":["array","null"],"items":{"type":"number"}},"logReturns":{"type":["array","null"],"items":{"type":"number"}},"count":{"type":["null","number"]},"cumulativeSimpleReturn":{"type":["null","number"]},"cumulativeLogReturn":{"type":["null","number"]},"meanSimpleReturn":{"type":["null","number"]},"meanLogReturn":{"type":["null","number"]},"firstPrice":{"type":["null","number"]},"lastPrice":{"type":["null","number"]},"educationalOnly":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"RETURNS_COMPUTED","summary":"3 period returns from 4 prices; cumulative simple return 8.9%.","reasons":["Simple return = P(t)/P(t-1) - 1; log return = ln(P(t)/P(t-1)).","Log returns add across periods: their sum equals ln(last/first). Simple returns compound instead.","…1 more"],"simpleReturns":[0.1,-0.1],"logReturns":[0.0953101798,-0.1053605157],"count":3,"cumulativeSimpleReturn":0.089,"cumulativeLogReturn":0.08525984395,"meanSimpleReturn":0.03333333333,"meanLogReturn":0.02841994798,"firstPrice":100,"lastPrice":108.9,"educationalOnly":"Educational arithmetic on the numbers you supplied. Not investment advice: it does not say what to buy, sell, hold or how much to risk, and a supplied or past series does not predict the future.","degraded":false,"notChecked":["dividends, splits, fees, taxes and currency (prices are taken as given)","whether the prices are adjusted or even real: the series is never fetched or verified","…1 more"],"source":"computed locally","asOf":"2026-10-12T00:57:40.360Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/returns"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/returns"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/returns"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/returns"}}]}}},"/rolling":{"get":{"operationId":"rolling","summary":"Rolling mean return and rolling annualized volatility over a window, from a price or return series you supply.","description":"Rolling mean return and rolling annualized volatility over a window, from a price or return series you supply.","tags":["rolling","moving-average","volatility","window"],"parameters":[{"name":"prices","in":"query","required":false,"description":"Price series, oldest first, JSON like [100,101,99.5] or 100,101,99.5 (up to 1000). Give prices OR returns","schema":{"type":"string"}},{"name":"returns","in":"query","required":false,"description":"Period returns, oldest first, decimals by default (0.01 = 1%). Give returns OR prices","schema":{"type":"string"}},{"name":"unit","in":"query","required":false,"description":"decimal (default, 0.01 = 1%) or percent (1 = 1%); applies to returns only","schema":{"type":"string"}},{"name":"periodsPerYear","in":"query","required":false,"description":"Periods per year for annualising: 252 daily (default), 52 weekly, 12 monthly","schema":{"type":"integer"}},{"name":"window","in":"query","required":true,"description":"Window length in periods, 2 up to the number of returns (at most 500)","schema":{"type":"integer"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"rollingMeanReturn":{"type":["array","null"],"items":{"type":["null","number"]}},"rollingAnnualizedVolatilityPct":{"type":["array","null"],"items":{"type":["null","number"]}},"window":{"type":["null","number"]},"observations":{"type":["null","number"]},"fullWindows":{"type":["null","number"]},"latestMeanReturn":{"type":["null","number"]},"latestAnnualizedVolatilityPct":{"type":["null","number"]},"minAnnualizedVolatilityPct":{"type":["null","number"]},"maxAnnualizedVolatilityPct":{"type":["null","number"]},"periodsPerYear":{"type":["null","number"]},"educationalOnly":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"ROLLING_COMPUTED","summary":"4 full windows of 3 over 6 returns; latest rolling mean 0.003333333333, latest annualised volatility 24.24871131%.","reasons":["Each window holds the latest `window` returns; the first window-1 entries are null because the window is not full yet.","Rolling volatility is the sample standard deviation of the window times sqrt(periodsPerYear), in percent.","…1 more"],"rollingMeanReturn":[null,null],"rollingAnnualizedVolatilityPct":[null,null],"window":3,"observations":6,"fullWindows":4,"latestMeanReturn":0.003333333333,"latestAnnualizedVolatilityPct":24.24871131,"minAnnualizedVolatilityPct":24.24871131,"maxAnnualizedVolatilityPct":39.94996871,"periodsPerYear":252,"educationalOnly":"Educational arithmetic on the numbers you supplied. Not investment advice: it does not say what to buy, sell, hold or how much to risk, and a supplied or past series does not predict the future.","degraded":false,"notChecked":["window choice: results change a lot with it","overlapping windows are not independent, so the series looks smoother than the data is","…1 more"],"source":"computed locally","asOf":"2026-10-12T00:57:40.623Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/rolling"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/rolling"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/rolling"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/rolling"}}]}}},"/sharpe-sortino":{"get":{"operationId":"sharpe_sortino","summary":"Sharpe and Sortino ratios on a price or return series you supply, with your risk-free rate. Not advice.","description":"Sharpe and Sortino ratios on a price or return series you supply, with your risk-free rate. Not advice.","tags":["sharpe","sortino","risk-adjusted","ratio"],"parameters":[{"name":"prices","in":"query","required":false,"description":"Price series, oldest first, JSON like [100,101,99.5] or 100,101,99.5 (up to 1000). Give prices OR returns","schema":{"type":"string"}},{"name":"returns","in":"query","required":false,"description":"Period returns, oldest first, decimals by default (0.01 = 1%). Give returns OR prices","schema":{"type":"string"}},{"name":"unit","in":"query","required":false,"description":"decimal (default, 0.01 = 1%) or percent (1 = 1%); applies to returns only","schema":{"type":"string"}},{"name":"periodsPerYear","in":"query","required":false,"description":"Periods per year for annualising: 252 daily (default), 52 weekly, 12 monthly","schema":{"type":"integer"}},{"name":"riskFreeRatePct","in":"query","required":false,"description":"Annual risk-free rate in percent, e.g. 2 for 2% (default 0); you supply it, nothing is looked up","schema":{"type":"number"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"sharpeRatio":{"type":["null","number"]},"sortinoRatio":{"type":["null","number"]},"meanExcessReturnPerPeriod":{"type":["null","number"]},"periodVolatility":{"type":["null","number"]},"downsideDeviationPerPeriod":{"type":["null","number"]},"annualizedExcessReturnPct":{"type":["null","number"]},"riskFreeRatePct":{"type":["null","number"]},"riskFreePerPeriod":{"type":["null","number"]},"observations":{"type":["null","number"]},"periodsPerYear":{"type":["null","number"]},"educationalOnly":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"RATIOS_COMPUTED","summary":"Sharpe 1.068733429, Sortino 2.011435199 (annualised, risk-free 2% a year).","reasons":["Sharpe = (mean return - risk-free per period) / sample standard deviation, times sqrt(periodsPerYear).","Sortino divides the same excess mean by the downside deviation: the square root of the mean of min(0, return - risk-free)^2 over ALL periods, with the risk-free rate as the minimum acceptable return.","…1 more"],"sharpeRatio":1.068733429,"sortinoRatio":2.011435199,"meanExcessReturnPerPeriod":0.005833333333,"periodVolatility":0.0189076704,"downsideDeviationPerPeriod":0.01004618962,"annualizedExcessReturnPct":7,"riskFreeRatePct":2,"riskFreePerPeriod":0.001666666667,"observations":6,"periodsPerYear":12,"educationalOnly":"Educational arithmetic on the numbers you supplied. Not investment advice: it does not say what to buy, sell, hold or how much to risk, and a supplied or past series does not predict the future.","degraded":false,"notChecked":["the true risk-free rate: yours is used as given, split evenly across periods","non-normal returns, small samples and serial correlation, which make both ratios unreliable","…1 more"],"source":"computed locally","asOf":"2026-10-12T00:57:40.885Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/sharpe-sortino"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/sharpe-sortino"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/sharpe-sortino"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/sharpe-sortino"}}]}}},"/value-at-risk":{"get":{"operationId":"value_at_risk","summary":"ILLUSTRATIVE historical and parametric Value-at-Risk and expected shortfall from a return series you supply. Not advice.","description":"ILLUSTRATIVE historical and parametric Value-at-Risk and expected shortfall from a return series you supply. Not advice.","tags":["value-at-risk","var","expected-shortfall","tail-risk"],"parameters":[{"name":"prices","in":"query","required":false,"description":"Price series, oldest first, JSON like [100,101,99.5] or 100,101,99.5 (up to 1000). Give prices OR returns","schema":{"type":"string"}},{"name":"returns","in":"query","required":false,"description":"Period returns, oldest first, decimals by default (0.01 = 1%). Give returns OR prices","schema":{"type":"string"}},{"name":"unit","in":"query","required":false,"description":"decimal (default, 0.01 = 1%) or percent (1 = 1%); applies to returns only","schema":{"type":"string"}},{"name":"periodsPerYear","in":"query","required":false,"description":"Periods per year for annualising: 252 daily (default), 52 weekly, 12 monthly","schema":{"type":"integer"}},{"name":"confidencePct","in":"query","required":false,"description":"Confidence level in percent, 90 to 99.9 (default 95)","schema":{"type":"number"}},{"name":"portfolioValue","in":"query","required":false,"description":"Optional amount to express the loss in money terms","schema":{"type":"number"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"confidencePct":{"type":["null","number"]},"horizon":{"type":["null","string"]},"historicalVaR":{"type":["null","number"]},"historicalVaRPct":{"type":["null","number"]},"historicalExpectedShortfall":{"type":["null","number"]},"historicalExpectedShortfallPct":{"type":["null","number"]},"parametricVaR":{"type":["null","number"]},"parametricVaRPct":{"type":["null","number"]},"parametricExpectedShortfall":{"type":["null","number"]},"parametricExpectedShortfallPct":{"type":["null","number"]},"zScore":{"type":["null","number"]},"meanReturn":{"type":["null","number"]},"periodVolatility":{"type":["null","number"]},"tailObservations":{"type":["null","number"]},"observations":{"type":["null","number"]},"tooFewTailObservations":{"type":["boolean","null"]},"historicalVaRAmount":{"type":["null","number"]},"parametricVaRAmount":{"type":["null","number"]},"historicalExpectedShortfallAmount":{"type":["null","number"]},"parametricExpectedShortfallAmount":{"type":["null","number"]},"portfolioValue":{"type":["null","number"]},"illustrativeOnly":{"type":["boolean","null"]},"negativeVaRMeansTheThresholdWasAGain":{"type":["null","string"]},"educationalOnly":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"VAR_ILLUSTRATIVE_COMPUTED","summary":"ILLUSTRATIVE 95% one-period VaR: historical 1.64%, parametric 1.997860184% of value (from 10 returns).","reasons":["Historical VaR: the loss at the (1 - confidence) quantile of your returns, by linear interpolation between order statistics (numpy default); expected shortfall is the average of the returns at or belo…","Parametric VaR assumes returns are normal with your sample mean and standard deviation: loss = -(mean + z * sd), z = the (1 - confidence) quantile of the standard normal.","…2 more"],"confidencePct":95,"horizon":"one period of the supplied data","historicalVaR":0.0164,"historicalVaRPct":1.64,"historicalExpectedShortfall":0.02,"historicalExpectedShortfallPct":2,"parametricVaR":0.01997860184,"parametricVaRPct":1.997860184,"parametricExpectedShortfall":0.02530801306,"parametricExpectedShortfallPct":2.530801306,"zScore":-1.644853627,"meanReturn":0.001,"periodVolatility":0.01275408431,"tailObservations":1,"observations":10,"tooFewTailObservations":true,"historicalVaRAmount":164,"parametricVaRAmount":199.7860184,"historicalExpectedShortfallAmount":200,"parametricExpectedShortfallAmount":253.0801306,"portfolioValue":10000,"illustrativeOnly":true,"negativeVaRMeansTheThresholdWasAGain":"a negative VaR means even the tail quantile was a gain in this history","educationalOnly":"Educational arithmetic on the numbers you supplied. Not investment advice: it does not say what to buy, sell, hold or how much to risk, and a supplied or past series does not predict the future.","degraded":false,"notChecked":["ILLUSTRATIVE ONLY: VaR says nothing about how bad losses beyond the threshold can get, and real markets have fat tails and jumps the normal formula misses","whether the supplied history represents the future, or whether it is long enough (a 99% historical VaR from 100 returns rests on one or two points)","…1 more"],"source":"computed locally","asOf":"2026-10-12T00:57:41.149Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/value-at-risk"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/value-at-risk"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/value-at-risk"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/value-at-risk"}}]}}},"/volatility":{"get":{"operationId":"volatility","summary":"Annualized volatility (sample standard deviation of returns) from a price or return series you supply. Not advice.","description":"Annualized volatility (sample standard deviation of returns) from a price or return series you supply. Not advice.","tags":["volatility","standard-deviation","risk","annualized"],"parameters":[{"name":"prices","in":"query","required":false,"description":"Price series, oldest first, JSON like [100,101,99.5] or 100,101,99.5 (up to 1000). Give prices OR returns","schema":{"type":"string"}},{"name":"returns","in":"query","required":false,"description":"Period returns, oldest first, decimals by default (0.01 = 1%). Give returns OR prices","schema":{"type":"string"}},{"name":"unit","in":"query","required":false,"description":"decimal (default, 0.01 = 1%) or percent (1 = 1%); applies to returns only","schema":{"type":"string"}},{"name":"periodsPerYear","in":"query","required":false,"description":"Periods per year for annualising: 252 daily (default), 52 weekly, 12 monthly","schema":{"type":"integer"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"periodVolatilityPct":{"type":["null","number"]},"annualizedVolatilityPct":{"type":["null","number"]},"periodVolatility":{"type":["null","number"]},"annualizedVolatility":{"type":["null","number"]},"meanReturnPerPeriod":{"type":["null","number"]},"annualizedArithmeticMeanPct":{"type":["null","number"]},"annualizedGeometricReturnPct":{"type":["null","number"]},"observations":{"type":["null","number"]},"periodsPerYear":{"type":["null","number"]},"inputKind":{"type":["null","string"]},"educationalOnly":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"VOLATILITY_COMPUTED","summary":"Period volatility 1.457737974%, annualised 23.14087293% over 5 returns at 252 periods a year.","reasons":["Sample standard deviation (divides by n - 1) of the period returns, times the square root of periodsPerYear.","Returns were used as supplied.","…1 more"],"periodVolatilityPct":1.457737974,"annualizedVolatilityPct":23.14087293,"periodVolatility":0.01457737974,"annualizedVolatility":0.2314087293,"meanReturnPerPeriod":0,"annualizedArithmeticMeanPct":-8.743006319e-15,"annualizedGeometricReturnPct":-2.126909258,"observations":5,"periodsPerYear":252,"inputKind":"returns","educationalOnly":"Educational arithmetic on the numbers you supplied. Not investment advice: it does not say what to buy, sell, hold or how much to risk, and a supplied or past series does not predict the future.","degraded":false,"notChecked":["whether returns are normal, independent or stationary (volatility is one number for a series that may not be steady)","fat tails and jumps that standard deviation understates","…1 more"],"source":"computed locally","asOf":"2026-10-12T00:57:41.411Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/volatility"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/volatility"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/volatility"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://portfolio-stats.x402tookit.com/volatility"}}]}}}}}