{"uid":"cap_opWULEhWGrvbpXaFVPubN","slug":"impermanent-loss-cpmm-calculator-42870c7c","name":"Impermanent Loss CPMM Calculator","description":"Classic CPMM impermanent loss from price ratio. Call when LP risk before providing liquidity. Returns il_fraction and il_pct as deterministic JSON for $0.001 USDC via x402 on Base. First-party local math only—no RPC, live market feed, API keys, storage, or mediagen. Advisory only; the caller owns capital, risk, and production controls.","url":"https://api.delx.ai/api/v1/x402/il-constant-product","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"price_ratio":{"type":"number","description":"New/old price ratio for IL math"}}},"responseSchema":{"type":"json","example":{"il_pct":-2.02041028867288,"schema":"delx/util-il-constant-product/v1","il_fraction":-0.0202041028867288}},"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_S4VkvDlynPVSm1mgBhJVp","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 impermanent loss fraction and percentage for a constant-product market maker (CPMM/x*y=k) LP position given a price ratio change","exampleAgentPrompt":"Before I add liquidity to this pool, can you calculate the impermanent loss if the price ratio moves to 2.0 (i.e., price doubles from when I entered)?","exampleUseCases":[{"title":"Pre-deposit LP risk check","prompt":"I'm about to provide liquidity to a CPMM pool and the token I'm depositing has gone up 50% in price since the pool was seeded — what's my impermanent loss at a price ratio of 1.5?"},{"title":"Downside scenario stress test","prompt":"If the price of my pooled asset drops to half its original value, what impermanent loss fraction and percentage would I be looking at on a constant-product AMM? Price ratio would be 0.5."},{"title":"Multi-scenario IL comparison","prompt":"I want to compare impermanent loss across three scenarios for a CPMM pool — can you calculate IL for a price ratio of 1.25 so I can benchmark it against my other estimates?"}],"resultDescription":"Returns a deterministic JSON object with two fields: il_fraction (impermanent loss as a decimal fraction, e.g. 0.0572) and il_pct (impermanent loss expressed as a percentage, e.g. 5.72). Computed entirely from the supplied price_ratio using the classic CPMM IL formula with no external data sources.","failureModes":["Missing or non-numeric price_ratio field returns a validation error","price_ratio of zero or negative value is mathematically invalid and will return an error","Payment not received or insufficient USDC via x402 results in 402 Payment Required response","Malformed request body returns a 400 Bad Request"],"whenToPreferThis":"Use this endpoint when you need fast, deterministic, offline impermanent loss math for a classic x*y=k constant-product AMM — no API keys, no RPC calls, no live price feed required. Prefer it over general DeFi analytics APIs when you want a pure computation with predictable results, low latency, and no external dependencies. It is ideal for pre-trade risk checks, scenario planning, and advisory outputs where the caller controls the price_ratio input directly.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T06:59:58.475Z","isFirstParty":false}