run_lp_backtest
Where choosing a range answers “what would this band have collected”,
this answers what happens when the position is allowed to move.
Give it a pool, named as chain|PAIR|feePpm (for example
ethereum|USDC/WETH|500), a strategy from
list_lp_strategies, a window and a size.
Naming your own range
Two strategies take a band you write in real prices: the way an LP interface shows a range, and the way people say it. They are marked[band] in
the strategy list.
Every other strategy derives its own band and refuses bounds rather than
holding them for the whole window under a moving strategy’s name. Asking
recentre for 2,800–3,200 means nothing, because a recentring band moves.
A half-width cannot say what a price range says. “2,800 to 3,200” is only
expressible as “the opening price plus or minus X” when it happens to be
symmetric around the price the window opened at, and around an opening price of
$3,353 it is not.
The band decides the answer
Same pool, same size, same window. 2025-01-01 to 2026-09-11, $100,000 inethereum|USDC/WETH|500:
A narrower band earns more while it holds and holds for less of the window.
The best of these is neither the widest nor the tightest.
The strategy’s own inputs
params carries them, as numbers: rung count, half-width, geometry.
list_lp_strategies names every input a strategy
takes, with its default and its range.
If you omit it, each input takes its default, and the answer is for those
defaults rather than for the setup you meant. A ladder runs at four rungs however many you meant:
More rungs leave less of your money working at any moment. A four-rung ladder
runs at about a quarter utilisation. The strategy claims this, and here you can
measure it.
In range comes first
Three numbers, never one
The result has three numbers: fees, impermanent loss, and the total against simply holding the same two tokens. The third is the one that answers “was this worth doing”: in the run above the answer is yes, narrowly, because holding did worse.It tells you when its own inputs were poor
Two warnings come back and both change how much the figures are worth:- The indexer priced none of this pool’s volume. Fees were rebuilt from the stable leg rather than read. The answer labels them as an estimate.
- The venue’s protocol fee could not be read. The cut taken out of every fee is assumed. On a pool where the cut is 25%, assuming none overstates by a third.
recentre reopens the band
the day it goes out of range, so it is in range almost always by construction,
and the answer says so, along with what a single day of delay costs.
Size changes the answer
capital changes the answer itself, not just its magnitude. Fees split by
liquidity, so a large position earns a share it could not earn twice. Past
roughly a tenth of the pool, the answer describes a pool the deposit itself
would have changed, and the tool says which fraction it is.