Impermanent Loss
workflow.run_impermanent_lossImpermanent loss for a liquidity-pool position: compares providing liquidity against simply holding the same tokens, at a manually-supplied entry and current price. Two modes: full_range (standard 50/50 constant-product pool, the textbook 2*sqrt(k)/(1+k)-1 closed form) or concentrated (a Uniswap-V3-style position confined to [lowerPrice, upperPrice] - IL is always worse than full_range for the same price move when the range is tight, and the position is fully single-asset, no longer earning fees, once price exits the range). impermanentLossPct is always <= 0 and is measured relative to the quote token (dimensionless, exact regardless of what the quote token is); the optional dollar figures additionally assume the quote token's own USD price stayed roughly stable (true for a stablecoin-quoted pool). Use when user asks "how much am I losing to impermanent loss?" or "is this LP position still worth it after fees?". Returns: impermanentLossPct, lpValueMultiplier, hodlValueMultiplier, inRange, lossUsd/netResultUsd (null unless depositValueUsd given).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Default full_range. | |
| entryPrice | Yes | Base token's price in quote-token terms when liquidity was deposited | |
| lowerPrice | No | Range lower bound - required for concentrated mode, must be below entryPrice | |
| upperPrice | No | Range upper bound - required for concentrated mode, must be above entryPrice | |
| currentPrice | Yes | Base token's current price in quote-token terms | |
| feesEarnedUsd | No | Optional trading fees earned so far in USD (default 0), folded into netResultUsd alongside lossUsd | |
| depositValueUsd | No | Optional: USD value deposited at entry, to also report dollar-denominated lpValueUsd/hodlValueUsd/lossUsd |