-
Notifications
You must be signed in to change notification settings - Fork 30
Trading API
Trade API covers all order placement and trade management.
Below is the list of possible order status values:
- New
- Placed
- Failed
- Error
- Cancelled
- Partially Cancelled
- Fully Matched
- Partially Matched
All numbers, specifically for price and volume, must be converted to an integer for use in Trading API requests. The conversion is 100000000, or 1E8. For strongly typed programming languages, use of integer or long integer variable types is strongly recommended, as decimals will not be accepted by the API.
path: /order/create
http post
Please note:
- The clientRequestId is not currently used but must be specified. Any string is valid.
- Price of $130 = 13000000000 (i.e x 100000000)
- Volume of 1 BTC = 100000000 (i.e x 100000000)
- When passing AUD as currency, maximum 2 decimal points are allowed. In above example, $130 and $130.12 are allowed but $130.123 will return "invalid amount".
- All parameters are mandatory for this API.
- In case of placing Market orders, price is still required, however the price is ultimately set by matching engine depending on existing orders in the orderbook at the time of trade execution.
sample request:
{"currency":"AUD","instrument":"BTC","price":13000000000,"volume":10000000,"orderSide":"Bid","ordertype":"Limit","clientRequestId":"abc-cdf-1000"}
sample success response:
{"success":true,"errorCode":null,"errorMessage":null,"id":100,"clientRequestId":"abc-cdf-1000"}
sample error response
{"success":false,"errorCode":3,"errorMessage":"Invalid argument.","id":0,"clientRequestId":"abc-cdf-1000"}
path: /order/cancel
http post
sample request:
{"orderIds":[6840125478]}
sample response:
{"success":true,"errorCode":null,"errorMessage":null,"responses":[{"success":false,"errorCode":3,"errorMessage":"order does not exist.","id":6840125478}]}
path: /order/history
http post
since parameter for this api method is the order id.
sample request:
{"currency":"AUD","instrument":"BTC","limit":10,"since":33434568724}
sample response:
{"success":true,"errorCode":null,"errorMessage":null,"orders":[{"id":1003245675,"currency":"AUD","instrument":"BTC","orderSide":"Bid","ordertype":"Limit","creationTime":1378862733366,"status":"Placed","errorMessage":null,"price":13000000000,"volume":10000000,"openVolume":10000000,"clientRequestId":null,"trades":[]},{"id":4345675,"currency":"AUD","instrument":"BTC","orderSide":"Ask","ordertype":"Limit","creationTime":1378636912705,"status":"Fully Matched","errorMessage":null,"price":13000000000,"volume":10000000,"openVolume":0,"clientRequestId":null,"trades":[{"id":5345677,"creationTime":1378636913151,"description":null,"price":13000000000,"volume":10000000,"fee":100000}]}]}
path: /order/open
http post
This is similar to the order history request and response. The only difference is that this method only returns open orders.
path: /order/trade/history
http post
since parameter for this api method is the trade id.
sample request:
{"currency":"AUD","instrument":"BTC","limit":10,"since":33434568724}
sample response:
{"success":true,"errorCode":null,"errorMessage":null,"trades":[{"id":374367855,"creationTime":1492232900701,"price":159672000000,"volume":100000,"side":"Ask","fee":1357210,"orderId":374367838},{"id":229485482,"creationTime":1478837751322,"price":94299000000,"volume":100000,"side":"Bid","fee":801540,"orderId":229485469}]}
path: /order/detail
http post
sample request:
{"orderIds":[698068, 698771, 698825]}
sample response:
{
"success": true,
"errorCode": null,
"errorMessage": null,
"orders": [
{
"id": 698068,
"currency": "AUD",
"instrument": "ETH",
"orderSide": "Ask",
"ordertype": "Market",
"creationTime": 1516140997056,
"status": "Fully Matched",
"errorMessage": null,
"price": 1200000000,
"volume": 5000000,
"openVolume": 0,
"clientRequestId": null,
"trades": [
{
"id": 698080,
"creationTime": 1516140997301,
"description": null,
"price": 1200000000,
"volume": 5000000,
"side": "Ask",
"fee": 509999,
"orderId": 698068
}
]
},
{
"id": 698771,
"currency": "AUD",
"instrument": "BTC",
"orderSide": "Bid",
"ordertype": "Limit",
"creationTime": 1516919450949,
"status": "Partially Matched",
"errorMessage": null,
"price": 2700000000,
"volume": 100000000,
"openVolume": 4400000,
"clientRequestId": null,
"trades": [
{
"id": 698935,
"creationTime": 1517808598156,
"description": null,
"price": 2700000000,
"volume": 95600000,
"side": "Bid",
"fee": 21940174,
"orderId": 698771
}
]
},
{
"id": 698825,
"currency": "AUD",
"instrument": "BTC",
"orderSide": "Bid",
"ordertype": "Limit",
"creationTime": 1516923611252,
"status": "Placed",
"errorMessage": null,
"price": 2700000000,
"volume": 100000000,
"openVolume": 100000000,
"clientRequestId": null,
"trades": []
}
]
}
Introduction updated 9/28/18
WebSocket v1 deprecated
Market Data API updated 7/24/19
Trading API updated 08/19/19
Account API updated 3/14/19
Fund Transfer API updated 08/06/19