// Use case

Liquidate before
the crowd.

Be the first to detect undercollateralized positions across Solana lending protocols. Stream account state and oracle price changes in real-time — and execute liquidations before anyone else sees the opportunity.

How DeFi liquidations work on Solana

Solana's lending ecosystem has grown into a multi-billion dollar market. Protocols like MarginFi, Solend, Kamino, and Drift allow users to deposit collateral — typically SOL, USDC, mSOL, or JitoSOL — and borrow against it. Every borrowing position has a health factor: a ratio that measures how well the collateral covers the outstanding debt. When the health factor drops below 1.0, the position becomes eligible for liquidation.

Health factors drop for two reasons. The borrower's collateral loses value (SOL price drops), or their debt grows through accrued interest. In volatile markets, both happen simultaneously. A 10% drop in SOL price can push thousands of positions below their liquidation threshold within a single block.

Liquidators are independent actors who repay part of a borrower's debt in exchange for their collateral at a discount — the liquidation bonus. This bonus typically ranges from 5% to 15% depending on the protocol and the asset pair. On a $10,000 position with a 5% bonus, that's $500 in profit for a single transaction that costs roughly 0.001 SOL in gas fees.

The catch: liquidation is a competitive market. Every liquidator on the network is watching the same positions. The one who detects an undercollateralized account first — and lands the transaction first — captures the entire bonus. Everyone else gets nothing. Speed is the only differentiator, and speed starts with data.

Why traditional monitoring fails

Polling delay

Standard RPC polling introduces 200-400ms of stale data per cycle. By the time your bot reads an account's state, a faster competitor has already submitted the liquidation transaction. In DeFi, stale data is losing data.

Price oracle lag

Oracle accounts (Pyth, Switchboard) update on-chain every slot, but RPC polling only samples them periodically. Your bot calculates health factors with outdated prices while the actual on-chain state has already crossed the liquidation threshold.

Missed positions

Lending protocols like MarginFi have tens of thousands of margin accounts. Rate-limited RPC endpoints make it impossible to scan all of them fast enough. You're forced to monitor a subset — and the profitable liquidation is always in the accounts you're not watching.

Competition advantage

Other liquidation bots with streaming data see every state change the moment it happens. They don't need to poll or scan. By the time your polling loop fires, their liquidation transaction is already confirmed.

Real-time liquidation pipeline

Replace fragile polling loops with a reactive pipeline that processes state changes as they happen. Every step feeds the next — from raw account data to a confirmed liquidation transaction.

01

Stream account state changes

Subscribe to account updates for lending protocol margin accounts via gRPC. Every time a borrower's collateral or debt changes, the new state arrives in your stream within milliseconds of slot confirmation.

02

Monitor oracle price updates

Oracle accounts from Pyth and Switchboard flow through the same gRPC stream. Price changes for SOL, mSOL, JitoSOL, and every other collateral asset arrive in real-time — no separate polling loop required.

03

Calculate health factors with live data

Combine the latest collateral balances with real-time oracle prices to compute each position's health factor. Because both data sources arrive through the same stream, your calculations always use the most current on-chain state.

04

Detect threshold crossings instantly

The moment a position's health factor drops below 1.0, your bot knows. No waiting for the next poll cycle, no sampling delay. The state change that triggers liquidation eligibility is the same event that alerts your bot.

05

Execute with optimal priority fees

Fire the liquidation transaction immediately with a priority fee calibrated to current network conditions. Because you detected the opportunity milliseconds after it appeared, you have time to set a competitive fee rather than overpaying in a panic.

Lending protocols on Solana

Each protocol has its own program ID, liquidation mechanics, and bonus structure. Subglow lets you filter your gRPC stream to any combination of these programs so your bot only processes relevant account updates.

ProtocolProgram IDLiq. BonusTVL Tier
MarginFiMFv2hWf…LbVKS5 – 10%Tier 1
SolendSo1endD…GdZfX5 – 8%Tier 1
KaminoKLend2g…z3Mmw5 – 12%Tier 1
DriftdRiftyH…Z4vjR5 – 15%Tier 2

What makes Subglow ideal for liquidations

Account state streaming

Every margin account update arrives the moment it's confirmed on-chain. Collateral deposits, withdrawals, borrows, and repayments — you see state changes as they happen, not minutes later through a polling loop.

Oracle integration

Pyth and Switchboard price feeds flow through the same gRPC stream as account data. Your bot receives both in a unified event flow, eliminating clock drift between price data and position state.

Custom Program ID filters

On the Pro tier, configure server-side filters for specific lending program IDs. Your stream only delivers MarginFi, Solend, Kamino, or Drift account updates — reducing bandwidth and processing overhead by orders of magnitude.

Zero rate limits

Monitor tens of thousands of positions without hitting throttle walls. Subglow's gRPC streams deliver continuous data without per-request limits, so your bot can track every margin account across every protocol simultaneously.

Liquidation economics

Liquidation is one of the few DeFi activities where the economics are straightforward: you repay someone else's debt and receive their collateral at a discount. The margin between the debt you repay and the collateral you receive is your profit, minus gas.

On Solana, gas costs are negligible. A liquidation transaction with a competitive priority fee typically costs around 0.001 SOL — roughly $0.15 at current prices. Meanwhile, liquidation bonuses on major lending protocols range from 5% to 15%. Even a modest $5,000 position at a 5% bonus yields $250 in gross profit. Larger positions during high-volatility events can yield thousands per liquidation.

The limiting factor is never gas — it's detection speed. A bot that sees undercollateralized positions 50ms before competitors captures the entire bonus. A bot that arrives 50ms late captures nothing. This is why the data layer matters more than any other component in a liquidation stack.

5 – 10%
Avg. liquidation bonus
~0.001 SOL
Gas per liquidation
Volatility-driven
Monthly opportunity
1 liquidation
Covers monthly sub cost

Profit from protocol health.

Liquidation bots keep DeFi solvent — and Subglow gives you the fastest path to every undercollateralized position on Solana.