Calculators
AMM impermanent loss calculator API
Compute impermanent loss for a constant-product (x·y=k, Uniswap-v2-style) 50/50 LP using the canonical closed form IL = 2·√k/(1+k) − 1 where k is the price ratio — plus LP-vs-HODL value for a deposit. Deterministic AMM math LLMs get wrong. Answers 'what's my impermanent loss if price 4x','LP vs HODL value','IL for a 50/50 pool'.
Price$0.01per request
MethodPOST
Route/v1/calc/cryptocalc-impermanent-loss
StatusLive
MIME typeapplication/json
Rate limit120/minute
CacheNo cache
calccryptodefiimpermanent-lossammliquidityuniswaplp
API URL
Integration docshttps://x402.hexl.dev/v1/calc/cryptocalc-impermanent-lossExample request
{
"priceRatio": 4,
"deposit": 1000
}Example response
{
"formula": "IL = 2·√k/(1+k) − 1, k = priceEnd/priceStart",
"priceRatio": 4,
"impermanentLoss": 0.2,
"impermanentLossPct": 20,
"valueFactorLpVsHodl": 0.8,
"deposit": 1000,
"hodlValue": 1000,
"lpValue": 800,
"lossVsHodl": 200,
"interpretation": "severe"
}Input schema
{
"type": "object",
"required": [],
"properties": {
"priceRatio": {
"type": "number",
"description": "priceEnd/priceStart ratio k",
"examples": [
4
]
},
"priceStart": {
"type": "number",
"examples": [
2000
]
},
"priceEnd": {
"type": "number",
"examples": [
8000
]
},
"deposit": {
"type": "number",
"description": "initial deposit value in USD",
"examples": [
1000
]
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}