Skip to main content

Orders

In our standard, the parameter's order plays an important role as the position of the parameter represents a key. All utilized parameters must be present in request and response even if they are not utilized. To skip an optional parameter use the null value.

Order types supported with create_order method:

Order typeDescription
mMarket order
lLimit order
pPost only (Must not fill at all or is canceled)
fFill or kill (Must fully match at a given price or is canceled)
sStop
slStop-limit (available flags: OCO)

All arguments that used for order creation order:

โ„–NameData typeDescription
1instrumentstringUsed to specify instrument for order "btcusd"
2order_typestringUsed to specify order type
3sidestringUsed to specify order side, "buy" or "sell"
4quantitystringAn amount that placed within the order
5pricestringMain (limit) price of the order
6trigger_pricestringTrigger (Stop) price of the order
7tifstringTime in force instruction
9flagsintegerUsed to set custom order instructions
10timestampintegerUTC timestamp
11statusstringStatus of the order
12messagestringMessage related to the status of the order
13order_idstringSend by exchange with response for orders

Supported TIF instructions:

CodeNameDescription
1IOCAllows partial execution, unfilled part canceling.
2GTCRemain active until cancellation on stop.
3FOKAllows only full execution.

Supported order flags instructions:

CodeFlagTypeDescription
1HiddenintegerThe hidden order option ensures an order does not appear in the order book; thus does not influence other market participants.
2CloseintegerClose position if position present.
4Reduce OnlyintegerEnsures that the executed order does not flip the opened position.
8Post OnlyintegerThe post-only limit order option ensures the limit order will be added to the order book and not match with a pre-existing order.
16OCOintegerThe one cancels other order option allows you to place a pair of orders stipulating that if one order is executed fully or partially, then the other is automatically canceled.
32No Var RatesintegerExcludes variable rate funding offers from matching against this order, if on margin

For timestamps, use UTC time, expressed in milliseconds (i.e. 1588678924349)

Order statuses table:

CodeStatusDescription
1PendingOrder received by the exchange but haven't been placed in the order book yet
2WaitOrder placed in the order book and waits for execution
3DoneOrder fully executed
4RejectedOrder rejected due too some errors
5CanceledOrder canceled by user

Below you can find examples of different order types:

Market order#

Method name: create_order

Arguments with corresponding numeration of market order request:

โ„–NameData typeExample
1instrumentstring"btcusd"
2order_typestring"m"
3sidestring"buy"
4quantitystring"0.100000"
5pricestring"0"

Arguments with corresponding numeration of market order response:

โ„–NameData typeExample
1uuidstring"26eba5be-a0f9-11ea-afe8-0242ac190008"

Arguments with corresponding numeration of market order update notifications:

โ„–NameData typeExample
1instrumentstring"btcusd"
2idinteger8745635
3uuidstring"12d9ff0a-9b7b-11ea-ac47-0242ac170004"
4sidestring"buy"
5statusstring"d"
6order_typestring"m"
7pricestring"0"
8avg_pricestring"3.5"
9quantitystring"0"
10origin_quantitystring"10"
11executed_quantitystring"10"
12trades_countinteger2
13timestampinteger1588678924349
14reject_reasonstring"rejected by orderbook"

Example of the messages#

Request:

[1, 42, "create_order", ["btcusd", "m", "sell", "0.100000", "0"]]

Response:

[2, 42, "create_order", ["5b2c0ea2-9363-11eb-adb6-1831bf9834b0"]][[4,"on",["btcusd",4,"5b2c0ea2-9363-11eb-adb6-1831bf9834b0","sell","d","m","0","3.5","0","10","10",2,1617334050]]

Limit order#

A limit order can be customized with flags and TIF instructions.

Arguments with corresponding numeration of limit order request:

โ„–NameData typeExample
1instrumentstring"btcusd"
2order_typestring"m"
3sidestring"buy"
4quantitystring"0.100000"
5pricestring"0.100000"

Arguments with corresponding numeration of limit order response:

โ„–NameData typeExample
1uuidstring"26eba5be-a0f9-11ea-afe8-0242ac190008"

Arguments with corresponding numeration of market order update notifications:

โ„–NameData typeExample
1instrumentstring"btcusd"
2idinteger8745635
3uuidstring"12d9ff0a-9b7b-11ea-ac47-0242ac170004"
4sidestring"buy"
5statusstring"d"
6order_typestring"m"
7pricestring"0"
8avg_pricestring"3.5"
9quantitystring"0"
10origin_quantitystring"10"
11executed_quantitystring"10"
12trades_countinteger2
13timestampinteger1588678924349
14reject_reasonstring"rejected by orderbook"

Example of the messages#

Request:

[1,42,"create_order",["btcusd", "l", "buy", "0.250000", "9120.00", 2, "1234568", 0]

Response:

[2,42,"create_order",["30154236-9364-11eb-b9b2-1831bf9834b0"][4,"or",["btcusd",2,"30154236-9364-11eb-b9b2-1831bf9834b0","buy","r","l","10","0","0.5","0.5","0",0,1617334407,"rejected by orderbook"]]

Stop order#

Arguments with corresponding numeration of stop order request:

โ„–NameData typeExample
1instrumentstring"btcusd"
2order_typestring"s"
3sidestring"sell"
4quantitystring"0.250000"
5trigger_pricestring"9120.00"
6tifinteger2
7cidstring"1234568"
8flagsinteger0

Arguments with corresponding numeration of stop order response:

โ„–NameData typeExample
1instrumentstring"btcusd"
2order_typestring"s"
3sidestring"sell"
4quantitystring"0.250000"
5trigger_pricestring"9120.00"
6tifinteger2
7cidstring"1234568"
8flagsinteger0
9timestampinteger1588678984376
10statusstring"active"
11messagestring""
12order_idstring"8745985"

Example of the messages#

Request:

[1,42,"create_order",["btcusd", "s", "sell", "0.250000", "9120.00", 2, "1234568", 0]

Response:

[2,42,"create_order",["btcusd", "s", "sell", "0.250000", "9120.00", 2, "1234568", 0, 1588678984376, "active", "", "8745985"]

Stop-limit order#

Arguments with corresponding numeration of stop-limit order request:

โ„–NameData typeExample
1instrumentstring"btcusd"
2order_typestring"sl"
3sidestring"buy"
4quantitystring"0.250000"
5trigger_pricestring"9120.00"
6pricestring"9118.00"
7tifinteger2
8cidstring"1234568"
9flagsinteger0

Arguments with corresponding numeration of stop-limit order response:

โ„–NameData typeExample
1instrumentstring"btcusd"
2order_typestring"sl"
3sidestring"buy"
4quantitystring"0.250000"
5pricestring"9118.00"
6trigger_pricestring"9120.00"
7tifinteger2
8cidstring"1234568"
9flagsinteger0
10timestampinteger1588678984376
11statusstring"active"
12messagestring""
13order_idstring"8745985"

Example of the messages#

Request:

[1,42,"create_order",["btcusd", "sl", "buy", "0.250000", "9120.00", "9118.00", 2, "1234568", 0]

Response:

[2,42,"create_order",["btcusd", "sl", "buy", "0.250000", "9120.00", "9118.00", 2, "1234568", 0, 1588678984376, "active", "", "8745985"]

Bulk order#

Bulk order uses create_bulk method to send multiple orders within one request. Also, bulk orders can be used to send different order types with one request. We need to specify parsing order of orders inside the bulk order.

Example of the messages#

Request:

[1,42,"create_bulk",[[order_1_request], [order_2_request], [order_3_request], [order_4_request]]

Response:

[2,42,"create_bulk",[[order_1_response], [order_2_response], [order_3_response], [order_4_response]]