Estimate fees versus impermanent loss
estimate_lpEstimate fees versus impermanent loss. Use this when the user gives numbers for a what-if and wants to know whether swap fees cover impermanent loss, gas, and exit cost. It needs no pool and reads no live data. Pass price_now, holding_days, and fee_apr_percent, for example price_now 2500, holding_days 14, fee_apr_percent 40. Add price_lower and price_upper for a concentrated range, or omit both for the full-range formula. Optionally pass price_later, capital_usd, gas_usd, and exit_cost_usd. Returns the formula, the fee fraction, the impermanent loss fraction, whether fees cover it and the costs you passed, a plain break-even price line, and break-even prices from a sample. It does not look up gas or recommend a position. To read a real pool's volume and fee APR, use check_pool.
Example tool call
This call uses example arguments supplied in the tool’s input schema.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"price_now": 100,
"price_later": 110,
"price_lower": 80,
"price_upper": 120,
"holding_days": 30,
"fee_apr_percent": 20
},
"name": "estimate_lp"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gas_usd | No | Gas you expect to pay. Not looked up | |
| price_now | Yes | Current price, quote token per base token, such as 2500 for ETH in USDC | |
| capital_usd | No | Position size, so gas and exit cost can be turned into a fraction of the position | |
| price_later | No | A later price to score. Omit to get break-even prices and the range edges only | |
| price_lower | No | Lower bound of a concentrated range. Omit, with price_upper, for the full-range formula | |
| price_upper | No | Upper bound of a concentrated range | |
| holding_days | Yes | How many days the fee APR is applied, a whole number from 1 to 365, such as 14 | |
| exit_cost_usd | No | Other exit cost. Not looked up | |
| fee_apr_percent | Yes | Annualized fee APR in percent, not a fraction: 40 means 40%. For example the 1-day fee APR from check_pool |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| notice | Yes | ||
| status | Yes | ||
| formula | Yes | ||
| gas_usd | No | ||
| warnings | No | ||
| assumptions | Yes | ||
| fee_fraction | Yes | Expected fee income over the holding period, as a fraction of the position: 0.0153 means 1.53% | |
| in_range_now | No | Whether price_now is inside the range. null for the full-range formula | |
| cost_fraction | No | (gas_usd + exit_cost_usd) / capital_usd. null without capital_usd | |
| exit_cost_usd | No | ||
| sampled_edges | No | ||
| break_even_line | No | ||
| fee_apr_formula | Yes | ||
| break_even_prices | Yes | Later prices where the net result crosses zero, from a sample | |
| il_fraction_at_later | No | Impermanent loss at price_later as a negative fraction. null without price_later | |
| fees_cover_il_and_costs | Yes | null without price_later | |
| net_versus_holding_at_later | No | fee_fraction + il_fraction_at_later - cost_fraction |