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" , "take-profit" |
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
}
}
Take Profit Order
Take profit orders automatically sell when the price rises to a target level, allowing you to lock in gains.
Field | Type | Required | Description |
---|---|---|---|
orderSide | string | Yes | Must be "sell" for take-profit orders |
trigger | object | Yes | Price trigger to activate the order |
limit | object | No | Optional minimum execution price |
Examples
Basic take profit (sell SOL when it hits $180):{
type: "take-profit",
chain: "solana",
targetAsset: "So11111111111111111111111111111111111111112", // SOL
contraAsset: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC
qty: "0.5",
orderSide: "sell",
slippageTolerance: "0.01",
maxPriceImpact: "0.01",
trigger: {
price: "180.00",
isNotional: true // Price in USD
}
}
{
type: "take-profit",
chain: "solana",
targetAsset: "So11111111111111111111111111111111111111112",
contraAsset: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
qty: "0.5",
orderSide: "sell",
slippageTolerance: "0.01",
maxPriceImpact: "0.01",
trigger: {
price: "180.00",
isNotional: true
},
limit: {
price: "178.00", // Minimum price to protect against slippage
isNotional: true
}
}
{
type: "take-profit",
chain: "solana",
targetAsset: "So11111111111111111111111111111111111111112", // SOL
contraAsset: "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", // ETH
qty: "0.5",
orderSide: "sell",
slippageTolerance: "0.01",
maxPriceImpact: "0.01",
trigger: {
price: "0.055", // SOL/ETH cross rate
isNotional: false // Cross-asset price, not USD
}
}
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"
}
}
Field Explanations
trigger
vs limit
trigger
: The price that activates the order. When this price is reached, the order becomes active.limit
: Optional constraint on execution price. Protects against slippage by setting a minimum (for sell orders) or maximum (for buy orders) execution price.
Example: Take profit with trigger at $180 and limit at $178:
- Order activates when SOL hits $180
- But will only execute if price is $178 or higher (protects against immediate price drop)
isNotional
Flag
true
: Price is in USD (notional value)false
: Price is the cross-rate between the two assets
Examples:
{ price: "180.00", isNotional: true }
= SOL at $180 USD{ price: "0.055", isNotional: false }
= SOL/ETH ratio of 0.055
Order Execution
- Stop-loss and take-profit without limit: Becomes a market order when triggered (executes immediately at best available price)
- With limit: Becomes a limit order when triggered (waits for favorable price, may not fill immediately)
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
- Order Status: You must poll Order Details to track order status - websocket subscriptions are not yet available