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

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.

    javascript
    function 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.

    javascript
    function 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

TypeDescription

object / null value

Returns {symbol, side, qty, route, quote, price, priceImpactPct, swapMode, baseQty}: route lists the liquidity sources used, quote is the quote amount received for a sell or paid for a buy, baseQty the base amount actually sold or bought, price is quote / baseQty, and swapMode is ExactIn or ExactOut. Without a route these five are null. A null value is returned when a token is unknown or the request fails.

Arguments

NameTypeRequiredDescription

k

string

Yes

Selects what the exchange.IO() function does. Set it to route to request a quote.

symbol

string

Yes

Trading pair, for example SOL_USDC.

side

string

Yes

Direction: sell sells qty units of the base currency, and buy buys qty units of the base currency.

qty

number

Yes

Amount of the base currency.

See Also

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.