# finmath LP Value vs HODL

> finmath LP Value vs HODL is a paid API for AI agents from finmath.qzqh5rrbkz.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-15).

Calculates the impermanent loss and LP position value compared to simply holding the tokens, given a price ratio and initial position value.

## Facts

- Endpoint: POST https://finmath.qzqh5rrbkz.workers.dev/v1/lp_value_vs_hodl
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/finmath-lp-value-vs-hodl-514d6171
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_e55t3hUuoJkx4dIwuFns2

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 finmath-lp-value-vs-hodl-514d6171 -d '<json body>'
```

Example prompt: I put $10,000 into a Uniswap liquidity pool and the price ratio has since moved to 2.5x — can you calculate my current LP value versus what I'd have if I'd just held the tokens, and tell me the impermanent loss?

## When to prefer this

Use this endpoint when you need exact, deterministic arithmetic for impermanent loss and LP vs HODL comparisons — especially when LLM-native math would introduce rounding or hallucination errors. Prefer over manual calculation or LLM estimation when accuracy matters for DeFi portfolio analysis.

## Known failure modes

- Missing required field price_ratio or initial_value returns a validation error
- price_ratio of 0 or negative may cause division errors or undefined results
- Non-numeric inputs for price_ratio or initial_value return a type error
- Payment failure (HTTP 402) if USDC payment is not provided or insufficient

## How this service works

Deterministic finance and crypto math for AI agents: TradFi (NPV, IRR, XIRR, Black-Scholes + Greeks, bonds, VaR, Sharpe) and DeFi (impermanent loss, perp liquidation, funding, Uniswap v3, health factor, cost basis). Exact, model-free arithmetic that LLMs get wrong — priced per call in USDC.

## Output

Returns a result object containing the computed LP position value, the equivalent HODL value, and the impermanent loss in absolute and/or percentage terms, along with a meta object containing call metadata.

## Example request

```json
{
 "price_ratio": 1.5,
 "initial_value": 1000
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "price_ratio",
  "initial_value"
 ],
 "properties": {
  "price_ratio": {
   "type": "number",
   "description": "price_ratio"
  },
  "initial_value": {
   "type": "number",
   "description": "initial_value"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "result",
  "meta"
 ],
 "properties": {
  "meta": {
   "type": "object"
  },
  "result": {}
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/finmath-lp-value-vs-hodl-514d6171/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from finmath.qzqh5rrbkz.workers.dev](https://www.zero.xyz/host/finmath.qzqh5rrbkz.workers.dev/llms.txt)
