Meteora DLMM Fee Farming: Auto-Rebalancing LP Bot Strategy
A meteora dlmm fee farming strategy that auto-recentres bins around price to keep liquidity active and maximise dynamic-fee capture, with real rebalance triggers.
Liquidity in a Meteora DLMM pool only earns fees while price sits inside the bins you funded, and the single biggest reason LPs underperform is that price walks out of their range and their capital goes idle for hours while they sleep. Fee farming on DLMM is not a set-and-forget deposit. It is an active recentring loop: you keep a tight band of liquidity wrapped around the active bin, harvest the dynamic fee, and shift the band the moment price drifts far enough that your capital stops working. Done well, a 20-bin band on a volatile SOL pair can spend 85%+ of wall-clock time in range and compound fees that a passive wide-range position never touches.
This is a different game from one-shot launch sniping. Sniping is about a single well-timed fill; fee farming is about time-in-range and rebalance discipline over days and weeks.
Why the Active Bin Is the Only Bin That Pays
DLMM splits a pool into discrete bins, each covering a binStep of price (a 20 bp bin step means every bin is 0.2% wide). Swaps execute against the activeId bin, and here is the mechanic that drives the whole strategy: only the active bin earns swap fees. Liquidity three bins to the left of active is sitting there as inventory, collecting nothing, waiting for price to come back.
Meteora layers a dynamic fee on top of the base fee. When volatility rises, the variableFeeControl term pushes the fee rate up — sometimes 3-5x the base rate during a sharp move. That is exactly when you want liquidity parked on the active bin. The whole thesis of a fee-farming bot is: keep a narrow, dense band centred on activeId so that every swap that crosses your range pays you, and so that you are present when the dynamic fee spikes.
The tradeoff is brutal and worth stating plainly. Narrow bands earn more fee per dollar but fall out of range faster, which means more rebalances, more gas, and more realised impermanent loss each time you reset. Wide bands stay in range but dilute your fee share across dead bins. The strategy lives in tuning that band width against the pair's realised volatility, and it is exactly the kind of parameter sweep worth doing in a strategy consultation before you commit real inventory.
The Recentring Loop
The core loop runs on a geyser stream (Yellowstone gRPC), not on polling. You subscribe to the LbPair account and react to activeId changes. Every time the active bin moves, you check one thing: how far is price from the centre of your funded band?
Define a drift threshold in bins. A common starting point is: rebalance when activeId moves more than 40% of your band half-width from your band centre. For a 20-bin band (10 bins either side), that means recentring when price walks 4 bins off centre. That threshold is the single most important knob you own.
def should_rebalance(active_id, band_center, half_width_bins, drift_frac=0.40):
drift = abs(active_id - band_center)
return drift > drift_frac * half_width_bins
# harvest + close + reopen, only when drift AND fees justify the gas
def maybe_recenter(pool, pos, active_id):
if not should_rebalance(active_id, pos.center, pos.half_width):
return
pending = pool.claimable_fees(pos) # lamports
cost = est_close_reopen_cost(pool) # gas + priority + slippage
if pending < cost * 3: # don't churn on noise
return
claim_fees(pos)
close_position(pos)
new_center = active_id
open_position(pool, new_center, pos.half_width, pos.liquidity)
The pending < cost * 3 guard matters more than the drift math. Without it, a chop-heavy hour will have your bot closing and reopening every few slots, bleeding priority fees and eating slippage on every reshuffle. You only pay for a rebalance when accrued fees comfortably clear the round-trip cost. In practice a 3x multiple keeps churn sane; tighten it on cheap pairs, loosen it on expensive rebalances.
Distribution Shape: Spot vs Curve
When you reopen, you decide how liquidity spreads across your bins. Meteora's SDK gives you Spot, Curve, and BidAsk shapes. For pure fee farming around a mean-reverting price, Curve (dense at the centre, thinner at the edges) concentrates capital on the bins most likely to be active, which lifts your fee-per-dollar. For a trending pair where you expect directional drift, a Spot (uniform) distribution across a wider band survives longer between rebalances.
A concrete SOL/USDC example from a live position: 20 bp bin step, 21-bin Curve band, 40% drift trigger. Over a week of normal volatility that configuration rebalanced roughly 9-14 times a day and held time-in-range near 88%. Dropping to an 11-bin band raised fee-per-dollar about 30% but pushed rebalances past 30/day and time-in-range fell under 75% — net worse after gas. Wider was not the answer either; a 41-bin band barely rebalanced but earned so little per active bin that a Jupiter recurring buy-and-hold would have matched it. The sweet spot sat in the middle, and it moved with volatility regime.
Managing Inventory Drift and IL
Every recentre realises a slice of impermanent loss, because you are closing a position that is now imbalanced (more of the token that fell, less of the token that rose) and reopening balanced around the new price. Fee farming is only profitable when harvested fees outrun this realised IL over your holding window.
Two things keep that inequality on the right side:
- Track cumulative realised IL as a running counter, not just per-rebalance. If a full session's fees are not clearing accumulated IL plus gas, the pair is trending too hard for a tight band and you should widen or step out. This is the same funding-vs-fees accounting discipline behind a funding-rate loop on Hyperliquid — the edge is real but thin, so the bookkeeping has to be exact.
- Hedge the inventory delta if the pair is directional. A small perp short against your net token exposure turns the LP into a closer-to-delta-neutral fee harvester. Sizing and funding that hedge cleanly is its own build; our Hyperliquid perps bot work exists partly to sit alongside LP positions like this.
If you have read the just-in-time liquidity approach on Meteora, this is the patient cousin of that strategy. JIT flashes liquidity into a single large swap and pulls it the same block; fee farming keeps a persistent band alive and harvests the long tail of ordinary flow. The two share the same DLMM primitives and often the same infrastructure, and some teams run both against the same pool with different capital tranches.
Operational Gotchas
- Bin arrays cost rent. Opening a position across bins that have never been initialised means paying to create bin array accounts. Reopening on the same bins you just closed avoids re-paying; recentring far away does not. Budget this into your cost estimate.
- Priority fees during volatility. The moments you most want to recentre are the moments the network is congested. Land your close-and-reopen as a Jito bundle so the two legs are atomic and you are never caught half-rebalanced with liquidity in no-man's-land.
- Claim before you close. Fees accrue to the position; if you close without claiming you can strand them depending on SDK version. Always harvest first, then close.
- Simulate the reopen. Confirm your new band actually straddles
activeIdafter the close settled — price can move between your close and reopen, and reopening off-centre defeats the entire loop.
For a recurring-order sanity baseline to benchmark this against, a Jupiter trigger and recurring order engine gives you a passive comparison line; if your fee farm is not clearly beating dollar-cost accumulation after IL and gas, the extra complexity is not paying for itself.
The strategy rewards obsessive measurement more than clever code, and most of the failures I have seen were tuning failures dressed up as bugs. If you want the band width, drift threshold, and hedge sizing pinned to your specific pairs and capital, that calibration work is exactly what a strategy consultation is for.
Need a bot like this built?
We design, build and run trading bots on Solana, Hyperliquid and Polymarket.
Start a projectMore from the blog
Public vs Paid RPC: How to Run a Fair Benchmark
A fair comparison of public and paid RPC endpoints must account for quotas, workload, freshness and support guarantees.
Read articleRPC Benchmark Percentiles Explained: p50, p95 and p99
Why averages hide the latency spikes that break trading bots, wallets and production blockchain applications.
Read articleHyperliquid REST vs WebSocket Benchmark: What to Measure
A benchmark plan for Hyperliquid market data that separates request latency from streaming freshness and recovery.
Read article