TRENDDocs

Quote a trade

POST
/v1/trades/quote

Prices a buy or a sell. The answer has one of three shapes, one per venue: a curve quote (expectedOut, componentTargets), a market quote for a launch past the curve (graduated: true), or a pool quote for a collectible (estimatedAmountOut, no expectedOut). Read the quote guide before parsing. preview: true prices without storing a quote you could build from. Amounts are decimal strings of base units.

Request Body

application/json
  1. body
launch*string

The launch address. Take one from GET /v1/launches.

Match^[1-9A-HJ-NP-Za-km-z]{32,44}$
direction*string

buy or sell.

Value in"buy""sell"
amountIn*string

Base units as a decimal string. With exactInSol it is lamports and a ceiling on what you spend. A sell is in the primary token's base units.

Match^(0|[1-9]\d*)$
Lengthlength <= 20
mode?string

exactOut: amountIn is the tokens you want out. exactIn: amountIn is DNA units to spend. exactInSol: amountIn is lamports of SOL, the most you will spend.

Default"exactOut"
Value in"exactIn""exactOut""exactInSol"
slippageBps?integer

Tolerated slippage in basis points. 100 is 1%.

Range0 <= value <= 10000
Default100
wallet?string

The wallet the trade is for. With it the quote reports what the wallet already holds.

Match^[1-9A-HJ-NP-Za-km-z]{32,44}$
preview?boolean

true prices without storing a quote you could later build from. The answer has no usable quoteId.

Defaultfalse
tipLamports?string

The tip for this quote in lamports per transaction. Absent: the server default. "0": none.

Match^(0|[1-9]\d*)$
Lengthlength <= 20
priorityFee?|

auto or lamports per transaction.

Response Body

OK

application/json
  1. response
quote*||
curl -X POST 'https://api.dev.trend.fun/v1/trades/quote' \  -H 'Content-Type: application/json' \  -d '{  "launch": "3rvGiCyHHkhATZNhSznAhpcXKRZ9788AD6yan1khxwuS",  "direction": "buy",  "amountIn": "250000000",  "mode": "exactInSol",  "slippageBps": 100,  "preview": true}'

{  "quote": {    "quoteId": "8c5857cf-fa33-4821-b451-aed20dd7094e",    "launch": "7JkeZb8cAq58bLdKBMsbteyk5WJ5S4vhwqyax2rNvkVF",    "direction": "buy",    "amountIn": "10000000",    "componentTargets": [      {        "mint": "So11111111111111111111111111111111111111112",        "symbol": "SOL",        "decimals": 9,        "amount": "9699999"      }    ],    "componentFees": [      {        "mint": "So11111111111111111111111111111111111111112",        "symbol": "SOL",        "decimals": 9,        "amount": "96999"      }    ],    "componentFunding": [      {        "mint": "So11111111111111111111111111111111111111112",        "symbol": "SOL",        "decimals": 9,        "amount": "9699999",        "required": "9699999",        "held": "0",        "shortfall": "9699999"      }    ],    "fullyCovered": false,    "dnaUnitsNet": "9603000",    "expectedOut": "50850504617455371",    "minOut": "50341999571280817",    "priceImpactBps": 944,    "feeBps": 100,    "expiresAt": 1790877961,    "clamped": false,    "budgetSolIn": "9699999",    "route": {      "fullyCovered": false,      "solIn": "9699999",      "legs": [],      "venues": [],      "needsAccountSetup": false,      "transactions": 1,      "note": "Wrapping SOL to fund the trade: no swaps, in one transaction."    }  }}