{"uid":"cap_L9YK48SPuobMVT2JRPUGk","slug":"portfolio-stats-sharpe-sortino-ratio-calculator-0e664f7b","name":"Portfolio Stats – Sharpe & Sortino Ratio Calculator","description":"Sharpe and Sortino ratios on a price or return series you supply, with your risk-free rate. Not advice.","url":"https://portfolio-stats.x402tookit.com/sharpe-sortino?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":[],"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"},"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"},"riskFreeRatePct":{"type":"number","description":"Annual risk-free rate in percent, e.g. 2 for 2% (default 0); you supply it, nothing is looked up"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"source":{"type":["null","string"]},"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"}},"sharpeRatio":{"type":["null","number"]},"observations":{"type":["null","number"]},"sortinoRatio":{"type":["null","number"]},"periodsPerYear":{"type":["null","number"]},"educationalOnly":{"type":["null","string"]},"riskFreeRatePct":{"type":["null","number"]},"periodVolatility":{"type":["null","number"]},"riskFreePerPeriod":{"type":["null","number"]},"annualizedExcessReturnPct":{"type":["null","number"]},"meanExcessReturnPerPeriod":{"type":["null","number"]},"downsideDeviationPerPeriod":{"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_PcmOXGWiPCsC-Q_xdeqWd","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 Sharpe and Sortino ratios for a price or return series you supply, given your chosen risk-free rate and annualization period.","exampleAgentPrompt":"Calculate the Sharpe and Sortino ratios for this daily price series [100,102,101,105,103,108,107], using a 4.5% annual risk-free rate and 252 periods per year.","exampleUseCases":[{"title":"Evaluating a trading strategy's risk-adjusted returns","prompt":"Here are the daily returns for my momentum strategy over the past year (as decimals): [0.005,-0.002,0.008,...]. Can you calculate the Sharpe and Sortino ratios assuming a 5% annual risk-free rate and 252 trading days per year?"},{"title":"Comparing monthly fund performance","prompt":"I have monthly returns for a fund: [0.012,-0.003,0.008,0.015,-0.005,0.020,0.001,-0.010,0.018,0.007,-0.002,0.011]. Please compute the Sharpe and Sortino ratios with a 3% annual risk-free rate and 12 periods per year."},{"title":"Backtesting a crypto price series","prompt":"Given this weekly price series for a crypto asset, oldest first: [1000,1050,980,1100,1075,1200,1150,1300], what are the Sharpe and Sortino ratios assuming a 0% risk-free rate and 52 weeks per year?"}],"resultDescription":"Returns Sharpe ratio and Sortino ratio (both annualized), along with supporting metrics: annualized excess return percentage, period volatility, downside deviation per period, mean excess return per period, risk-free rate per period, number of observations, and periods per year used. Also includes a disclaimer noting results are educational only and not financial advice.","failureModes":["Missing or malformed price/return series — returns error if neither prices nor returns are supplied","Both prices and returns supplied simultaneously — endpoint expects one or the other, not both","Fewer than 2 data points — insufficient data for meaningful ratio computation","Invalid JSON format for price/return array — malformed input causes parse errors","Non-numeric values in the series — will fail or return degraded results","Conflicting unit parameter with data format — mismatched unit enum causes incorrect computation"],"whenToPreferThis":"Choose this endpoint when you need both Sharpe and Sortino ratios computed together from a raw price or return series without requiring any external data lookup — you supply everything. It is ideal for backtesting, strategy evaluation, or portfolio analytics pipelines where data is already in hand and a quick, cheap ($0.02) risk-adjusted performance computation is needed. Prefer it over broader equity-curve summary endpoints when you specifically need Sharpe/Sortino focus with customizable risk-free rate and annualization period.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-29T13:08:21.546Z","isFirstParty":false,"canonicalSlug":"portfolio-stats-sharpe-sortino-ratio-calculator-0e664f7b"}