WebSocket v2 API Updates

1. Order Flags

The biggest change to our websocket API is the addition of order flags. With flags, request fields that apply to order parameters are now eliminated and are replaced with an integer that can be summed.

The following flags are now available (taken from our node API library):

For example — if you would like to submit a Hidden Post Only order you would set the flags field to 4160, the result of sum, or binary AND, between 64 (Hidden) and 4096 (Post Only)

The following endpoints now support the new order flags field:

Orders — https://docs.bitfinex.com/v2/reference#ws-auth-orders

— https://docs.bitfinex.com/v2/reference#ws-auth-orders New Order — https://docs.bitfinex.com/v2/reference#ws-input-order-new

— https://docs.bitfinex.com/v2/reference#ws-input-order-new Update Order — https://docs.bitfinex.com/v2/reference#ws-input-order-new

— https://docs.bitfinex.com/v2/reference#ws-input-order-new Order Multiple-OP — https://docs.bitfinex.com/v2/reference#ws-input-order-multi-op

— https://docs.bitfinex.com/v2/reference#ws-input-order-multi-op New Offer — https://docs.bitfinex.com/v2/reference#new-offer

2. Timestamp Flag

A websocket flag that was added was the timestamp flag. When sending the WebSocket `conf` request, you may apply the new timestamp flag of value 32768. Once received, the timestamp will appended to every array sent by the server.

Just like order flags, the timestamp flag can be summed with other conf flags.

All available conf flags can be found here: https://docs.bitfinex.com/v2/docs/ws-general#section-available-options

3. Order Update

https://docs.bitfinex.com/v2/reference#update-order

You may now update an order via the WebSocket API in-place. You can change an order’s price, amount, change an amount with a given delta, alter group IDs, and change the trailing price delta. Prior to this, changes to an order were applied by cancelling & submitting a new order (orders were immutable).

A few examples:

4. Offer Submit

https://docs.bitfinex.com/v2/reference#new-offer

You may now submit an offer via the WebSocket API to receive or provide funding.

A few examples:

5. Broadcast Custom Notification

https://docs.bitfinex.com/v2/reference#ws-auth-notifications

Users can now broadcast custom notifications via the WebSocket v2 API, with the only requirement being that the notification type must begin with ‘ucm’. Notifications broadcast by a user are echo’ed out from all other active API connections, and have no limitations on payload or internal structure.

With this broadcast system, users can now build multi-client integrations with Bitfinex which use the WSv2 API for synchronisation and control. A simple example use-case is to generate custom ‘ucm-req’ and ‘ucm-res’ notifications for broadcasting arbitrary requests/responses over the bitfinex notification system. This removes the need for an external push-broadcast system, for those integrations that have multiple connected API clients which must communicate with one another in real-time.

The following is example notification broadcast packet:

At Bitfinex, we use this system ourselves to allow our UI to communicate with external user components connected to our WS API.