Type/to search
Built-in Functions
Structures
Built-in Variables and Constants
Conventions
Exchanges
Capability Matrix
Centralized Exchanges
Decentralized Exchanges (DEX)
Prediction Markets
Securities and Futures
On-chain & Custom

Read the live state and statistics of a concentrated-liquidity pool.

exchange.IO(k, poolId)

Examples

Read a pool and derive the price from the current bin or tick.

javascript
function main() { var sel = exchange.IO("lp.select", "SOL", 100, {quote: "USDC"}) if (!sel) { Log("Selection failed:", GetLastError()) return } var p = exchange.IO("lp.pool", sel.protocol + ":" + sel.id) if (!p) { Log("Read failed:", GetLastError()) return } var scale = Math.pow(10, p.decimalsX - p.decimalsY) var calc = p.protocol == "meteora" ? Math.pow(1 + p.binStep / 10000, p.activeId) * scale : Math.pow(1.0001, p.tick) * scale Log(p.dex, p.symbolX + "/" + p.symbolY, "price", p.price, "derived", calc) Log("reserves", p.reserveX, p.symbolX, p.reserveY, p.symbolY, "24h fees", p.fees24hUsd) }

Returns

TypeDescription

object / null value

The common fields {id, protocol, dex, tokenX, tokenY, symbolX, symbolY, decimalsX, decimalsY, price, fee, feeRate, reserveX, reserveY, tvlUsd, volume24hUsd, fees24hUsd, rewards} plus the fields of the protocol (as in lp.pools, see the remarks). A null value is returned when the address is not an account of an LP protocol program or a request fails.

Arguments

NameTypeRequiredDescription

k

string

Yes

Set to lp.pool to read a pool.

poolId

string

Yes

The pool address (a DLMM LbPair account, a Raydium CLMM PoolState account or an Orca Whirlpool account), optionally written meteora:address, raydium:address or orca:address. A bare address is matched to its protocol by the program that owns the account.

See Also

Remarks

X and Y follow the pool's own token order: price is the Y value of one X, and reserveX and reserveY are the pool's balances of the two tokens. lp.pools converts to base and quote tokens around the token queried, lp.pool does not; for a quote-per-base price, check the orientation with symbolX and symbolY. An empty pool has price 0.

Fields by protocol
protocolExtra fields
meteorabinStep, activeId, feeRateNow, enabled
raydiumtickSpacing, tick, liquidity, sqrtPriceX64, enabled
orcatickSpacing, tick, liquidity, sqrtPriceX64, adaptiveFee, fullRangeOnly

See exchange.IO("lp.pools") for their meaning and the form of rewards.

Price and index: the price of DLMM bin i is (1 + binStep/10000)^i, that of Raydium or Orca tick i is 1.0001^i, both multiplied by 10^(decimalsX − decimalsY) for readable units.