Huobi Global is going to support a new version (v2) order update subscription topic in Websocket API – - “orders#${symbol}”

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

FieldData TypeDescription
symbolstringTrading 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 –

FieldData TypeDescription
eventTypestringEvent type, valid value: creation
symbolstringTrading symbol
orderIdlongOrder ID
clientOrderIdstringClient order ID (if any)      
orderPricestringOrder price
orderSizestringOrder size
typestringOrder type, valid value: buy-limit, sell-limit, buy-limit-maker, sell-limit-maker
orderStatusstringOrder status, valid value: submitted
orderCreateTimelongOrder 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 –

FieldData TypeDescription
eventTypestringEvent type, valid value: trade
symbolstringTrading symbol
tradePricestringTrade price
tradeVolumestringTrade volume
orderIdlongOrder ID
clientOrderIdstringClient order ID (if any)
tradeIdlongTrade ID
tradeTimelongTrade time
aggressorboolAggressor or not, valid value: true, false
orderStatusstringOrder status, valid value: partial-filled, filled
execAmtstringExecuted amount
remainAmtstringRemaining 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 –

FieldData TypeDescription
eventTypestringEvent type, valid value: cancellation
symbolstringTrading symbol
orderIdlongOrder ID
clientOrderIdstringClient order ID (if any)
orderStatusstringOrder status, valid value: partial-canceled, canceled
remainAmtstringRemaining amount
lastActTimelongLast 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.