# HTTPay Impermanent Loss Calculator

> HTTPay Impermanent Loss Calculator is a paid API for AI agents from httpay.xyz, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-14).

Calculates impermanent loss for an AMM LP position given initial and current token prices, returning IL%, USD impact, holding comparison, and breakeven APY.

## Facts

- Endpoint: POST https://httpay.xyz/api/impermanent-loss-calc
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/httpay-impermanent-loss-calculator-5adc50c9
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_L0k9zlgfF_y8Dwzkn1kBg

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 httpay-impermanent-loss-calculator-5adc50c9 -d '<json body>'
```

Example prompt: Can you calculate the impermanent loss on my $10,000 ETH/USDC LP position where I entered when ETH was $2,000 and USDC was $1, and now ETH is $2,500 and USDC is still $1 — and tell me the IL%, dollar impact, and what APY I'd need to break even?

## When to prefer this

Use this endpoint when an agent needs to programmatically compute impermanent loss for any AMM LP position without maintaining its own math, especially when integrating DeFi yield analysis or portfolio tracking. It is superior to manual calculation for agents that need IL%, dollar impact, and breakeven APY in one call. Pay-per-call model makes it cost-effective for occasional queries without API key management.

## Known failure modes

- Missing required query params (token0Price, token1Price, currentToken0Price, currentToken1Price, initialValueUsd) returns an error
- Zero or negative price inputs may produce undefined or error responses
- Payment failure (insufficient USDC balance or x402 auth) returns HTTP 402
- Invalid numeric formats return parsing errors

## How this service works

Calculate impermanent loss for any AMM LP position. Params: ?token0Price=2000&token1Price=1&currentToken0Price=2500&currentToken1Price=1&initialValueUsd=10000. Returns IL%, USD impact, holding comparison, and breakeven APY.

## Output

Returns the impermanent loss percentage, the dollar value lost due to IL compared to simply holding, a comparison of LP value vs hold value, and the minimum APY the position would need to earn to break even against the IL.

## Example request

```json
{
 "token0Price": 2000,
 "token1Price": 1,
 "initialValueUsd": 10000,
 "currentToken0Price": 2500,
 "currentToken1Price": 1
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "description": "Calculate impermanent loss for any AMM LP position. Params: ?token0Price=2000&token1Price=1&currentToken0Price=2500&currentToken1Price=1&initialValueUsd=10000. Returns IL%, USD impact, holding comparison, and breakeven APY."
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/httpay-impermanent-loss-calculator-5adc50c9/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from httpay.xyz](https://www.zero.xyz/host/httpay.xyz/llms.txt)
