Skip to content

Get QuickTrade Quote

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

Request URL

POST https://ddp.definitive.fi/v2/organization/portfolios/{portfolioId}/quicktrade/quote

Path Parameters

ParameterTypeRequiredDescription
portfolioIdstringYesUUID of the portfolio

Example

// Get a quote for a quicktrade
const quoteResponse = await AuthHelpers.signAndSend({
  path: "/v2/organization/portfolios/00000000-0000-0000-0000-000000000001/quicktrade/quote",
  method: "POST",
  body: {
    chain: "ethereum",
    targetAsset: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH
    contraAsset: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC
    qty: "1000",
    orderSide: "buy",
  },
  apiKey: process.env.ORG_API_KEY,
  apiSecret: process.env.ORG_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 with organization-level pricing
  • Organization-level: Uses your organization's API credentials and fee structure

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/organization/portfolios/00000000-0000-0000-0000-000000000001/quicktrade/quote",
  method: "POST",
  body: tradeParams,
  apiKey: process.env.ORG_API_KEY,
  apiSecret: process.env.ORG_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/organization/portfolios/00000000-0000-0000-0000-000000000001/quicktrade",
    method: "POST",
    body: tradeParams, // Same parameters
    apiKey: process.env.ORG_API_KEY,
    apiSecret: process.env.ORG_API_SECRET,
  });
}

Multi-Portfolio Trading

Organizations can get quotes for trades across multiple portfolios by specifying different portfolioId values in the URL path. Each portfolio maintains its own balance and trading constraints.

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