Dear API user,
Huobi Global is going to support a new version (v2) order update subscription topic in Websocket API –
- “orders#${symbol}”
Effective Date: April 3, 2020 (GMT+8)
All the changes will be updated on https://huobiapi.github.io/docs/spot/v1/en/
Huobi Global
April 4, 2020
The following are the changes in details:
## Subscribe order updates
API Key Permission: Read
An order update can be triggered by any of following:
- Order creation (eventType=creation);
- Order matching (eventType=trade);
- Order cancellation (eventType=cancellation).
The field list in order update message can be various per event type.
### Topic
` orders#${symbol}`
### Subscription Field
Field | Data Type | Description |
symbol | string | Trading symbol (wildcard ”*” is allowed) |
> Subscribe request
```json
{
"action": "sub",
"ch": " orders#btcusdt"
}
```
> Response
```json
{
"action": "sub",
"code": 200,
"ch": " orders#btcusdt",
"data": {}
}
```
### Update Content
After order creation –
Field | Data Type | Description |
eventType | string | Event type, valid value: creation |
symbol | string | Trading symbol |
orderId | long | Order ID |
clientOrderId | string | Client order ID (if any) |
orderPrice | string | Order price |
orderSize | string | Order size |
type | string | Order type, valid value: buy-limit, sell-limit, buy-limit-maker, sell-limit-maker |
orderStatus | string | Order status, valid value: submitted |
orderCreateTime | long | Order creation time |
Note: If a stop limit order is created but not yet triggered, the topic won’t send an update. Only when this stop limit order is triggered but not yet traded, the topic will send out an update with event type as “creation”. And also, inside the update, the order type is no longer as “buy-stop-limit” or “sell-stop-limit”, but changing to “buy-limit” or “sell-limit”.
```json
{
"action":"push",
"ch":"orders#btcusdt",
"data":
{
"orderSize":"2.000000000000000000",
"orderCreateTime":1583853365586,
"orderPrice":"77.000000000000000000",
"type":"sell-limit",
"orderId":27163533,
"clientOrderId":"a001",
"orderStatus":"submitted",
"symbol":"btcusdt",
"eventType":"creation"
}
}
```
After order matching –
Field | Data Type | Description |
eventType | string | Event type, valid value: trade |
symbol | string | Trading symbol |
tradePrice | string | Trade price |
tradeVolume | string | Trade volume |
orderId | long | Order ID |
clientOrderId | string | Client order ID (if any) |
tradeId | long | Trade ID |
tradeTime | long | Trade time |
aggressor | bool | Aggressor or not, valid value: true, false |
orderStatus | string | Order status, valid value: partial-filled, filled |
execAmt | string | Executed amount |
remainAmt | string | Remaining amount |
Note: If a taker’s order matching with multiple orders at opposite side simultaneously, the multiple trades will be disseminated over separately instead of merging into one trade.
```json
{
"action":"push",
"ch":"orders#btcusdt",
"data":
{
"tradePrice":"76.000000000000000000",
"tradeVolume":"1.013157894736842100",
"tradeId":301,
"tradeTime":1583854188883,
"aggressor":true,
"execAmt":"1.013157894736842100",
"remainAmt":"0.000000000000000400000000000000000000",
"orderId":27163536,
"clientOrderId":"",
"orderStatus":"filled",
"symbol":"btcusdt",
"eventType":"trade"
}
}
```
After order cancellation –
Field | Data Type | Description |
eventType | string | Event type, valid value: cancellation |
symbol | string | Trading symbol |
orderId | long | Order ID |
clientOrderId | string | Client order ID (if any) |
orderStatus | string | Order status, valid value: partial-canceled, canceled |
remainAmt | string | Remaining amount |
lastActTime | long | Last activity time |
```json
{
"action":"push",
"ch":"orders#btcusdt",
"data":
{
"lastActTime":1583853475406,
"remainAmt":"2.000000000000000000",
"orderId":27163533,
"clientOrderId":"a001",
"orderStatus":"canceled",
"symbol":"btcusdt",
"eventType":"cancellation"
}
}
```
What are the Impacts on You, and What You Need to Do?
API users should evaluate the business impact caused by the new topic introduced, as well as the decommissioning of old version Websocket APIs, further to make relevant change in client’s application.
All the changes will be updated on Huobi API Docs on the effective date.
Comments
0 comments
Article is closed for comments.