exchange.IO("lp.increase", ...)
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
| Type | Description |
object / null value |
|
Arguments
| Name | Type | Required | Description |
k | string | Yes | Set to |
positionId | string / number | Yes | Position ID, from |
budget | number | Yes | Budget in the quote token. |
options | object | No |
|
See Also
Uniswap / PancakeSwap Aerodrome / Velodrome exchange.IO exchange.IO("lp.add") exchange.IO("lp.decrease") exchange.IO("lp.positions")
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.