# DeFi Oracle IL Calculator

> DeFi Oracle IL Calculator is a paid API for AI agents from defi-oracle-two.vercel.app, paid per call via x402, $0.05/call, status unknown (last checked 2026-09-15).

Calculates impermanent loss percentage for a given price change, returning scenarios, formula, and interpretation for DeFi liquidity providers.

## Facts

- Endpoint: POST https://defi-oracle-two.vercel.app/api/il-calculator
- Price: $0.05/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/defi-oracle-il-calculator-0614ec0f
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_8Khrtr_p_xMSFTe3I9sXS

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 defi-oracle-il-calculator-0614ec0f -d '<json body>'
```

Example prompt: What would my impermanent loss be if one of my liquidity pool tokens goes up 75% in price? Give me the full breakdown with scenarios and interpretation.

## When to prefer this

Use this endpoint when an agent needs to quantify the impermanent loss risk for an AMM/liquidity pool position given a specific projected price change. Ideal for DeFi portfolio risk assessment, LP strategy evaluation, and educating users about IL before they deposit into a pool.

## Known failure modes

- Missing required field price_change_pct returns validation error
- Non-numeric price_change_pct causes schema error
- Payment failure via x402 USDC on Base returns 402 status
- Extreme or out-of-range price change values may produce edge-case outputs
- Service downtime on Vercel hosting returns 5xx

## How this service works

DeFi data for AI agents — yield rates, swap routes, IL calculator, liquidation risk, MEV scanner, TVL tracking. Powered by DeFiLlama + on-chain RPC data. Pay with USDC on Base via x402.

## Output

Returns the impermanent loss percentage, multiple price-change scenarios, the mathematical formula used, and a plain-English interpretation of the loss magnitude — all computed for the given price change input.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "price_change_pct"
 ],
 "properties": {
  "price_change_pct": {
   "type": "number",
   "description": "Price change percentage (e.g. 50 for +50%)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "input": {
   "type": "object"
  },
  "formula": {
   "type": "string"
  },
  "scenarios": {
   "type": "array"
  },
  "interpretation": {
   "type": "string"
  },
  "impermanent_loss_pct": {
   "type": "number"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/defi-oracle-il-calculator-0614ec0f/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from defi-oracle-two.vercel.app](https://www.zero.xyz/host/defi-oracle-two.vercel.app/llms.txt)
