Bulk Order
Submit orders in bulk. This endpoint is recommended when you need to submit more than 5 orders at once.
By using this endpoint you will only consume a single rate limit request and not 5. It will also be much faster than submitting the orders individually.
There are certain restrictions in place for orders submitted through this endpoint:
1) The orders must have the same market
2) The orders can not be reduce only
To submit bulk orders for different markets you will need to split your orders into separate requests (one request for each market).
A minimum of 1 order and a maximum of 50 orders can be submitted per request. The endpoint is currently rate limited at 1200 orders per minute. Contact us if you require higher limits.
The endpoint is all-or-nothing. If one of the included orders cannot be accepted (i.e. due to balance issues), all orders will be rejected.
The endpoint requires a signed payload in HMAC-SHA256 form to be appended to the x-signature header. The signed payload must be base64-encoded.
Javascript example:
const formurlencoded = require('form-urlencoded').default;
const crypto = require("crypto-js");
const fetch = require("node-fetch");
const API_KEY = "<YOUR_API_KEY>";
const SECRET_KEY = "<YOUR_SECRET_KEY>";
(async function() {
const payload = {orders: [{pair: 'USD_BTCCALL_PERP', side: 'BUY', price: 1, qty: 0.001, timestamp: Date.now()}, {pair: 'USD_BTCCALL_PERP', side: 'BUY', price: 0.5, qty: 0.002, timestamp: Date.now()}]}
const payload_url_encoded = formurlencoded(payload);
const HMAC = crypto.HmacSHA256(payload_url_encoded, SECRET_KEY).toString(crypto.enc.Base64);
const submitted = await fetch('https://api.everstrike.io/auth/order/bulk', {method: 'POST', body: payload_url_encoded, headers: {'content-type': 'application/x-www-form-urlencoded', 'x-api-key': API_KEY, 'x-signature': HMAC}});
const response = await submitted.json();
console.log(response);
})();
curl \
-X POST https://api.everstrike.io/auth/order/bulk \
-H "x-api-key: $API_KEY"
{
"code": 200,
"msg": "string",
"result": {
"orders": [
{
"pair": "USD_BTCCALL_PERP",
"type": "LIMIT",
"side": "SELL",
"customer_id": "5f9ca5f0-380e-11e9-bf51-91a076098e19",
"qty_orig": 0.002,
"qty_remaining": 0.002,
"price": 120,
"price_orig": 120,
"time_in_force": "GTC",
"status": "ACTIVE",
"time": 1551137077642,
"fills": [],
"id": "849cdea0395411e98f54b395ae9c7bb6",
"qty_orig_usd": 0.28101585963,
"leverage": 1,
"post_only": false,
"reduce_only": false,
"hidden": false
},
{
"pair": "USD_BTCCALL_PERP",
"type": "LIMIT",
"side": "SELL",
"customer_id": "5f9ca5f0-380e-11e9-bf51-91a076098e19",
"qty_orig": 0.005,
"qty_remaining": 0.005,
"price": 130,
"price_orig": 130,
"time_in_force": "GTC",
"status": "ACTIVE",
"time": 1551137077642,
"fills": [],
"id": "249cdea0395411e98f54b395ae9c7bc7",
"qty_orig_usd": 0.29101585963,
"leverage": 1,
"post_only": false,
"reduce_only": false,
"hidden": false
}
],
"balances": {
"BTC": {
"free": 21,
"locked": 2,
"withdrawn": 0
}
},
"position": {
"size": 1,
"free": 1,
"locked": 0,
"realized": 0,
"fills": [],
"stats": {
"size": 1,
"notional": 0.14,
"margin": 1,
"pnl": 0,
"equity": 1,
"roe": 0,
"mark": 2.1,
"avg_entry": 3.4,
"leverage": 2.82,
"lp": 3.7,
"bankrupt": 3.78,
"direction": "BUY"
}
}
}
}
{
"code": 503,
"msg": "Invalid request",
"result": {}
}