# SperaxOS IL Calculator

> SperaxOS IL Calculator is a paid API for AI agents from chat.sperax.io, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-12).

Calculates impermanent loss (IL) for a DeFi liquidity position given token pair, price range, investment size, and entry/current prices

## Facts

- Endpoint: POST https://chat.sperax.io/api/x402/tools/il-calculator/calculateIL?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-12
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/speraxos-il-calculator-f8ddbcee
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_eALCP4ZT1QX3t0NnL6TKi

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 speraxos-il-calculator-f8ddbcee -d '<json body>'
```

Example prompt: Calculate the impermanent loss on my ETH/USDC position: I put in $10,000 at an entry ratio of 2000 (ETH/USDC), the current ratio is 2500, fee tier is 0.3%, I've been in the position 45 days, and my price range is 1800 to 3000.

## When to prefer this

Use this endpoint when you need programmatic, on-demand impermanent loss calculations for DeFi liquidity positions, especially concentrated liquidity ranges. It is ideal for AI agents managing or monitoring LP positions that need quantified IL data without requiring an API key — paying $0.001 USDC per call via x402. Prefer this over manual calculation tools when integrating IL awareness into automated DeFi workflows or portfolio monitoring agents.

## Known failure modes

- Missing required fields (token0, token1, investmentUsd, entryPriceRatio) returns validation error
- Invalid or unrecognized token symbols may fail live price fetch
- Payment failure via x402 if USDC balance insufficient or x402 protocol not properly implemented
- Fee tier provided in wrong format (e.g. 3 instead of 0.003) may produce incorrect results
- Price range bounds illogical (priceLower >= priceUpper) may return error
- Network timeout if live price fetch for currentPriceRatio is slow

## How this service works

AI-powered DeFi intelligence APIs payable via the x402 HTTP payment protocol. No API key required — pay per request with USDC on Base. Identity-only (SIWX) endpoints are free for wallets with an agentcash identity.

## Output

Returns computed impermanent loss figures for the specified liquidity position, including IL amount in USD and percentage, estimated fee earnings based on fee tier and days active, and likely a net P&L comparison showing whether fees have offset the IL.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "token0": {
   "type": "string",
   "description": "First token symbol (e.g. \"ETH\")."
  },
  "token1": {
   "type": "string",
   "description": "Second token symbol (e.g. \"USDC\")."
  },
  "feeTier": {
   "type": "number",
   "description": "Fee tier as decimal (e.g. 0.003 for 0.3%). Used for fee earnings estimation."
  },
  "daysActive": {
   "type": "number",
   "description": "Days the position has been active (for fee earnings estimation)."
  },
  "priceLower": {
   "type": "number",
   "description": "For concentrated liquidity: lower price bound of the range."
  },
  "priceUpper": {
   "type": "number",
   "description": "For concentrated liquidity: upper price bound of the range."
  },
  "investmentUsd": {
   "type": "number",
   "description": "Total investment in USD."
  },
  "entryPriceRatio": {
   "type": "number",
   "description": "Entry price ratio (token0/token1) when the position was opened."
  },
  "currentPriceRatio": {
   "type": "number",
   "description": "Current price ratio (token0/token1). If omitted, fetched from live data."
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/speraxos-il-calculator-f8ddbcee/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from chat.sperax.io](https://www.zero.xyz/host/chat.sperax.io/llms.txt)
