# QuantOracle Impermanent Loss Calculator

> QuantOracle Impermanent Loss Calculator is a paid API for AI agents from api.quantoracle.dev, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-14).

Calculates impermanent loss for AMM liquidity providers given an initial investment, initial price ratio, and current price ratio, returning LP value, hold value, loss amount, loss percentage, and fee breakeven APY.

## Facts

- Endpoint: POST https://api.quantoracle.dev/v1/crypto/impermanent-loss
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-quantoracle-dev-3628c94c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_I_Idg86Nf4K8KO11M07Qz

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability api-quantoracle-dev-3628c94c -d '<json body>'
```

Example prompt: I put $5,000 into a Uniswap v2 liquidity pool when the price ratio was 1.0 — now the price ratio is 1.5. Can you calculate my impermanent loss, what my LP position is worth versus if I had just held, and what fee APY I'd need to break even?

## When to prefer this

Use this endpoint when you need a precise, fast impermanent loss computation for AMM liquidity positions, especially when you need the fee breakeven APY alongside IL percentage and absolute loss figures. Prefer over manual spreadsheet calculations or generic DeFi dashboards when integrating IL risk analysis into automated DeFi portfolio management or agent-driven LP strategies.

## Known failure modes

- Invalid amm_type value (only 'v2' supported, v3 may require additional params)
- Negative or zero price ratios causing mathematical errors
- Missing required fields (initial_investment, current_price_ratio, initial_price_ratio) returning 400
- Extreme price ratios (e.g. 1000x) may produce valid but extreme results
- Payment failure via x402 protocol returning 402 Payment Required

## How this service works

QuantOracle: crypto/impermanent-loss

## Output

Returns the current LP value in USD, the equivalent hold value had the user kept both tokens, the absolute loss amount in USD, the impermanent loss as a percentage, and the fee breakeven APY required to offset the loss — all for the given AMM type and price ratio change.

## Example request

```json
{
 "initial_investment": 5000,
 "current_price_ratio": 1.5,
 "initial_price_ratio": 1
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "amm_type": {
   "enum": [
    "v2",
    "v3"
   ],
   "type": "string",
   "title": "Amm Type",
   "default": "v2",
   "description": "AMM type: v2 (full range) or v3 (concentrated)"
  },
  "lower_tick": {
   "anyOf": [
    {
     "type": "number"
    },
    {
     "type": "null"
    }
   ],
   "title": "Lower Tick",
   "description": "Lower price bound (v3 only)"
  },
  "upper_tick": {
   "anyOf": [
    {
     "type": "number"
    },
    {
     "type": "null"
    }
   ],
   "title": "Upper Tick",
   "description": "Upper price bound (v3 only)"
  },
  "initial_investment": {
   "type": "number",
   "title": "Initial Investment",
   "default": 1000,
   "description": "Initial investment value in USD"
  },
  "current_price_ratio": {
   "type": "number",
   "title": "Current Price Ratio",
   "description": "Current price ratio of token A to token B",
   "exclusiveMinimum": 0
  },
  "initial_price_ratio": {
   "type": "number",
   "title": "Initial Price Ratio",
   "default": 1,
   "description": "Initial price ratio of token A to token B",
   "exclusiveMinimum": 0
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/api-quantoracle-dev-3628c94c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.quantoracle.dev](https://www.zero.xyz/host/api.quantoracle.dev/llms.txt)
