exchange.IO("lp.select", ...)
Pick a concentrated-liquidity pool for a token automatically, by a TVL floor and the 24h volume.
exchange.IO(k, token, budget)
exchange.IO(k, token, budget, options)Examples
-
Pick a SOL/USDC pool for a budget of 100 USDC.
javascriptfunction main() { var pool = exchange.IO("lp.select", "SOL", 100, {quote: "USDC"}) if (!pool) { Log("Selection failed:", GetLastError()) return } Log("Picked:", pool.dex, pool.id, "fee", pool.fee / 1e4 + "%", "reason:", pool.reason) } -
Pick only among Raydium and Orca pools.
javascriptfunction main() { var pool = exchange.IO("lp.select", "SOL", 100, {quote: "USDC", protocol: ["raydium", "orca"]}) if (!pool) { Log("Selection failed:", GetLastError()) return } Log(pool.dex, pool.id, "tickSpacing", pool.tickSpacing, "24h volume", Math.round(pool.volume24hUsd)) }
Returns
| Type | Description |
object / null value | The chosen pool: one |
Arguments
| Name | Type | Required | Description |
k | string | Yes | Set to |
token | string | Yes | The token, written as the |
budget | number | Yes | The amount to invest, in the quote token; it sets the TVL floor. |
options | object | No | Filters |
See Also
Remarks
Filters
| Key | Description |
|---|---|
quote | The quote token; without it, pools against SOL, USDC and USDT are considered |
protocol | The protocol: meteora, raydium, orca, or an array of them |
fee | The base fee in the unit of lp.pools' fee (millionths), such as 400 |
binStep | Only Meteora pools with this bin step |
tickSpacing | Only Raydium and Orca pools with this tick spacing |
Selection rule
- The
lp.poolsrows are filtered; nothing left is an error. - The floor is the larger of $5000 and
budgetin USD, withbudgetvalued at the USD price of the first pool's quote token. - Among pools whose USD TVL reaches the floor, the one with the largest 24h volume wins; if none of them has volume data, the largest TVL; if no pool reaches the floor, the largest TVL of all.
reason names the case, as in highest 24h volume among pools with TVL >= $5000, largest TVL among pools with TVL >= $5000 (no volume data) and no pool reaches $5000 TVL; picked the largest.
exchange.IO("lp.plan") picks the pool by the same rule when pool is not given (taking fee, protocol, binStep and tickSpacing from the plan parameters). The busiest pool is not necessarily the best for a position: the fee and the price grid (binStep, tickSpacing) decide the fee income and how precise the range can be.