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

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

TypeDescription

number

Returns the current slippage ratio.

Arguments

NameTypeRequiredDescription

k

string

Yes

Selects what the exchange.IO() function does. Set it to slippage to set slippage protection for market orders.

ratio

number

No

Slippage ratio. Its valid range is [0, 0.5) and its default is 0.005 (0.5%). Omit it to query the current value.

See Also

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.