{"uid":"cap_788n84bh-0Vdg_JipOQuv","slug":"impermanent-loss-calculator-constant-product-amm-4124a1f6","name":"Impermanent Loss Calculator (Constant-Product AMM)","description":"Exact EVM address, calldata, Uniswap V2/V3 and impermanent-loss math. Pay per call in USDC on Base via x402.","url":"https://golf-evm-math.x402-evm-math.workers.dev/defi/impermanent-loss?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","properties":{}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":{"type":"json","example":{"impermanent_loss_pct":"-5.7191"}},"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_x5VTL2qurcKHWrEobqPgv","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 constant-product liquidity pool position given the ratio of new price to entry price.","exampleAgentPrompt":"What's the impermanent loss percentage for a Uniswap v2 LP position if ETH price has doubled since I entered — so the price ratio is 2.0?","exampleUseCases":[{"title":"Evaluate LP position after ETH rally","prompt":"ETH price has gone up 3x since I added liquidity to a Uniswap v2 pool — can you tell me what percentage of impermanent loss I've suffered with a price ratio of 3.0?"},{"title":"Compare IL across multiple price scenarios","prompt":"I'm deciding whether to LP on a constant-product AMM. What would my impermanent loss be if the price ratio ends up at 1.5, 2.0, or 4.0 versus my entry price?"},{"title":"Assess risk before adding liquidity","prompt":"Before I add liquidity to this pool, can you calculate the impermanent loss I'd face if the price drops to half my entry price — so price ratio of 0.5?"}],"resultDescription":"Returns a JSON object containing `impermanent_loss_pct` as a decimal string representing the percentage loss in portfolio value relative to simply holding the two assets, e.g. '-5.7191' meaning ~5.72% value loss due to impermanent loss.","failureModes":["Missing or invalid price_ratio parameter returns an error","Price ratio of exactly 1.0 returns 0% impermanent loss (no price change)","Negative price ratios are mathematically invalid and may return an error","Payment not included or insufficient USDC results in HTTP 402 response blocking access"],"whenToPreferThis":"Use this endpoint when you need a precise, on-demand impermanent loss calculation for a constant-product (x*y=k) AMM such as Uniswap V2 or SushiSwap, especially within an automated DeFi agent workflow. Prefer it over manual formula computation or general-purpose LLM math for accuracy and pay-per-call cost efficiency at $0.001 per call.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-28T06:42:41.488Z","isFirstParty":false,"canonicalSlug":"impermanent-loss-calculator-constant-product-amm-4124a1f6"}