# ChainRay Impermanent Loss Calculator

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

Computes impermanent loss percentage and dollar impact for liquidity providers given entry and current token prices on a specified blockchain

## Facts

- Endpoint: GET https://chainray.online/impermanent-loss
- 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/chainray-online-97c62ac9
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_F21W923wK471Ponz2yBt_

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 chainray-online-97c62ac9
```

Example prompt: What's my impermanent loss on Base if I entered my LP position at $1800 and the token is now at $2700?

## When to prefer this

Use this endpoint when an agent needs to compute impermanent loss for a DeFi liquidity provider position on Base or other supported chains, especially when on-chain proof of the calculation is desired. Prefer this over manual calculation when you need simulation scenarios across multiple price points in a single call.

## Known failure modes

- Missing entryPrice or currentPrice query params returns a tip message with example usage rather than an error
- Invalid or non-numeric price values may produce unexpected results
- Chain parameter mismatch — service defaults to Base regardless of requested chain
- Network timeout or service unavailability returns HTTP error
- Negative or zero prices may cause formula errors

## How this service works

Computes impermanent loss for liquidity providers using entry and current token prices on a specified chain (supports Base).

## Output

Returns impermanent loss as a percentage, dollar loss per $10,000 invested, the IL formula used (2√(p1/p0)/(1+p1/p0)-1), multiple simulation scenarios across price ranges, an on-chain cryptographic proof anchored to a Base block, and the current timestamp.

## Example request

```json
{
 "input": {
  "type": "http",
  "method": "GET",
  "queryParams": {
   "chain": "ethereum",
   "entryPrice": "1500",
   "currentPrice": "2250"
  }
 }
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "properties": {
      "chain": {
       "type": "string"
      },
      "entryPrice": {
       "type": "string",
       "description": "Token price at LP entry"
      },
      "currentPrice": {
       "type": "string",
       "description": "Current token price"
      }
     }
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/chainray-online-97c62ac9/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from chainray.online](https://www.zero.xyz/host/chainray.online/llms.txt)
