{"uid":"cap_Z8Vtx3jhPyYN_UEL6rdsd","slug":"portfolio-stats-correlation-beta-r-squared-alpha-e9085f56","name":"Portfolio Stats: Correlation, Beta, R-Squared & Alpha","description":"Correlation, beta, R-squared and alpha of one return or price series against another you supply. Not advice.","url":"https://portfolio-stats.x402tookit.com/correlation-beta?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":["a","b"],"properties":{"a":{"type":"string","description":"Asset series, oldest first, JSON like [0.01,-0.02,0.03] or 0.01,-0.02,0.03"},"b":{"type":"string","description":"Benchmark series, same length as a"},"kind":{"type":"string","description":"returns (default) or prices: what a and b contain"},"unit":{"type":"string","description":"decimal (default) or percent; applies when kind is returns"},"periodsPerYear":{"type":"integer","description":"Periods per year for annualising alpha (default 252)"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"beta":{"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"]},"rSquared":{"type":["null","number"]},"inputKind":{"type":["null","string"]},"lowSample":{"type":["boolean","null"]},"covariance":{"type":["null","number"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"correlation":{"type":["null","number"]},"observations":{"type":["null","number"]},"alphaPerPeriod":{"type":["null","number"]},"educationalOnly":{"type":["null","string"]},"volatilityAPeriod":{"type":["null","number"]},"volatilityBPeriod":{"type":["null","number"]},"alphaAnnualizedSimplePct":{"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_z6eXy3Y71T4DUhOhHdTzw","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":"Computes correlation, beta, R-squared, covariance, and annualized alpha of one asset return or price series against a benchmark series.","exampleAgentPrompt":"Can you calculate the correlation, beta, and annualized alpha of this asset return series [0.01, -0.02, 0.03, 0.015, -0.005] against this benchmark series [0.008, -0.015, 0.025, 0.01, -0.003], treating them as decimal returns with 252 periods per year?","exampleUseCases":[{"title":"Equity beta vs market index","prompt":"I have daily decimal returns for a tech stock and the S&P 500 over the past month — can you compute the beta, correlation, R-squared, and annualized alpha? Stock: [0.012,-0.008,0.021,-0.005,0.009] Benchmark: [0.007,-0.004,0.015,-0.003,0.006], using 252 periods per year."},{"title":"Strategy vs benchmark attribution","prompt":"I want to see how much of my quant strategy's performance is explained by the market. Here are my strategy returns and the benchmark returns as decimal series — please calculate correlation, beta, R-squared, and alpha: strategy [0.03,-0.01,0.02,0.04,-0.02], benchmark [0.015,-0.005,0.012,0.02,-0.01], 252 periods per year."},{"title":"Crypto portfolio correlation analysis","prompt":"Can you check the correlation and beta of this crypto asset against Bitcoin using these price series? Asset prices: [100,102,99,105,108], Bitcoin prices: [30000,30500,29800,31000,31500] — treat them as prices, not returns, with 365 periods per year."}],"resultDescription":"Returns a JSON object containing: correlation coefficient, beta, R-squared, alpha per period, annualized simple alpha percentage, covariance, per-period volatility for both series, number of observations, and flags for low sample size or degraded quality. Also includes a summary string, disclaimer, and educational-only notice.","failureModes":["Series length mismatch between 'a' and 'b' — returns error or null statistics","Fewer than ~5 observations triggers lowSample flag and unreliable estimates","Invalid JSON formatting of the series arrays causes parse errors","Zero-variance benchmark causes division-by-zero for beta/R-squared","Mismatched 'kind' or 'unit' parameters relative to actual data produce misleading results","Payment failure (x402) blocks the request before computation"],"whenToPreferThis":"Choose this endpoint when you need a comprehensive set of linear regression statistics (correlation, beta, R-squared, alpha) between two return or price series in a single call. Prefer it over volatility-only or Sharpe-only endpoints when benchmark-relative analysis is the goal. Ideal for portfolio attribution, factor exposure measurement, or strategy evaluation against a market index.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-30T00:34:53.861Z","isFirstParty":false,"canonicalSlug":"portfolio-stats-correlation-beta-r-squared-alpha-e9085f56"}