Lp Position Math
lp_position_mathImpermanent loss, hold-vs-pool value and basis split for a two-asset constant-product pool. FREE.
Typical input {"deposit": {"asset_a": "ETH", "qty_a": "1", "price_a": "2000", "asset_b": "USDC", "qty_b": "2000", "price_b": "1"}, "current_prices": {"ETH": "3000", "USDC": "1"}} returns {"il_pct": "-2.02", "hold_value": "5000.00", "pool_value": "4898.98", "deposit_value": "4000.00", "basis_split": {...}}. The pool value assumes x*y=k with no fees; add fees_earned_fiat to see the net. The basis split is the deposit's fiat value at deposit, allocated by each side's share, which is the arithmetic a lot engine needs if the LP position is treated as one asset. Use for DeFi position reviews. Not a determination of whether the deposit is a taxable exchange. Errors: on invalid, missing, or malformed input this tool never raises a protocol error — it returns {"error": ""} (for example {"error": "deposit and current_prices must be objects"}). Every call is read-only and idempotent, so after correcting the input it is always safe to retry.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deposit | Yes | asset_a, qty_a, price_a, asset_b, qty_b, price_b at the time of deposit. | |
| current_prices | Yes | {asset: price} for both assets now. | |
| fees_earned_fiat | No | fees accrued to the position, in fiat. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||