Skip to content

Get QuickTrade Quote

Get a quote for a QuickTrade order without executing it. This is useful when you want to preview pricing before using the QuickTrade submit endpoint.

Request URL

POST https://ddp.definitive.fi/v2/portfolio/quicktrade/quote

Example

// Get a quote for a quicktrade
const quoteResponse = await AuthHelpers.signAndSend({
  path: "/v2/portfolio/quicktrade/quote",
  method: "POST",
  body: {
    chain: "ethereum",
    targetAsset: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH
    contraAsset: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC
    qty: "1000",
    orderSide: "buy",
  },
  apiKey: process.env.API_KEY,
  apiSecret: process.env.API_SECRET,
});
 
console.log("Quote received:", quoteResponse);

Request Body

{
  chain: string, // e.g. "ethereum", "polygon", "arbitrum"
  targetAsset: string, // Asset address you want to buy/sell
  contraAsset: string, // Asset address you're trading against
  qty: string, // Quantity to trade
  orderSide: "buy" | "sell",
}

Response

The response structure matches the standard trade quote response:

{
  quote: {
    id: string, // Quote ID for potential execution
    estimatedGas: string,
    estimatedGasPrice: string,
    estimatedNetworkFee: string,
    estimatedProtocolFee: string,
    estimatedSlippage: string,
    estimatedPriceImpact: string,
    route: {
      // Route details for the trade
      steps: Array<{
        protocol: string,
        poolAddress: string,
        tokenIn: string,
        tokenOut: string,
        amountIn: string,
        amountOut: string
      }>
    }
  },
  baseAsset: {
    id: string,
    name: string,
    ticker: string,
    address: string,
    chain: {
      id: string,
      name: string,
      namespace: string
    }
  },
  quoteAsset: {
    id: string,
    name: string,
    ticker: string,
    address: string,
    chain: {
      id: string,
      name: string,
      namespace: string
    }
  },
  baseQuantity: number,
  quoteQuantity: number,
  price: number
}

Benefits

  • Preview pricing: See exact costs before execution
  • Risk assessment: Review slippage and price impact
  • Route analysis: Understand how your trade will be executed
  • Fee transparency: See all fees upfront

Rate Limiting

QuickTrade quote endpoints have custom rate limiting to balance speed with system stability. The limits are higher than standard endpoints to support legitimate high-frequency trading.

Usage with QuickTrade Submit

You can use this quote endpoint to preview pricing, then execute the same trade parameters using the QuickTrade submit endpoint:

// 1. Get quote
const quote = await AuthHelpers.signAndSend({
  path: "/v2/portfolio/quicktrade/quote",
  method: "POST",
  body: tradeParams,
  apiKey: process.env.API_KEY,
  apiSecret: process.env.API_SECRET,
});
 
// 2. Review quote, then execute if acceptable
if (quote.estimatedSlippage < 0.02) {
  // Less than 2% slippage
  const execution = await AuthHelpers.signAndSend({
    path: "/v2/portfolio/quicktrade",
    method: "POST",
    body: tradeParams, // Same parameters
    apiKey: process.env.API_KEY,
    apiSecret: process.env.API_SECRET,
  });
}

References

Notes

  • Quotes are valid for a limited time and may expire
  • Market conditions can change between quote and execution
  • For immediate execution without preview, use QuickTrade Submit directly