exchange.IO("route", ...)
On a Jupiter exchange object, request a quote: returns the quote and route of a swap without placing an order.
exchange.IO(k, symbol, side, qty)Examples
-
Quote selling 2 SOL.
javascriptfunction main() { var r = exchange.IO("route", "SOL_USDC", "sell", 2) if (!r) { Log("Quote failed:", GetLastError()) return } if (r.route === null) { Log("No route") return } Log("Receive:", r.quote, "USDC", "Average price:", r.price, "Route:", r.route.join(" + ")) } -
Quote buying 1 JUP and check the swap mode.
javascriptfunction main() { var r = exchange.IO("route", "JUP_USDC", "buy", 1) if (!r || r.route === null) { Log("No route:", GetLastError()) return } Log("mode", r.swapMode, "buys", r.baseQty, "JUP", "costs", r.quote, "USDC", "average", r.price) }
Returns
| Type | Description |
object / null value | Returns |
Arguments
| Name | Type | Required | Description |
k | string | Yes | Selects what the |
symbol | string | Yes | Trading pair, for example |
side | string | Yes | Direction: |
qty | number | Yes | Amount of the base currency. |
See Also
Jupiter exchange.IO exchange.IO("slippage") exchange.IO("dexes") exchange.IO("token") exchange.CreateOrder
Remarks
priceImpactPct is Jupiter's estimated price impact (a ratio, 0.001 = 0.1%).
Quotes use the same basis as orders: a sell is quoted as exact input (swapMode ExactIn); a buy is quoted as exact output for qty base units (ExactOut), and when there is no exact-output route (sources such as Meteora and PumpSwap do not support exact output) it is estimated with exact input instead, the same fallback as a limit buy, so swapMode is ExactIn and baseQty may differ slightly from qty. Quotes do not include Solana transaction fees.