Preview an order
curl --request POST \
--url https://testnet.edel-api.xyz/v1/orders/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "<string>",
"marketId": "<string>",
"orderType": "market",
"leverageX": 2,
"reduceOnly": true,
"quantityAtoms": "<string>",
"notionalAtoms": "<string>"
}
'import requests
url = "https://testnet.edel-api.xyz/v1/orders/preview"
payload = {
"accountId": "<string>",
"marketId": "<string>",
"orderType": "market",
"leverageX": 2,
"reduceOnly": True,
"quantityAtoms": "<string>",
"notionalAtoms": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
accountId: '<string>',
marketId: '<string>',
orderType: 'market',
leverageX: 2,
reduceOnly: true,
quantityAtoms: '<string>',
notionalAtoms: '<string>'
})
};
fetch('https://testnet.edel-api.xyz/v1/orders/preview', 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://testnet.edel-api.xyz/v1/orders/preview",
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([
'accountId' => '<string>',
'marketId' => '<string>',
'orderType' => 'market',
'leverageX' => 2,
'reduceOnly' => true,
'quantityAtoms' => '<string>',
'notionalAtoms' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://testnet.edel-api.xyz/v1/orders/preview"
payload := strings.NewReader("{\n \"accountId\": \"<string>\",\n \"marketId\": \"<string>\",\n \"orderType\": \"market\",\n \"leverageX\": 2,\n \"reduceOnly\": true,\n \"quantityAtoms\": \"<string>\",\n \"notionalAtoms\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://testnet.edel-api.xyz/v1/orders/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"accountId\": \"<string>\",\n \"marketId\": \"<string>\",\n \"orderType\": \"market\",\n \"leverageX\": 2,\n \"reduceOnly\": true,\n \"quantityAtoms\": \"<string>\",\n \"notionalAtoms\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://testnet.edel-api.xyz/v1/orders/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"accountId\": \"<string>\",\n \"marketId\": \"<string>\",\n \"orderType\": \"market\",\n \"leverageX\": 2,\n \"reduceOnly\": true,\n \"quantityAtoms\": \"<string>\",\n \"notionalAtoms\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"version": "external-order-preview/v1",
"accountId": "<string>",
"marketId": "<string>",
"side": "buy",
"orderType": "limit",
"quantityAtoms": "<string>",
"quantity": "<string>",
"notionalAtoms": "<string>",
"notional": "<string>",
"estimatedEntryPriceAtoms": "<string>",
"estimatedEntryPrice": "<string>",
"estimatedSlippageBps": 1,
"wouldExceedMaxSlippage": true,
"requiredMarginAtoms": "<string>",
"requiredMargin": "<string>",
"estimatedFeeAtoms": "<string>",
"estimatedFee": "<string>",
"feeRole": "maker",
"estimatedLiquidationPriceAtoms": "<string>",
"estimatedLiquidationPrice": "<string>",
"maintenanceMarginBps": 1,
"availableForOrdersAtoms": "<string>",
"availableForOrders": "<string>",
"sufficient": true,
"asOf": {
"markPriceAtoms": "<string>",
"markPrice": "<string>",
"journalSequence": 1
}
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}Orders
Preview an order
Computes estimated entry price, slippage, margin, fees, and liquidation price without reserving or journaling state.
Method and path: POST /v1/orders/preview
Authentication: DFNS trader bearer required.
Request schema: ExternalOrderPreviewRequest.
Response schema: ExternalOrderPreviewResponse.
Error envelope: ExternalRestError (external-rest-error/v1).
POST
/
v1
/
orders
/
preview
Preview an order
curl --request POST \
--url https://testnet.edel-api.xyz/v1/orders/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "<string>",
"marketId": "<string>",
"orderType": "market",
"leverageX": 2,
"reduceOnly": true,
"quantityAtoms": "<string>",
"notionalAtoms": "<string>"
}
'import requests
url = "https://testnet.edel-api.xyz/v1/orders/preview"
payload = {
"accountId": "<string>",
"marketId": "<string>",
"orderType": "market",
"leverageX": 2,
"reduceOnly": True,
"quantityAtoms": "<string>",
"notionalAtoms": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
accountId: '<string>',
marketId: '<string>',
orderType: 'market',
leverageX: 2,
reduceOnly: true,
quantityAtoms: '<string>',
notionalAtoms: '<string>'
})
};
fetch('https://testnet.edel-api.xyz/v1/orders/preview', 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://testnet.edel-api.xyz/v1/orders/preview",
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([
'accountId' => '<string>',
'marketId' => '<string>',
'orderType' => 'market',
'leverageX' => 2,
'reduceOnly' => true,
'quantityAtoms' => '<string>',
'notionalAtoms' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://testnet.edel-api.xyz/v1/orders/preview"
payload := strings.NewReader("{\n \"accountId\": \"<string>\",\n \"marketId\": \"<string>\",\n \"orderType\": \"market\",\n \"leverageX\": 2,\n \"reduceOnly\": true,\n \"quantityAtoms\": \"<string>\",\n \"notionalAtoms\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://testnet.edel-api.xyz/v1/orders/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"accountId\": \"<string>\",\n \"marketId\": \"<string>\",\n \"orderType\": \"market\",\n \"leverageX\": 2,\n \"reduceOnly\": true,\n \"quantityAtoms\": \"<string>\",\n \"notionalAtoms\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://testnet.edel-api.xyz/v1/orders/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"accountId\": \"<string>\",\n \"marketId\": \"<string>\",\n \"orderType\": \"market\",\n \"leverageX\": 2,\n \"reduceOnly\": true,\n \"quantityAtoms\": \"<string>\",\n \"notionalAtoms\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"version": "external-order-preview/v1",
"accountId": "<string>",
"marketId": "<string>",
"side": "buy",
"orderType": "limit",
"quantityAtoms": "<string>",
"quantity": "<string>",
"notionalAtoms": "<string>",
"notional": "<string>",
"estimatedEntryPriceAtoms": "<string>",
"estimatedEntryPrice": "<string>",
"estimatedSlippageBps": 1,
"wouldExceedMaxSlippage": true,
"requiredMarginAtoms": "<string>",
"requiredMargin": "<string>",
"estimatedFeeAtoms": "<string>",
"estimatedFee": "<string>",
"feeRole": "maker",
"estimatedLiquidationPriceAtoms": "<string>",
"estimatedLiquidationPrice": "<string>",
"maintenanceMarginBps": 1,
"availableForOrdersAtoms": "<string>",
"availableForOrders": "<string>",
"sufficient": true,
"asOf": {
"markPriceAtoms": "<string>",
"markPrice": "<string>",
"journalSequence": 1
}
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
- Option 1
- Option 2
Minimum string length:
1Minimum string length:
1Available options:
buy, sell Allowed value:
"market"Required range:
x >= 1Pattern:
^[1-9][0-9]*$Pattern:
^[1-9][0-9]*$Response
Success
Allowed value:
"external-order-preview/v1"Minimum string length:
1Minimum string length:
1Available options:
buy, sell Available options:
limit, market Pattern:
^[1-9][0-9]*$Pattern:
^-?[0-9]+\.[0-9]+$Pattern:
^[1-9][0-9]*$Pattern:
^-?[0-9]+\.[0-9]+$Pattern:
^[1-9][0-9]*$Pattern:
^-?[0-9]+\.[0-9]+$Required range:
x >= 0Pattern:
^[0-9]+$Pattern:
^-?[0-9]+\.[0-9]+$Pattern:
^[0-9]+$Pattern:
^-?[0-9]+\.[0-9]+$Available options:
maker, taker Pattern:
^[0-9]+$Pattern:
^-?[0-9]+\.[0-9]+$Required range:
x >= 0Pattern:
^[0-9]+$Pattern:
^-?[0-9]+\.[0-9]+$Show child attributes
Show child attributes