Ask us anything. We're here to help.

Websocket - FAQ

Does Zero Hash have a Websocket API ?

Yes, Zero Hash have a private websocket API available at the following urls:

The private websocket feed provides real-time balance and price updates for streamlined processing.

All messages sent and received via the websocket API are in JSON format. The details of each message type are available in our API spec.

 

How do I know I'm successfully connected? How do I know I'm still connected?

Once subscribed to any of the above feeds, a ping message must be sent every 20 seconds to keep the subscription active; otherwise, the connection will be closed.

{"messageType":"pong"} will be received in response to every ping message sent while the subscription is still connected.

 

Does websocket feeds provide historical data ?

The websocket price feeds only provide current data.

The websocket balance feed will send an 'initial-balance' message upon connection. Any balance update events before connection will not be received. The REST API can be used for historical data.

 

Where can I see the price and quantity precision in the price feed ?

The websocket price feed will follow the precisions specified here.

 

Where can I get more information?

The complete websocket API specification is available in the Private Socket Feed section of the Zero Hash Api Spec.

There are also more help guides available in the API section of our Help Center.