omni_impermanent_loss_amm
Calculate exact impermanent loss and dollar divergence for Uniswap, SushiSwap, or PancakeSwap constant-product liquidity positions using deposit amount and price ratio.
Instructions
Automated Market Maker (AMM) Impermanent Loss Calculator. Calculate exact impermanent loss (IL) for liquidity providers on Uniswap, SushiSwap, and PancakeSwap constant-product (x·y=k) pools. Discipline: CRYPTO. Governing mathematical model / formula: IL = 2 · √k / (1 + k) - 1 | where k = Price Ratio (P_new / P_initial).
USAGE GUIDELINES:
WHEN TO USE: Invoke for deterministic calculation of impermanent_loss_pct (Impermanent Loss Percentage), current_pool_value (Current Value in AMM Pool), hodl_value_usd (Value If Held (HODL Strategy)), net_dollar_divergence (Opportunity Cost Lost to Arbitrage) using initial_deposit_usd (Initial Liquidity Deposit ($ USD)), price_change_ratio (Price Multiplier of Token A relative to B (k) in x (e.g. 2x = 100% gain)). Guarantees exact machine floating-point precision, eliminating LLM arithmetic mistakes and formula hallucinations.
WHEN NOT TO USE: Do not use for qualitative evaluations or unquantified reasoning. All input parameters must be valid numerical values.
DISAMBIGUATION & BOUNDARIES:
Use this dedicated specialist tool for 'Automated Market Maker (AMM) Impermanent Loss Calculator' rather than generic dispatchers like omni_universal_query.
For multi-calculation chained jobs, use 'omni_batch_calculate'.
To inspect schema fields, see 'omni_describe_solver'.
BEHAVIOR & SAFETY:
Pure deterministic computation with machine floating-point precision.
Read-only, idempotent, and stateless. Zero side effects or persistent state mutations.
Input validation: All arguments are validated against physical and domain bounds. Out-of-bounds inputs return a safe diagnostic error status without throwing runtime exceptions.
RETURNS:
Structured JSON object containing:
status (string): "success" on valid execution or "error" if validation fails
calculator (string): "impermanent-loss-amm"
category (string): "crypto"
name (string): "Automated Market Maker (AMM) Impermanent Loss Calculator"
formula (string): Governing mathematical formula string
inputs (object): Echoed input parameter dictionary with applied defaults
metrics (object): Dictionary of computed outputs:
metrics.impermanent_loss_pct (Impermanent Loss Percentage): Formatted display string (e.g. '-5.72%')
metrics.current_pool_value (Current Value in AMM Pool): Formatted display string (e.g. '$13,333.33')
metrics.hodl_value_usd (Value If Held (HODL Strategy)): Formatted display string (e.g. '$14,142.14')
metrics.net_dollar_divergence (Opportunity Cost Lost to Arbitrage): Formatted display string (e.g. '-$808.81')
execution_time_ms (number): Latency in milliseconds.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "omni_impermanent_loss_amm"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| price_change_ratio | No | Price Multiplier of Token A relative to B (k) (x (e.g. 2x = 100% gain)). Relative price shift between pool assets. Default: 2. Min: 0.05. Max: 20. | |
| initial_deposit_usd | No | Initial Liquidity Deposit ($ USD). Total 50/50 token pair value deposited into pool. Default: 10000. Min: 100. Max: 1000000. |