exchange.IO("lp.increase", ...)
Add to an existing position: the budget is split into the two tokens by the position's range and the current price, swapping first for the one that is short.
exchange.IO(k, positionId, budget)
exchange.IO(k, positionId, budget, options)Examples
Add 50 USDC to the first SOL/USDC position.
javascript
function main() {
var list = exchange.IO("lp.positions", "SOL_USDC")
if (!list || list.length == 0) {
Log("No SOL/USDC position")
return
}
var r = exchange.IO("lp.increase", list[0].id, 50, {symbol: "SOL_USDC"})
if (!r) {
Log("Increase failed:", GetLastError())
return
}
Log(r.id, "added", r.amountBase, "SOL", r.amountQuote, "USDC", "transaction", r.txHash)
}Returns
| Type | Description |
object / null value |
|
Arguments
| Name | Type | Required | Description |
k | string | Yes | Set to |
positionId | string | Yes | A position ID (the |
budget | number | Yes | The amount to add, in the quote token. |
options | object | No |
|
See Also
Jupiter exchange.IO exchange.IO("lp.add") exchange.IO("lp.positions") exchange.IO("lp.decrease") exchange.IO("lp.plan")
Remarks
Planning, swapping and execution work as in lp.add: the position's range is planned at the latest pool price, a shortfall is an error, a Jupiter market order swaps first when needed and is waited for, then the plan is redone and one transaction is sent.
Differences between protocols
- Meteora DLMM: distributed over the position's bins by
shape; only positions of at most 70 bins (a wider one does not fit in one transaction and fails). - Raydium CLMM: uses
increase_liquidity_v2. When both tokens are needed one token's amount is fixed (the SOL side first) and the other is capped at the most it can take while the price moves withinslippage(at least the planned amount × (1 +slippage)); when only one is needed (the range lies on one side of the price) a fixed liquidity is added, the other token capped at what the price moving into the range would take. - Orca Whirlpools: no width limit; both token amounts go on chain as maxima, and the program adds the most liquidity they allow at the execution price.
Execution
Every transaction is simulated by the node before sending and is not sent when the simulation fails, with the reason reported (DLMM, Raydium CLMM and Orca Whirlpool error codes with their names); the compute-unit limit is the simulated usage plus headroom, and the priority fee is the 75th percentile of recent fees paid by transactions writing the same accounts, capped by exchange.IO("priorityFee"). The call returns after confirmation, with actual amounts from the balances before and after. When within 120 seconds the transaction is neither confirmed nor provably expired, the error says outcome is unknown with the signature: it may have landed, so check it with exchange.IO("receipt") before retrying.