# Delx Commerce — Impermanent Loss Calculator (Constant Product AMM)

> Delx Commerce — Impermanent Loss Calculator (Constant Product AMM) is a paid API for AI agents from commerce.delx.ai, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-02).

Calculates the impermanent loss percentage and fraction for a constant-product AMM position given a price ratio change

## Facts

- Endpoint: POST https://commerce.delx.ai/api/v1/x402/il-constant-product?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/delx-commerce-impermanent-loss-calculator-constant-product-amm-9a3feabf
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_8VvaR2f95WiUSqxsb-NmU

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 delx-commerce-impermanent-loss-calculator-constant-product-amm-9a3feabf -d '<json body>'
```

Example prompt: What's my impermanent loss if the price ratio between the two tokens in my constant-product AMM pool has changed by a factor of 1.5 (new price is 1.5x the old price)?

## When to prefer this

Use this endpoint when you need a precise, formula-based computation of impermanent loss for a constant-product (x*y=k) AMM, such as Uniswap v2 or SushiSwap, given a known price ratio change. It is ideal for agents performing DeFi risk analysis, LP position tracking, or portfolio reporting without needing to integrate a full on-chain data provider. Pay-per-call USDC pricing via x402 means no API key management.

## Known failure modes

- Missing price_ratio field returns a validation error
- Non-numeric price_ratio causes a bad request response
- price_ratio of 0 or negative may cause division errors or undefined math
- Payment not settled via x402 protocol results in 402 Payment Required response

## How this service works

Pay-per-result APIs for agents. No signup. Exact price. Verifiable delivery. USDC on Base + Solana via x402.

## Output

Returns a JSON object with the impermanent loss as a percentage (il_pct, e.g. -2.02) and as a decimal fraction (il_fraction, e.g. -0.0202), along with a schema identifier string. Negative values indicate value lost relative to simply holding the tokens.

## 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/delx-commerce-impermanent-loss-calculator-constant-product-amm-9a3feabf/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from commerce.delx.ai](https://www.zero.xyz/host/commerce.delx.ai/llms.txt)
