{"uid":"cap_6CXnahSwqNg84tEsE9bDD","slug":"sharpe-ratio-calculator-20d28f54","name":"Sharpe Ratio Calculator","description":"Risk-adjusted return: (mean return - risk-free rate) / sample standard deviation of returns (n-1). Pass periodsPerYear to also get the annualized ratio (× sqrt(periodsPerYear)).","url":"https://agent402.tools/api/sharpe-ratio","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"returns":{"type":"array","description":"Periodic returns as decimals (min 2)"},"riskFreeRate":{"type":"number","description":"Risk-free rate per period as decimal. Default 0."},"periodsPerYear":{"type":"number","description":"If set, also annualize the ratio by sqrt(periodsPerYear)."}}},"responseSchema":{"type":"json","example":{"mean":0.072,"sharpe":0.825293,"stdDev":0.063008,"excessReturn":0.052}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","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.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_7532WAxUaQwW5C7m5X1B4","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes the Sharpe ratio (risk-adjusted return) from a series of periodic returns, with optional annualization.","exampleAgentPrompt":"Calculate the Sharpe ratio for these monthly portfolio returns [0.02, -0.01, 0.03, 0.015, -0.005, 0.025, 0.01, 0.04, -0.02, 0.03, 0.02, 0.01], using a risk-free rate of 0.004 per month and also annualize it assuming 12 periods per year.","exampleUseCases":null,"resultDescription":"Returns the Sharpe ratio computed as (mean return minus risk-free rate) divided by sample standard deviation (n-1 denominator), and optionally the annualized Sharpe ratio multiplied by sqrt(periodsPerYear).","failureModes":["Fewer than 2 return values provided — minimum array length is 2","Non-numeric values in the returns array cause a validation error","Invalid JSON body returns a 400 error","Missing required 'returns' field causes a 400 error","Payment not included or insufficient — 402 Payment Required response"],"whenToPreferThis":"Use this endpoint when you need a quick, accurate Sharpe ratio computation without setting up a local financial library. Ideal for agents performing portfolio analysis, strategy evaluation, or risk-adjusted return comparisons, especially when annualization from sub-annual periodic data is needed.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T16:46:14.819Z","isFirstParty":false}