Methods for managing orders
On this page:
THE ORDER OBJECT |
|
GET[host]/back-api/api/v2/orders |
|
GET[host]/back-api/api/v2/orders |
|
GET[host]/back-api/api/v2/orders/{orderId} |
The Order object
This object provides the following data about an order:
- averageFillPrice string
The average price at which an order or its portion is filled by this time.
- commissionCurrency string
The commission currency.
- createdAt string
The date and time when the order was placed, with μs precision.
- effectiveLimitPrice string
For limit orders, the actual price at which the order was filled.
- email string
The user email.
- filledAmount string
The amount in which the order is filled by this time.
- market string
The currency pair identifier (such as
btc_usdt
):{baseAsset}_{quoteAsset}
.- orderId string
The order identifier.
- orderStatus string
The current order status.
- orderType string
The order type:
Limit
orMarket
.- remainingAmount string
For partially filled orders, the amount which remains to be filled.
- requestedAmount string
The full order amount, as requested when an order was placed.
- requestedLimitPrice string
For limit orders, the limit price specified when an order was placed.
- side string
The order side:
buy
orsell
.- timeInForce string
The time-in-force rules:
FOK
— for fill-or-kill ordersGTC
— for good-‘til-cancelled orders
- totalCommission string
The total commission charged for an order.
- updatedAt string
The date and time when the order status has last been updated.
- userId string
The user identifier, in the GUID string format.
- userName string
The username.
- userRoles array
An array of string values, indicating the user roles.
- IsApiKey boolean
If
true
, an order was placed using the API; otherwise,false
.
{
"averageFillPrice": "0.00013785",
"commissionCurrency": "usd",
"createdAt": "2019-06-18T10:25:29.694882Z",
"effectiveLimitPrice": "",
"email": "bot@mail.com",
"filledAmount": "1",
"market": "btc_usdt",
"orderId": "-72057594037927934",
"orderStatus": "Completed",
"orderType": "Limit",
"remainingAmount": "0",
"requestedAmount": "1",
"requestedLimitPrice": "1",
"side": "Buy",
"timeInForce": "GTC",
"totalCommission": "0.001",
"updatedAt": "2019-06-18T10:25:29.694886Z",
"userId": "9d2ec919-5fd6-4ba2-860a-8235d877b0bc",
"userName": "6ab6e8ba-fb15-3852-bbfa-53e1755f2c38",
"userRoles": [ "Trader" ],
"IsApiKey": true
}
Get order history
Use this method to view orders meeting various criteria.
Request
Header parameters:
Authorization: Bearer <access_token>
Query parameters:
- From
The earliest date and time when the orders must have been placed to be included in a response:
YYYY-MM-DDThh:mm:ss
.When unspecified (
null
), all orders are returned that were placed before the latest specified date.- To
The latest date and time when the orders must have been placed to be included in a response:
YYYY-MM-DDThh:mm:ss
.This value cannot exceed the earliest specified date by more than seven days.
When unspecified (
null
), all orders are returned that were placed after the earliest specified date.- User
The username or email (the entries matching this string are returned).
- User_id
The user identifier.
- OrderId
The order identifier.
- Status
The current order status.
- Market
The currency pair identifier (such as
btc_usdt
):{baseAsset}_{quoteAsset}
.- Type
The order type:
Limit
orMarket
.To include data for multiple order types, specify each type separately (
Type=Limit&Type=Market
).- Sort
Sorting by date:
+CREATEDAT
— ascending order-CREATEDAT
— descending order
- Cursor
The page number, in the range indicated in a previous paging response.
- Side
The order side: buy (
0
) or sell (1
).- Roles
The user roles.
GET[host]/back-api/api/v2/orders
GET /back-api/api/v2/orders
?From=2017-01-16T14%3A33%3A59
&User=bot%mail.com
&Status=Completed
&Market=btc_usdt
&Type=Limit
&Type=Market
&Sort=-CREATEDAT
&Cursor=0
&Side=0
&Roles=Trader HTTP 1.1
Host: host.name
Authorization: Bearer akvmn34egjidg0jifgjdg0djg34g
Response
A response includes an array of Order objects providing information about the orders matching the query parameters specified in the request.
Get order details
Use this method to obtain detailed information about a specified order.
Request
Header parameters:
Authorization: Bearer <access_token>
Query parameters:
- OrderId required
The order identifier.
GET[host]/back-api/api/v2/orders
GET /back-api/api/v2/orders?OrderId=-72057594037927934 HTTP/1.1
Host: host.name
Authorization: Bearer akvmn34egjidg0jifgjdg0djg34g
Response
A response includes an Order object providing detailed information about a specified order.
Get a history of order updates
A single order can be executed in portions, with each consecutive trade being made at the next best price for a certain amount of assets, until the order is executed in the full amount.
Use this method to obtain information about order updates, including a list of trades that were executed while filling an order and other changes of the order status.
Request
Header parameters:
Authorization: Bearer <access_token>
Path parameters:
- orderId required
The order identifier.
GET[host]/back-api/api/v2/orders/{orderId}
GET /back-api/api/v2/orders/-72057594037927934 HTTP/1.1
Host: host.name
Authorization: Bearer akvmn34egjidg0jifgjdg0djg34g
Response
A response includes a specified Order object along with the following information about each change of the order status:
- accountVersion string
The user account version.
- createdAt number
The date and time when the trade request orginated, with μs precision.
- execType string
The reason behind a status change:
OrderStatusUpdate
— an update to the order status unrelated to execution of any tradesTrade
— execution of a trade as part of filling an order
- tradeId string
The trade identifier.
- orderStatus string
The current order status.
- remainingAmount number
For partially filled orders, the amount which remains to be filled.
- filledAmount string
The amount in which an order was filled after executing a specified trade.
- filledQuoteAmount number
The amount in which a trade was executed, in the quote asset.
- filledBaseAmount number
The amount in which a trade was executed, in the base asset
- tradePrice number
The price at which a trade was executed.
- tradeAmount number
The amount traded.
- rejectDetails string
For rejected orders, the reason for rejection.
- commission number
The commission paid for an order.
- commissionCurrency string
The commission currency.
{
"order": {
"averageFillPrice": "0.00013785",
"commissionCurrency": "usd",
"createdAt": "2019-06-18T10:25:29.694882Z",
"effectiveLimitPrice": "",
"email": "bot@mail.com",
"filledAmount": "1",
"market": "btc_usdt",
"orderId": "-72057594037927934",
"orderStatus": "Completed",
"orderType": "Limit",
"remainingAmount": "0",
"requestedAmount": "1",
"requestedLimitPrice": "1",
"side": "Buy",
"timeInForce": "GTC",
"totalCommission": "0.001",
"updatedAt": "2019-06-18T10:25:29.694886Z",
"userId": "9d2ec919-5fd6-4ba2-860a-8235d877b0bc",
"userName": "6ab6e8ba-fb15-3852-bbfa-53e1755f2c38",
"userRoles": [ "Trader" ],
"IsApiKey": true
},
"executions": [
{
"accountVersion": 6,
"createdAt": "2019-11-19T13:19:41.886245Z",
"execType": "OrderStatusUpdate",
"tradeId": "0",
"orderStatus": "Completed",
"remainingAmount": "0",
"filledAmount": "0",
"filledQuoteAmount": "72541.80",
"filledBaseAmount": "10",
"tradePrice": "7254.18",
"tradeAmount": "0",
"rejectDetails": "",
"commission": "72.54180",
"commissionCurrency": "eur"
}
]
}