Get Quote
Retrieves a quote for trading between two assets through the organization API. The request body varies based on the order type.
Request URL
POST https://ddp.definitive.fi/v2/organization/portfolios/{portfolioId}/trade/quote
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
portfolioId | string | Yes | UUID of the portfolio |
Base Fields
All order types require these base fields:
Field | Type | Required | Description |
---|---|---|---|
type | string | Yes | "market" , "limit" , "twap" , "stop" , "stop-loss" |
chain | string | Yes | Chain identifier (e.g., "ethereum" , "solana" ) |
targetAsset | string | Yes | Asset to buy or sell |
contraAsset | string | Yes | Asset to trade against |
qty | string | Yes | Amount to trade |
orderSide | string | Yes | "buy" or "sell" |
slippageTolerance | string | Yes | Max allowed slippage (e.g., "0.01" = 1%) |
maxPriceImpact | string | Yes | Max allowed price impact (e.g., "0.01" ) |
Market Order
{
type: "market",
chain: "ethereum",
targetAsset: "...",
contraAsset: "...",
qty: "1000",
orderSide: "buy",
slippageTolerance: "0.01",
maxPriceImpact: "0.01"
}
Limit Order
Limit orders require a limit
object:
Field | Type | Required | Description |
---|---|---|---|
limit.price | string | Yes | Limit price to trigger order |
limit.isNotional | boolean | Yes | Whether price is a notional or exact amount |
{
type: "limit",
chain: "solana",
targetAsset: "...",
contraAsset: "...",
qty: "100.00",
orderSide: "sell",
slippageTolerance: "0.01",
maxPriceImpact: "0.05",
limit: {
price: "0.07",
isNotional: false
}
}
TWAP Order
Field | Type | Required | Description |
---|---|---|---|
durationSeconds | number | Yes | Duration in seconds |
targetTWAPBuckets | number | No | Optional number of buckets |
{
type: "twap",
chain: "ethereum",
targetAsset: "...",
contraAsset: "...",
qty: "1000",
orderSide: "buy",
slippageTolerance: "0.01",
maxPriceImpact: "0.01",
durationSeconds: 3600,
targetTWAPBuckets: 6
}
Stop-Loss Order
Stop-loss orders automatically trigger a market order when a price threshold is hit.
Field | Type | Required | Description |
---|---|---|---|
trigger | object | Yes | Trigger object with price and isNotional |
limit | object | No | Optional fallback trigger |
{
type: "stop-loss",
chain: "ethereum",
targetAsset: "...",
contraAsset: "...",
qty: "1000",
orderSide: "sell",
slippageTolerance: "0.01",
maxPriceImpact: "0.01",
trigger: {
price: "1600.00",
isNotional: true
},
limit: {
price: "1590.00",
isNotional: true
}
}
Stop-Buy Order
Stop-buy orders are triggered when the price reaches a specific threshold, useful for buying breakouts or entering positions when momentum shifts.
Field | Type | Required | Description |
---|---|---|---|
orderSide | string | Yes | Must be "buy" for stop-buy orders |
triggerType | string | Yes | "upper" or "lower" |
trigger | object | Yes | Price trigger condition |
limit | object | No | Optional limit price |
Examples
Basic stop-buy (buy when SOL breaks above $158):{
type: "stop",
chain: "solana",
targetAsset: "So11111111111111111111111111111111111111112", // SOL
contraAsset: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC
qty: "0.02",
orderSide: "buy",
slippageTolerance: "0.01",
maxPriceImpact: "0.01",
triggerType: "upper",
trigger: {
price: "158.00",
isNotional: false
}
}
{
type: "stop",
chain: "solana",
targetAsset: "So11111111111111111111111111111111111111112",
contraAsset: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
qty: "0.02",
orderSide: "buy",
slippageTolerance: "0.01",
maxPriceImpact: "0.01",
triggerType: "upper",
trigger: {
price: "158.00",
isNotional: false
},
limit: {
price: "160.00",
isNotional: false
}
}
Trigger Types
"upper"
: Buy when price breaks above trigger price (breakout strategy)"lower"
: Buy when price falls below trigger price (dip buying strategy)
---
## Response
```ts
{
quote: {
type: "limit",
chain: "ethereum",
targetAsset: "...",
contraAsset: "...",
qty: "1000",
orderSide: "buy",
quoteId: "00000000-0000-0000-0000-000000000004",
quotedAmountOut: "0.555555",
quotedPriceImpact: "0.0025",
slippageTolerance: "0.01",
maxPriceImpact: "0.01"
// ...order-type-specific fields
},
metadata: {
toNotional: "1000.00",
fromNotional: "999.95",
estimatedPriceImpact: "0.0025",
estimatedFee: "1.50",
estimatedFeeNotional: "1.50",
buyAmount: "0.555555"
}
}
Notes
- Always provide
limit.isNotional
for limit and stop-loss orders - Quotes are time-sensitive and should be submitted immediately
- You must submit the quote to place the order