{"uid":"cap_oRfjjzasoLLMI53ZHu9Pm","slug":"finmath-impermanent-loss-calculator-3991f4cd","name":"finmath Impermanent Loss 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/impermanent_loss","method":"POST","headers":{},"bodySchema":{"type":"object","required":["price_ratio"],"properties":{"price_ratio":{"type":"number","description":"price_ratio"}}},"responseSchema":{"type":"object","required":["result","meta"],"properties":{"meta":{"type":"object"},"result":{}}},"example":{"request":{"price_ratio":1.5},"response":{"meta":{"tool":"impermanent_loss","model":true,"disclaimer":"Deterministic calculation utility. Not financial, investment, or trading advice.","assumptions":["50/50 constant-product (Uniswap-v2 style) pool","excludes LP fees earned (fees can offset or exceed IL)"],"deterministic":true},"result":-0.020204102886728803}},"exampleRequest":{"price_ratio":1.5},"tags":["x402"],"displayCostAmount":"0.001","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.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_wW3xX3JgupJi11KYQ75r5","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":"Calculates the impermanent loss percentage for a DeFi liquidity provider given a price ratio between the current and initial asset prices.","exampleAgentPrompt":"What's the impermanent loss if the price ratio between my two assets is now 2.5x what it was when I deposited into the liquidity pool?","exampleUseCases":null,"resultDescription":"Returns a result object containing the computed impermanent loss (typically as a decimal or percentage) along with metadata about the calculation. For example, a price_ratio of 2.0 would return the well-known ~5.72% impermanent loss figure for a constant-product AMM.","failureModes":["Missing required price_ratio field returns a validation error","price_ratio of 0 or negative value may cause a division error or invalid result","Non-numeric price_ratio returns a schema validation error","Network timeout on Cloudflare Worker edge node","Payment failure (402) if USDC balance is insufficient for the $0.001 per-call fee"],"whenToPreferThis":"Use this endpoint when you need exact, deterministic impermanent loss calculations for AMM liquidity positions and cannot rely on LLM arithmetic (which is error-prone for financial math). Prefer this over manual calculation or general-purpose LLMs for any production DeFi portfolio tracking, risk assessment, or LP strategy evaluation.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T18:55:37.425Z","isFirstParty":false}