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

Adds to an existing position: the budget is split into the two tokens by the position's range and the current price, the short token is bought first, and both go into the same position.

exchange.IO(k, positionId, budget)
exchange.IO(k, positionId, budget, options)

Examples

Add 100 USDC to the in-range position with the largest value.

javascript
function main() { var ps = exchange.IO("lp.positions", "ETH_USDC").filter(function (p) { return p.inRange && !p.closed }) if (ps.length == 0) { Log("No position in range") return } ps.sort(function (a, b) { return b.value - a.value }) var r = exchange.IO("lp.increase", ps[0].id, 100, {symbol: "ETH_USDC"}) Log(r ? ["Increased", r.id, r.amountBase, "ETH +", r.amountQuote, "USDC"] : GetLastError()) }

Returns

TypeDescription

object / null value

{txHash, swapTxHash, id, liquidity, amountBase, amountQuote}: liquidity is the added liquidity, amountBase and amountQuote the amounts used, swapTxHash the swap before it (null without one). Null with an error when the wallet does not cover the budget or the position does not exist.

Arguments

NameTypeRequiredDescription

k

string

Yes

Set to lp.increase to add to a position.

positionId

string / number

Yes

Position ID, from id of lp.add or lp.positions.

budget

number

Yes

Budget in the quote token.

options

object

No

{symbol, slippage, stake}, all optional: symbol sets the pair orientation (the stablecoin is the quote by default), slippage the price protection (0.01 by default), stake see the remarks.

See Also

Remarks

The increase plans a single range at the position's current ticks and executes it; funding, swaps and approvals work as in lp.add: the short token is bought with a market order first, and with a native pair (such as options.symbol ETH_USDC) the native side is paid as in lp.add; a wallet that falls short fails with the plan's shortfall.

Aerodrome and Velodrome: a staked position must first be taken out with exchange.IO("lp.unstake"); for a basic pool (positionId is the pool address) it is another lp.add into that pool, staked afterwards when options.stake is true.