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

List a wallet's Meteora DLMM, Raydium CLMM and Orca Whirlpools positions with range, current amounts, value and uncollected fees.

exchange.IO(k)
exchange.IO(k, filter)
exchange.IO(k, filter, wallet)

Examples

  • List this wallet's positions and flag those out of range.

    javascript
    function main() { var list = exchange.IO("lp.positions") if (!list) { Log("Query failed:", GetLastError()) return } if (list.length == 0) { Log("No positions") return } list.forEach(function(p) { Log(p.id, p.symbol, p.priceLower.toFixed(4), "-", p.priceUpper.toFixed(4), p.inRange ? "in range" : "out of range", "value", p.value.toFixed(2), "uncollected fees", p.feesValue.toFixed(4)) }) }
  • View another wallet's SOL/USDC positions read-only.

    javascript
    var WALLET = "" // the Solana wallet address to view function main() { if (!WALLET) { Log("Set WALLET to a wallet address first") return } var list = exchange.IO("lp.positions", "SOL_USDC", WALLET) if (!list) { Log("Query failed:", GetLastError()) return } list.forEach(function(p) { Log(p.protocol, p.id, p.inRange ? "in range" : "out of range", "value", p.value, "rent", p.rentSol) }) }

Returns

TypeDescription

array / null value

An array of positions with the common fields {id, pool, protocol, symbol, fee, priceLower, priceUpper, price, inRange, liquidity, amountBase, amountQuote, value, feesBase, feesQuote, feesValue, rewards, rentSol, closed} plus fields of the protocol, see the remarks. A null value is returned when the node does not serve a required query or a request fails.

Arguments

NameTypeRequiredDescription

k

string

Yes

Set to lp.positions to query positions.

filter

string

No

A pair (such as SOL_USDC: only that pair's positions, with prices and amounts in its orientation) or a token (only positions containing it); * or nothing means all.

wallet

string

No

Another wallet address, to view that wallet's positions read-only. Defaults to this exchange object's wallet.

See Also

Remarks

Common fields
  • id is the position ID, which can be passed to lp.increase, lp.decrease, lp.collect and lp.remove: meteora:position account address on DLMM, raydium:position NFT mint and orca:position NFT mint on Raydium and Orca.
  • Orientation of symbol, prices and amounts: that of the pair when one is given; otherwise the stablecoin (then SOL) is the quote. price is the current price, priceLower and priceUpper the range ends, and inRange whether the price is inside the range.
  • amountBase and amountQuote are the position's current token amounts and value their worth in the quote token at the current price; feesBase, feesQuote and feesValue are the uncollected fees; rewards are the uncollected farm rewards [{mint, symbol, amount}].
  • rentSol is the rent the position locks (returned on closing); closed true means the position has no liquidity, fees or rewards left (only the accounts remain; close them with lp.remove to get the rent back).

Fields by protocol
ProtocolExtra fieldsNotes
Meteora DLMMlowerBinId, upperBinId, activeId, binStep, width, feeOwnerwidth is the number of bins; liquidity is the sum of the bin shares; a position whose feeOwner is not null pays its fees to another wallet and is not supported for operations
Raydium CLMMtickLower, tickUpper, tick, tickSpacing, nftMint, positionAccount, nftAccountUncollected fees and rewards are brought up to date from the growth inside the range (rewards advanced to now at their emission rate)
Orca WhirlpoolstickLower, tickUpper, tick, tickSpacing, nftMint, positionAccount, nftProgramAmounts come from the liquidity at the current price, fees and rewards are estimated from the on-chain growth; positions in a Position Bundle carry bundleMint and bundleIndex, and their id is orca:position account address

How positions are found
  • DLMM positions are found by owner with the node's getProgramAccounts; the official public node serves it, some nodes do not or rate-limit it, and then the call fails. For frequent queries configure your own node in the node address setting.
  • Raydium and Orca positions are NFTs: NFTs with amount 1 in the wallet are found with getTokenAccountsByOwner and their position accounts read (on Orca, positions in Position Bundles the wallet holds are listed too). The position belongs to whoever holds the NFT.
  • Positions created by lp.add in this process and those registered with lp.track are checked as well (ownership verified on chain each time; transferred-away and closed ones are not listed).

Monitoring and exiting are up to the strategy: use inRange, value and feesValue to decide when to rebalance, collect or cut losses.