16trust / 100

Impermanent Loss

by Vextorium in Onchain & crypto

x402 APIFailing, checked 1 h ago

Impermanent loss calculator for Uniswap v2 (full range) and v3/v4 concentrated ranges: IL vs holding, out-of-range flag and final token mix.

POST https://api.vextorium.com/v1/impermanent-loss

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
0.0%
Response time
- typical, - slowest 5%
Last check
1 h ago: Amount "0.003" is not in atomic token units
Next check
any minute now

How to call it

# bash or zsh: see the payment challenge (nothing is charged)
curl -g -i -X POST 'https://api.vextorium.com/v1/impermanent-loss' \
  -H 'content-type: application/json' \
  --data-raw '{"final_price":2600,"initial_price":2000,"max_range":2400,"min_range":1800}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fapi.vextorium.com%2Fv1%2Fimpermanent-loss
const res = await pay("https://api.vextorium.com/v1/impermanent-loss", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: "{\"final_price\":2600,\"initial_price\":2000,\"max_range\":2400,\"min_range\":1800}",
});
console.log(await res.json());

Example input

{
  "final_price": 2600,
  "initial_price": 2000,
  "max_range": 2400,
  "min_range": 1800
}

Example output

{
  "final_composition": {
    "token0_pct": 0,
    "token1_pct": 100
  },
  "impermanent_loss_pct": -10.8289,
  "note": "Loss versus holding the tokens, excluding fees. Out of range the position earns no fees.",
  "out_of_range": true,
  "price_change_pct": 30,
  "range": [
    1800
  ],
  "type": "concentrated range (Uniswap v3/v4)"
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
1 h agoAmount "0.003" is not in atomic token units40296 ms$0.003
6 h agoAmount "0.003" is not in atomic token units40275 ms$0.003
10 h agoAmount "0.003" is not in atomic token units40275 ms$0.003
14 h agoAmount "0.003" is not in atomic token units402274 ms$0.003
19 h agoAmount "0.003" is not in atomic token units402115 ms$0.003
23 h agoAmount "0.003" is not in atomic token units40278 ms$0.003
27 h agoAmount "0.003" is not in atomic token units40287 ms$0.003
31 h agoAmount "0.003" is not in atomic token units40271 ms$0.003
35 h agoAmount "0.003" is not in atomic token units40278 ms$0.003
39 h agoAmount "0.003" is not in atomic token units40292 ms$0.003
43 h agoAmount "0.003" is not in atomic token units402104 ms$0.003
2 days agoAmount "0.003" is not in atomic token units402239 ms$0.003
2 days agoAmount "0.003" is not in atomic token units40274 ms$0.003
2 days agoAmount "0.003" is not in atomic token units40277 ms$0.003
2 days agoAmount "0.003" is not in atomic token units40281 ms$0.003