exchange.IO("slippage", ...)
Set the slippage protection for market orders on a Jupiter exchange object.
exchange.IO(k)
exchange.IO(k, ratio)Examples
Set slippage protection for market orders.
javascript
function main() {
exchange.IO("slippage", 0.01) // 1%
Log("Slippage:", exchange.IO("slippage"))
}Returns
| Type | Description |
number | Returns the current slippage ratio. |
Arguments
| Name | Type | Required | Description |
k | string | Yes | Selects what the |
ratio | number | No | Slippage ratio. Its valid range is |
See Also
Jupiter exchange.IO exchange.IO("route") exchange.IO("dexes") exchange.IO("priorityFee") exchange.CreateOrder
Remarks
For a market order, the slippage is deducted from the quote to give the minimum amount received, which the on-chain program enforces; if the price moves by more than the slippage before execution, the transaction fails (only the fee is lost) and the order is reported as canceled.
You can also set slippage for a single order by appending ;{"slippage":0.01} to the direction parameter of exchange.CreateOrder(). Limit orders do not use this setting: the connector computes the exact slippage from the limit price, since the limit price itself is the worst fill price.