# Impermanent Loss CPMM Calculator

> Impermanent Loss CPMM Calculator is a paid API for AI agents from api.delx.ai, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Calculates impermanent loss fraction and percentage for a constant-product market maker (CPMM/x*y=k) LP position given a price ratio change

## Facts

- Endpoint: POST https://api.delx.ai/api/v1/x402/il-constant-product
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/impermanent-loss-cpmm-calculator-42870c7c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_opWULEhWGrvbpXaFVPubN

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 impermanent-loss-cpmm-calculator-42870c7c -d '<json body>'
```

Example prompt: 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)?

## When to prefer this

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.

## Known failure modes

- 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

## How this service works

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.

## Output

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.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "price_ratio": {
   "type": "number",
   "description": "New/old price ratio for IL math"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "il_pct": -2.02041028867288,
  "schema": "delx/util-il-constant-product/v1",
  "il_fraction": -0.0202041028867288
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/impermanent-loss-cpmm-calculator-42870c7c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.delx.ai](https://www.zero.xyz/host/api.delx.ai/llms.txt)
