{"uid":"cap_L0k9zlgfF_y8Dwzkn1kBg","slug":"httpay-impermanent-loss-calculator-5adc50c9","name":"HTTPay Impermanent Loss Calculator","description":"Calculate impermanent loss for any AMM LP position. Params: ?token0Price=2000&token1Price=1&currentToken0Price=2500&currentToken1Price=1&initialValueUsd=10000. Returns IL%, USD impact, holding comparison, and breakeven APY.","url":"https://httpay.xyz/api/impermanent-loss-calc","method":"POST","headers":{},"bodySchema":null,"responseSchema":{"type":"json","example":{"description":"Calculate impermanent loss for any AMM LP position. Params: ?token0Price=2000&token1Price=1&currentToken0Price=2500&currentToken1Price=1&initialValueUsd=10000. Returns IL%, USD impact, holding comparison, and breakeven APY."}},"example":{"request":{"token0Price":2000,"token1Price":1,"initialValueUsd":10000,"currentToken0Price":2500,"currentToken1Price":1},"response":{"meta":{"x402":true,"poweredBy":"Alfred Zhang 🫡"},"inputs":{"daysHeld":30,"initialValueUsd":10000,"token0CurrentPrice":2500,"token0InitialPrice":2000,"token1CurrentPrice":1,"token1InitialPrice":1},"formula":"IL = 2√(k)/(1+k) − 1 where k = (currentPrice0/currentPrice1)/(initialPrice0/initialPrice1)","breakeven":{"days_held":30,"interpretation":"To break even vs holding, you need 159.62% APY in fees over 30 days","breakeven_apy_pct":"159.62%","fee_income_needed_usd":"$1311.92"},"dataSource":"Pure math — no external API calls","price_ratio":{"current":"2500.000000","initial":"2000.000000","change_pct":"25.00%","change_ratio":"1.250000"},"calculatedAt":"2026-06-12T04:46:59.421Z","recommendation":"Low IL — providing liquidity is likely profitable if fees > 2% APY","position_values":{"hold_gain_loss_usd":"+$1250.00","hold_value_now_usd":"$11250.00","pool_gain_loss_usd":"$-61.92","pool_value_now_usd":"$9938.08","lp_vs_hold_difference":"$-1311.92","initial_investment_usd":"$10000.00"},"impermanent_loss":{"note":"Negative IL means LP is worth less than simply holding","il_pct":"-0.6192%","il_usd":"$-1311.92","severity":"MINIMAL"}}},"exampleRequest":{"token0Price":2000,"token1Price":1,"initialValueUsd":10000,"currentToken0Price":2500,"currentToken1Price":1},"tags":["x402"],"displayCostAmount":"0.01","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.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_sdDWbUtA5ZCToG5RJokr2","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Calculates impermanent loss for an AMM LP position given initial and current token prices, returning IL%, USD impact, holding comparison, and breakeven APY.","exampleAgentPrompt":"Can you calculate the impermanent loss on my $10,000 ETH/USDC LP position where I entered when ETH was $2,000 and USDC was $1, and now ETH is $2,500 and USDC is still $1 — and tell me the IL%, dollar impact, and what APY I'd need to break even?","exampleUseCases":null,"resultDescription":"Returns the impermanent loss percentage, the dollar value lost due to IL compared to simply holding, a comparison of LP value vs hold value, and the minimum APY the position would need to earn to break even against the IL.","failureModes":["Missing required query params (token0Price, token1Price, currentToken0Price, currentToken1Price, initialValueUsd) returns an error","Zero or negative price inputs may produce undefined or error responses","Payment failure (insufficient USDC balance or x402 auth) returns HTTP 402","Invalid numeric formats return parsing errors"],"whenToPreferThis":"Use this endpoint when an agent needs to programmatically compute impermanent loss for any AMM LP position without maintaining its own math, especially when integrating DeFi yield analysis or portfolio tracking. It is superior to manual calculation for agents that need IL%, dollar impact, and breakeven APY in one call. Pay-per-call model makes it cost-effective for occasional queries without API key management.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T06:43:28.714Z","isFirstParty":false}