Place a new order
Build a limit order transaction
In the following example, we will be creating a limit order.
To place a new order, you must provide the following:
price
quantity
side
symbol
type
For an in-depth API reference Build order transaction
curl --location 'https://api.deltadefi.io/order/build' \
--header 'x-api-key: <your_api_key>' \
--header 'Content-Type: application/json' \
--data '{
"symbol": "ADAUSDX",
"side": "buy",
"type": "limit",
"quantity": 100,
"price": 0.93
}'const axios = require('axios');
let data = JSON.stringify({
"symbol": "ADAUSDX",
"side": "buy",
"type": "limit",
"quantity": 100,
"price": 0.93
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.deltadefi.io/order/build',
headers: {
'x-api-key': '<your_api_key>',
'Content-Type': 'application/json'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});Submit a limit order transaction
After the order transaction is built, you will then need to sign it before submitting it.
To submit:
curl --location 'https://api.deltadefi.io/order/submit' \
--header 'X-API-KEY: <your_api_key>' \
--header 'Content-Type: application/json' \
--data '{
"order_id": "<order_id>",
"signed_tx":"<signed_tx>"
}'const axios = require('axios');
let data = JSON.stringify({
"order_id": "<order_id>",
"signed_tx": "<signed_tx>"
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api-staging.deltadefi.io/order/submit',
headers: {
'X-API-KEY': '<your_api_key>',
'Content-Type': 'application/json'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});Build a market order transaction
In this example we will be creating a market order.
For an in-depth API reference Build order transaction
To place a market order, provide the following:
price
quantity
side
symbol
type
limit_slippage / max_slippage_basis_point (either one)
limit_slippage (bool): If set to false, the market order will allow unlimited slippage until the entire order quantity is filled, where the account's purchasing power allows
max_slippage_basis_points (int): Maximum Slippage is the maximum acceptable deviation between the expected price (market price) and the actual executed price in a market order transaction
curl --location 'https://api-staging.deltadefi.io/order/build' \
--header 'x-api-key: <your_api_key>' \
--header 'Content-Type: application/json' \
--data '{
"symbol": "ADAUSDX",
"side": "buy",
"type": "market",
"quantity": 100,
"limit_slippage": true
}'const axios = require('axios');
let data = JSON.stringify({
"symbol": "ADAUSDX",
"side": "buy",
"type": "market",
"quantity": 100,
"limit_slippage": false
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api-staging.deltadefi.io/order/build',
headers: {
'x-api-key': '<your_api_key>',
'Content-Type': 'application/json'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
After the transaction is built, follow step 2 above to submit the transaction.
📖 Get Order Records
After an order is created, you can find your order records with the Order records API
For open orders:
Pass the query param
openOrder
For orderHistory:
pass the query param
orderHistory
For tradingHistory
pass the query param
tradingHistory
curl --location 'https://api.deltadefi.io/accounts/order-records?status=open' \
--header 'x-api-key: <your_api_key>'const axios = require('axios');
let config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://api.deltadefi.io/accounts/order-records?status=open',
headers: {
'x-api-key': '<your_api_key>'
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Related FAQ
Last updated