{"uid":"cap_EfIj0OfhggjI-krL8GQTb","slug":"impermanent-loss-calculator-69264c3c","name":"Impermanent Loss Calculator","description":"Impermanent loss % and hold-vs-LP value for a 50/50 pool from the price ratio (new/old) of the volatile asset; nets optional fees earned to show true LP outcome.","url":"https://api.24klabs.ai/api/v1/impermanent-loss-calculator","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"fees_earned":{"type":"number"},"price_ratio":{"type":"number"},"initial_value":{"type":"number"}}},"responseSchema":{"type":"json","example":{"lp_value":1414.21,"hold_value":1500,"impermanent_loss_pct":-5.72}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.003","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.003/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.003","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.003","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_ROGn3_h8m2GxpsEeaT9g_","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.003","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Calculates impermanent loss percentage and hold-vs-LP value comparison for a 50/50 liquidity pool given the price ratio of the volatile asset, optionally netting fees earned.","exampleAgentPrompt":"Calculate the impermanent loss for a 50/50 liquidity pool where the token price has gone from $1.00 to $2.50 — and factor in $120 in fees I earned to show my true LP outcome.","exampleUseCases":[{"title":"ETH/USDC pool price surge analysis","prompt":"My ETH/USDC 50/50 LP position started when ETH was at $1,800 and it's now at $3,200. What's my impermanent loss percentage and how does my LP value compare to if I had just held? I've earned about $85 in fees."},{"title":"Checking if fees offset IL on a down move","prompt":"I provided liquidity to a 50/50 pool when the token was worth $5 and it's dropped to $2. I've collected $0.30 in fees per dollar invested — calculate whether those fees were enough to cover my impermanent loss."},{"title":"Pre-trade LP profitability estimate","prompt":"If I'm thinking about adding liquidity to a 50/50 AMM pool and the price of the volatile token could go up 3x, how bad would my impermanent loss be and what fee earnings would I need to break even compared to just holding?"}],"resultDescription":"Returns the impermanent loss percentage, the current value of the LP position, the equivalent hold value (if tokens had been held instead of deposited), and optionally the net LP outcome after subtracting or adding fees earned — allowing a direct comparison of LP vs hold strategy.","failureModes":["Invalid or missing price ratio (e.g. zero or negative ratio) returns validation error","Fees provided as negative number may cause computation error","Price ratio of exactly 1.0 returns 0% impermanent loss (valid edge case)","Missing required price ratio field returns 400-level error"],"whenToPreferThis":"Use this endpoint when you need a precise, fee-adjusted impermanent loss calculation for a standard 50/50 AMM liquidity pool. Prefer this over manual calculation or general DeFi analytics APIs when you specifically need the hold-vs-LP value comparison with optional fee netting in a single call. Best suited for DeFi portfolio trackers, LP decision-support agents, and yield optimization workflows.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T13:00:28.609Z","isFirstParty":false}