{"uid":"cap_SKDD-rDi5eM0c-ESyPTJb","slug":"finmath-sharpe-ratio-calculator-c3c97979","name":"finmath Sharpe Ratio Calculator","description":"Deterministic finance and crypto math for AI agents: TradFi (NPV, IRR, XIRR, Black-Scholes + Greeks, bonds, VaR, Sharpe) and DeFi (impermanent loss, perp liquidation, funding, Uniswap v3, health factor, cost basis). Exact, model-free arithmetic that LLMs get wrong — priced per call in USDC.","url":"https://finmath.qzqh5rrbkz.workers.dev/v1/sharpe_ratio","method":"POST","headers":{},"bodySchema":{"type":"object","required":["returns"],"properties":{"returns":{"type":"array","description":"returns"},"risk_free":{"type":"number","description":"risk_free"},"periods_per_year":{"type":"number","description":"periods_per_year"}}},"responseSchema":{"type":"object","required":["result","meta"],"properties":{"meta":{"type":"object"},"result":{}}},"example":{"request":{"returns":[0.02,0.015,0.03,-0.01,0.025,0.018,0.022,0.012],"risk_free":0.02,"periods_per_year":12},"response":{"meta":{"tool":"sharpe_ratio","disclaimer":"Deterministic calculation utility. Not financial, investment, or trading advice.","deterministic":true},"result":-1.00243843327159}},"exampleRequest":{"returns":[0.02,0.015,0.03,-0.01,0.025,0.018,0.022,0.012],"risk_free":0.02,"periods_per_year":12},"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","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.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_tt4-kMHKmEkd_SHZthZCg","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","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 from a series of returns, optional risk-free rate, and annualization frequency using exact arithmetic","exampleAgentPrompt":"Calculate the Sharpe ratio for this series of monthly returns: [0.02, -0.01, 0.03, 0.015, -0.005, 0.04, 0.01, -0.02, 0.025, 0.03, 0.005, 0.02], using a risk-free rate of 0.04 and 12 periods per year.","exampleUseCases":null,"resultDescription":"Returns a JSON object with a 'result' field containing the computed Sharpe ratio (annualized if periods_per_year is provided) and a 'meta' object with details about the computation such as mean return, standard deviation, and excess return statistics.","failureModes":["Empty returns array — returns an error indicating insufficient data","Returns array with zero standard deviation (all identical values) — division by zero scenario, likely returns null or error","Invalid type for returns elements (non-numeric) — schema validation error","Missing required 'returns' field — 400-level validation error","Periods per year of zero — division by zero or error response"],"whenToPreferThis":"Use this endpoint when you need deterministic, exact Sharpe ratio computation that an LLM might calculate incorrectly due to floating-point imprecision or hallucination. Prefer this over asking an LLM to do the math inline, especially when you have a specific risk-free rate and annualization period and need a verifiable result for financial reporting or automated trading strategy evaluation.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T18:57:16.941Z","isFirstParty":false}