x402AgentsToolsHub

Impermanent Loss Calculator

Compute impermanent loss for a 50/50 constant-product AMM position at any relative price move, with a reference table of common moves. Deterministic closed-form — the exact divergence number an LP should compare against farming rewards.

Worked examples

Token doubled (2×)

GET /api/v1/crypto/impermanent-loss?priceChangePct=100

Result: +100% move → IL -5.7191% of holdings

Token halved

GET /api/v1/crypto/impermanent-loss?priceChangePct=-50

Result: -50% move → IL -5.7191% of holdings

Mild 25% move

GET /api/v1/crypto/impermanent-loss?priceChangePct=25

Result: +25% move → IL -0.6192% of holdings

Machine API (x402)

$0.002 / call

This tool is also a JSON API for AI agents. Requests without payment receive 402 Payment Required plus instructions; agents pay USDC on Base via the x402 protocol — no accounts, no API keys.

GET /api/v1/crypto/impermanent-loss?priceChangePct=100 HTTP/1.1
Host: agentstoolshub.com

→ 402 (payment required, instructions in headers)
→ 200 (after X-PAYMENT header; JSON body below)

{
  "tool": "crypto/impermanent-loss",
  "input": {"priceChangePct":100},
  "result": { "value": -5.7191, "answer": "+100% move → IL -5.7191% of holdings" }
}

Agent docs: /llms.txt · OpenAPI spec · integration guide

About this tool

Exact impermanent loss for a 50/50 constant-product pool at any price ratio — plus the canonical reference table (1.25×→0.6%, 2×→5.7%, 5×→25.5%). Use it to check whether a pool's fees and rewards actually beat holding, before providing liquidity.

IL = 2√r / (1 + r) − 1, r = relative price of A in terms of B

Frequently asked questions

Why is loss 'impermanent'?

It disappears if the price ratio returns to the entry point. If you withdraw while the ratio differs, it becomes a realized loss — permanent.

Does this include fees?

No — this is pure divergence loss. Compare it against accumulated fees and incentives over the same period to know your net position vs HODL.

Related tools