DeFi Liquidation Bots: Earning the Liquidation Bonus
Learn how health-factor monitoring and atomic liquidate-and-swap turn DeFi liquidations into a repeatable MEV income stream on Solana and beyond.
Liquidations sit at the intersection of risk management and pure opportunity. Every lending protocol — whether it is Marginfi, Kamino, or an EVM fork — maintains solvency by allowing third parties to close underwater positions at a discount. That discount, typically between 5% and 15% of the seized collateral, is the liquidation bonus. For a well-engineered bot, that bonus is not a lucky windfall; it is a predictable, repeatable income stream you can model, size, and compound.
Monitoring Health Factors in Real Time
The foundation of any liquidation system is low-latency account watching. On Solana, a geyser stream via a Yellowstone or Triton endpoint lets you subscribe to account updates for every borrower address on a given protocol. Each update carries the raw account data you decode against the program's IDL to recompute the health factor — collateral value times the protocol's liquidation threshold divided by outstanding debt. When that ratio drops below 1.0, the position is eligible.
The critical engineering constraint is speed. A health factor of 0.98 can become 0.85 in a single block during a volatile move, but it can also attract dozens of competing bots. Your edge lives in three places: the fidelity of the price oracle you track (most protocols use Pyth or Switchboard on-chain, so you need to mirror their confidence intervals), the efficiency of your account filter so you are not decoding ten thousand accounts every slot, and your signing latency from detection to landed transaction.
On EVM chains the same logic applies through mempool monitoring, but the surface is different: you watch pending oracle updates and pending price-feed transactions that will move a borrower into liquidation territory before the state change is confirmed.
Atomic Liquidate-and-Swap: Closing the Loop
Receiving seized collateral is only half the trade. If you liquidate a SOL-collateralised USDC borrow, you now hold SOL you did not want and are exposed to directional risk for as long as it takes to sell. The solution is atomicity — bundle the liquidation call and the swap into a single transaction that either both succeed or both revert.
On Solana this is where Jito bundles become load-bearing infrastructure. You construct a bundle containing your liquidation instruction and an immediate swap through Jupiter or a direct route on Orca or Raydium, attach a tip to the Jito block engine, and submit. Priority fees on the liquidation instruction itself ensure you land ahead of competing bots that submitted without tips. The bundle guarantee means your inventory exposure is measured in zero slots: you enter and exit in one atomic action.
A few mechanics that separate profitable bots from breakeven ones:
- Slippage simulation before submission. Run a local simulation of the swap leg against the current on-chain state. If simulated output minus gas plus tip leaves you below the bonus threshold, skip the opportunity. Anti-rug simulation is not optional — protocol bugs and oracle exploits can make a "liquidation" drain your capital.
- Inventory skew tracking. If your hot wallet already holds a large SOL position from earlier liquidations, your effective cost to take more SOL exposure is higher. Adjust the minimum profitability threshold dynamically.
- Kill-switch logic. Hardcode a net-loss circuit breaker. If cumulative P&L in a rolling window crosses a negative threshold, halt submissions and alert. Markets can enter regimes where liquidations cluster and every bot is fighting over the same accounts at negative expected value after tips.
Scaling Beyond Single-Protocol Liquidations
Once the core loop is profitable, the natural expansion is cross-protocol coverage. A single geyser connection can fan out to watch Marginfi, Kamino, and Drift positions simultaneously, with the same atomic swap infrastructure recycled across all three. The marginal cost of adding a new protocol is low; the incremental revenue is additive.
The same latency infrastructure that powers a liquidation bot transfers cleanly to other MEV verticals. Our Solana arbitrage bot case study shows how the same geyser-to-bundle pipeline can be adapted for cross-DEX price discrepancies — the detection logic changes but the submission layer is identical. If you are already running one, you are most of the way to running the other.
For studios and traders looking to build a production-grade system, the path from concept to live edge involves careful protocol selection, rigorous simulation infrastructure, and ongoing calibration of tip levels against competitor behaviour. Our trading-bot services cover the full stack from architecture to deployment. If you are ready to scope a liquidation bot or want to extend an existing MEV strategy, start a project and we will map out the implementation together.
Ready to earn the liquidation bonus on Solana or any EVM chain? Tell us about your protocol targets and we will design an atomic liquidation system around your risk parameters and capital size.
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