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.

Endpoint

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

Organization API: Replace /v2/portfolio/ with /v2/organization/portfolios/{portfolioId}/. See Portfolio vs. Organization API.

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",
}

Request Body Examples

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,
});

Response

{
  quote: {
    type: "market",
    chain: string,
    targetAsset: string, // Asset address
    contraAsset: string, // Asset address
    qty: string,
    orderSide: "buy" | "sell",
    quote: {
      id: string, // Quote ID
      amountOut: string,
      priceImpact: string,
    },
    maxPriceImpact: string, // e.g. "0.01"
    slippageTolerance: string, // e.g. "0.01"
  },
  metadata: {
    toNotional: string,
    fromNotional: string,
    estimatedPriceImpact: string,
    estimatedFee: string,
    estimatedFeeNotional: string,
    buyAmount: string,
    sellAmount: string,
    sources: Record<string, string>,
    expectedSlippage: string,
    minAmountOut: string,
    minAmountOutNotional: string,
    price: string,
    isMarketable: boolean,
    warnings?: string[], // Present if there are warnings (e.g. minimum order size)
  }
}

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 (parseFloat(quote.metadata.expectedSlippage) < 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,
  });
}

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

References