private/order_quote
Dry-run pricing helper that estimates the outcome of a prospective order without placing it, returning projected fill price and amount, fees, pre/post initial margin, realized PnL, resulting order status and (where relevant) liquidation price and max tradable amount. All monetary values are returned as decimal strings. The private variant requires account-level authentication.
curl --request POST \
--url https://api.derive.xyz/v3/private/order_quote \
--header 'Content-Type: application/json' \
--header 'X-DeriveSignature: <api-key>' \
--header 'X-DeriveTimestamp: <api-key>' \
--header 'X-DeriveWallet: <api-key>' \
--data '
{
"amount": "<string>",
"instrument_name": "<string>",
"limit_price": "<string>",
"max_fee": "<string>",
"nonce": "<string>",
"signature": "<string>",
"signature_expiry_sec": 123,
"signer": "<string>",
"subaccount_id": 123,
"client": "",
"extra_fee": null,
"is_atomic_signing": false,
"label": "",
"mmp": false,
"order_type": "limit",
"reduce_only": false,
"referral_code": "",
"reject_post_only": true,
"reject_timestamp": 9223372036854776000,
"time_in_force": "gtc",
"trigger_price": null
}
'import requests
url = "https://api.derive.xyz/v3/private/order_quote"
payload = {
"amount": "<string>",
"instrument_name": "<string>",
"limit_price": "<string>",
"max_fee": "<string>",
"nonce": "<string>",
"signature": "<string>",
"signature_expiry_sec": 123,
"signer": "<string>",
"subaccount_id": 123,
"client": "",
"extra_fee": None,
"is_atomic_signing": False,
"label": "",
"mmp": False,
"order_type": "limit",
"reduce_only": False,
"referral_code": "",
"reject_post_only": True,
"reject_timestamp": 9223372036854776000,
"time_in_force": "gtc",
"trigger_price": None
}
headers = {
"X-DeriveWallet": "<api-key>",
"X-DeriveTimestamp": "<api-key>",
"X-DeriveSignature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-DeriveWallet': '<api-key>',
'X-DeriveTimestamp': '<api-key>',
'X-DeriveSignature': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '<string>',
instrument_name: '<string>',
limit_price: '<string>',
max_fee: '<string>',
nonce: '<string>',
signature: '<string>',
signature_expiry_sec: 123,
signer: '<string>',
subaccount_id: 123,
client: '',
extra_fee: null,
is_atomic_signing: false,
label: '',
mmp: false,
order_type: 'limit',
reduce_only: false,
referral_code: '',
reject_post_only: true,
reject_timestamp: 9223372036854776000,
time_in_force: 'gtc',
trigger_price: null
})
};
fetch('https://api.derive.xyz/v3/private/order_quote', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.derive.xyz/v3/private/order_quote",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => '<string>',
'instrument_name' => '<string>',
'limit_price' => '<string>',
'max_fee' => '<string>',
'nonce' => '<string>',
'signature' => '<string>',
'signature_expiry_sec' => 123,
'signer' => '<string>',
'subaccount_id' => 123,
'client' => '',
'extra_fee' => null,
'is_atomic_signing' => false,
'label' => '',
'mmp' => false,
'order_type' => 'limit',
'reduce_only' => false,
'referral_code' => '',
'reject_post_only' => true,
'reject_timestamp' => 9223372036854776000,
'time_in_force' => 'gtc',
'trigger_price' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-DeriveSignature: <api-key>",
"X-DeriveTimestamp: <api-key>",
"X-DeriveWallet: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.derive.xyz/v3/private/order_quote"
payload := strings.NewReader("{\n \"amount\": \"<string>\",\n \"instrument_name\": \"<string>\",\n \"limit_price\": \"<string>\",\n \"max_fee\": \"<string>\",\n \"nonce\": \"<string>\",\n \"signature\": \"<string>\",\n \"signature_expiry_sec\": 123,\n \"signer\": \"<string>\",\n \"subaccount_id\": 123,\n \"client\": \"\",\n \"extra_fee\": null,\n \"is_atomic_signing\": false,\n \"label\": \"\",\n \"mmp\": false,\n \"order_type\": \"limit\",\n \"reduce_only\": false,\n \"referral_code\": \"\",\n \"reject_post_only\": true,\n \"reject_timestamp\": 9223372036854776000,\n \"time_in_force\": \"gtc\",\n \"trigger_price\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-DeriveWallet", "<api-key>")
req.Header.Add("X-DeriveTimestamp", "<api-key>")
req.Header.Add("X-DeriveSignature", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.derive.xyz/v3/private/order_quote")
.header("X-DeriveWallet", "<api-key>")
.header("X-DeriveTimestamp", "<api-key>")
.header("X-DeriveSignature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\",\n \"instrument_name\": \"<string>\",\n \"limit_price\": \"<string>\",\n \"max_fee\": \"<string>\",\n \"nonce\": \"<string>\",\n \"signature\": \"<string>\",\n \"signature_expiry_sec\": 123,\n \"signer\": \"<string>\",\n \"subaccount_id\": 123,\n \"client\": \"\",\n \"extra_fee\": null,\n \"is_atomic_signing\": false,\n \"label\": \"\",\n \"mmp\": false,\n \"order_type\": \"limit\",\n \"reduce_only\": false,\n \"referral_code\": \"\",\n \"reject_post_only\": true,\n \"reject_timestamp\": 9223372036854776000,\n \"time_in_force\": \"gtc\",\n \"trigger_price\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.derive.xyz/v3/private/order_quote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-DeriveWallet"] = '<api-key>'
request["X-DeriveTimestamp"] = '<api-key>'
request["X-DeriveSignature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"<string>\",\n \"instrument_name\": \"<string>\",\n \"limit_price\": \"<string>\",\n \"max_fee\": \"<string>\",\n \"nonce\": \"<string>\",\n \"signature\": \"<string>\",\n \"signature_expiry_sec\": 123,\n \"signer\": \"<string>\",\n \"subaccount_id\": 123,\n \"client\": \"\",\n \"extra_fee\": null,\n \"is_atomic_signing\": false,\n \"label\": \"\",\n \"mmp\": false,\n \"order_type\": \"limit\",\n \"reduce_only\": false,\n \"referral_code\": \"\",\n \"reject_post_only\": true,\n \"reject_timestamp\": 9223372036854776000,\n \"time_in_force\": \"gtc\",\n \"trigger_price\": null\n}"
response = http.request(request)
puts response.read_body{
"estimated_fee": "<string>",
"estimated_fill_amount": "<string>",
"estimated_fill_price": "<string>",
"estimated_order_status": "open",
"estimated_realized_pnl": "<string>",
"estimated_realized_pnl_excl_fees": "<string>",
"is_valid": true,
"post_initial_margin": "<string>",
"pre_initial_margin": "<string>",
"suggested_max_fee": "<string>",
"invalid_reason": "<string>",
"max_amount": "<string>",
"post_liquidation_price": "<string>"
}{
"error": {
"code": 123,
"message": "<string>",
"data": "<string>"
}
}Authorizations
The wallet the request acts for.
The current time in milliseconds, as a decimal string.
EIP-191 signature of the timestamp, by the wallet or one of its session keys.
Body
Parameters for public/order_quote and private/order_quote.
Order amount in units of the base, as a decimal string (e.g. "1.5") or a JSON number.
Order direction
buy, sell Instrument name
Limit price in quote currency, as a decimal string or a JSON number.
Max fee per unit of volume in quote currency, as a decimal string or a JSON number.
Nonce.
Ethereum signature of the order.
Signature expiry (unix seconds).
Owner wallet or session key that signed the order.
Subaccount ID
Optional builder fee for the whole order, in USDC, as a decimal string or JSON number. Each fill pays its pro-rata share. Defaults to zero.
limit, market gtc, post_only, fok, ioc Trigger price as a decimal string or JSON number; omit for non-trigger orders.
mark, index stoploss, takeprofit Response
Success
Estimated fill price, fees, and resulting margin for a proposed order — a non-binding dry-run. All price, fee, and margin fields are decimal strings.
open, filled, rejected, cancelled, expired, untriggered, algo_active curl --request POST \
--url https://api.derive.xyz/v3/private/order_quote \
--header 'Content-Type: application/json' \
--header 'X-DeriveSignature: <api-key>' \
--header 'X-DeriveTimestamp: <api-key>' \
--header 'X-DeriveWallet: <api-key>' \
--data '
{
"amount": "<string>",
"instrument_name": "<string>",
"limit_price": "<string>",
"max_fee": "<string>",
"nonce": "<string>",
"signature": "<string>",
"signature_expiry_sec": 123,
"signer": "<string>",
"subaccount_id": 123,
"client": "",
"extra_fee": null,
"is_atomic_signing": false,
"label": "",
"mmp": false,
"order_type": "limit",
"reduce_only": false,
"referral_code": "",
"reject_post_only": true,
"reject_timestamp": 9223372036854776000,
"time_in_force": "gtc",
"trigger_price": null
}
'import requests
url = "https://api.derive.xyz/v3/private/order_quote"
payload = {
"amount": "<string>",
"instrument_name": "<string>",
"limit_price": "<string>",
"max_fee": "<string>",
"nonce": "<string>",
"signature": "<string>",
"signature_expiry_sec": 123,
"signer": "<string>",
"subaccount_id": 123,
"client": "",
"extra_fee": None,
"is_atomic_signing": False,
"label": "",
"mmp": False,
"order_type": "limit",
"reduce_only": False,
"referral_code": "",
"reject_post_only": True,
"reject_timestamp": 9223372036854776000,
"time_in_force": "gtc",
"trigger_price": None
}
headers = {
"X-DeriveWallet": "<api-key>",
"X-DeriveTimestamp": "<api-key>",
"X-DeriveSignature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-DeriveWallet': '<api-key>',
'X-DeriveTimestamp': '<api-key>',
'X-DeriveSignature': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '<string>',
instrument_name: '<string>',
limit_price: '<string>',
max_fee: '<string>',
nonce: '<string>',
signature: '<string>',
signature_expiry_sec: 123,
signer: '<string>',
subaccount_id: 123,
client: '',
extra_fee: null,
is_atomic_signing: false,
label: '',
mmp: false,
order_type: 'limit',
reduce_only: false,
referral_code: '',
reject_post_only: true,
reject_timestamp: 9223372036854776000,
time_in_force: 'gtc',
trigger_price: null
})
};
fetch('https://api.derive.xyz/v3/private/order_quote', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.derive.xyz/v3/private/order_quote",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => '<string>',
'instrument_name' => '<string>',
'limit_price' => '<string>',
'max_fee' => '<string>',
'nonce' => '<string>',
'signature' => '<string>',
'signature_expiry_sec' => 123,
'signer' => '<string>',
'subaccount_id' => 123,
'client' => '',
'extra_fee' => null,
'is_atomic_signing' => false,
'label' => '',
'mmp' => false,
'order_type' => 'limit',
'reduce_only' => false,
'referral_code' => '',
'reject_post_only' => true,
'reject_timestamp' => 9223372036854776000,
'time_in_force' => 'gtc',
'trigger_price' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-DeriveSignature: <api-key>",
"X-DeriveTimestamp: <api-key>",
"X-DeriveWallet: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.derive.xyz/v3/private/order_quote"
payload := strings.NewReader("{\n \"amount\": \"<string>\",\n \"instrument_name\": \"<string>\",\n \"limit_price\": \"<string>\",\n \"max_fee\": \"<string>\",\n \"nonce\": \"<string>\",\n \"signature\": \"<string>\",\n \"signature_expiry_sec\": 123,\n \"signer\": \"<string>\",\n \"subaccount_id\": 123,\n \"client\": \"\",\n \"extra_fee\": null,\n \"is_atomic_signing\": false,\n \"label\": \"\",\n \"mmp\": false,\n \"order_type\": \"limit\",\n \"reduce_only\": false,\n \"referral_code\": \"\",\n \"reject_post_only\": true,\n \"reject_timestamp\": 9223372036854776000,\n \"time_in_force\": \"gtc\",\n \"trigger_price\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-DeriveWallet", "<api-key>")
req.Header.Add("X-DeriveTimestamp", "<api-key>")
req.Header.Add("X-DeriveSignature", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.derive.xyz/v3/private/order_quote")
.header("X-DeriveWallet", "<api-key>")
.header("X-DeriveTimestamp", "<api-key>")
.header("X-DeriveSignature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\",\n \"instrument_name\": \"<string>\",\n \"limit_price\": \"<string>\",\n \"max_fee\": \"<string>\",\n \"nonce\": \"<string>\",\n \"signature\": \"<string>\",\n \"signature_expiry_sec\": 123,\n \"signer\": \"<string>\",\n \"subaccount_id\": 123,\n \"client\": \"\",\n \"extra_fee\": null,\n \"is_atomic_signing\": false,\n \"label\": \"\",\n \"mmp\": false,\n \"order_type\": \"limit\",\n \"reduce_only\": false,\n \"referral_code\": \"\",\n \"reject_post_only\": true,\n \"reject_timestamp\": 9223372036854776000,\n \"time_in_force\": \"gtc\",\n \"trigger_price\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.derive.xyz/v3/private/order_quote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-DeriveWallet"] = '<api-key>'
request["X-DeriveTimestamp"] = '<api-key>'
request["X-DeriveSignature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"<string>\",\n \"instrument_name\": \"<string>\",\n \"limit_price\": \"<string>\",\n \"max_fee\": \"<string>\",\n \"nonce\": \"<string>\",\n \"signature\": \"<string>\",\n \"signature_expiry_sec\": 123,\n \"signer\": \"<string>\",\n \"subaccount_id\": 123,\n \"client\": \"\",\n \"extra_fee\": null,\n \"is_atomic_signing\": false,\n \"label\": \"\",\n \"mmp\": false,\n \"order_type\": \"limit\",\n \"reduce_only\": false,\n \"referral_code\": \"\",\n \"reject_post_only\": true,\n \"reject_timestamp\": 9223372036854776000,\n \"time_in_force\": \"gtc\",\n \"trigger_price\": null\n}"
response = http.request(request)
puts response.read_body{
"estimated_fee": "<string>",
"estimated_fill_amount": "<string>",
"estimated_fill_price": "<string>",
"estimated_order_status": "open",
"estimated_realized_pnl": "<string>",
"estimated_realized_pnl_excl_fees": "<string>",
"is_valid": true,
"post_initial_margin": "<string>",
"pre_initial_margin": "<string>",
"suggested_max_fee": "<string>",
"invalid_reason": "<string>",
"max_amount": "<string>",
"post_liquidation_price": "<string>"
}{
"error": {
"code": 123,
"message": "<string>",
"data": "<string>"
}
}