Prices Websocket

Zero Hash offers a way for clients to subscribe to a live price-feed.

Supported Symbols

The supported symbol varies by environment:

Cert: BTC/USD, ETH/USD, LTC/USD
Prod: Where Liquidity = Yes here
You can also query the currently supported list by sending a message of type info and with the topic set to available-symbols via the websocket feed.

Flow

Subscribe to the feed specifying the symbol

{  
"messageType": "subscribe",  
"topic": "prices",  
"body": {  
	"filter": {  
		"symbol": "BTC/USD"  
}  
},  
"key": "q8LbmdWVQKmgBY3Z8kxyce",  
"passphrase": "passphrase",  
"timestamp": "1649258173",  
"signature": "v1nPveZui3glOtW3UJblvFr77jKXVMq63uKZPuVUKIc="  
}

Success Respponse Message

{  
"messageType": "subscribe",  
"body": "successfully subscribed to the BTC/USD feed"  
}

Price Update

{  
"messageType": "price-update",  
"body": {  
"symbol": "BTC/USD",  
"bid_levels": [  
{  
"price": "41308.764375",  
"quantity": "0.6",  
"side": "buy"  
},  
{  
"price": "41304.0827",  
"quantity": "1.81",  
"side": "buy"  
},  
{  
"price": "41299.581475",  
"quantity": "3.62",  
"side": "buy  
},  
{  
"price": "41293.746925",  
"quantity": "7.25",  
"side": "buy"  
},  
{  
"price": "41288.293325",  
"quantity": "12.09",  
"side": "buy"  
},  
{  
"price": "41283.0703",  
"quantity": "18.14",  
"side": "buy"  
},  
{  
"price": "41275.0904",  
"quantity": "30.24",  
"side": "buy"  
},  
{  
"price": "41261.0955",  
"quantity": "60.48",  
"side": "buy"  
},  
{  
"price": "41242.298625",  
"quantity": "120.96",  
"side": "buy"  
},  
{  
"price": "41216.995525",  
"quantity": "241.92",  
"side": "buy"  
}  
],  
"ask_levels": [  
{  
"price": "41364.1704",  
"quantity": "0.6",  
"side": "sell"  
},  
{  
"price": "41367.990825",  
"quantity": "1.81",  
"side": "sell"  
},  
{  
"price": "41371.322475",  
"quantity": "3.62",  
"side": "sell"  
},  
{  
"price": "41376.050625",  
"quantity": "7.25",  
"side": "sell"  
},  
{  
"price": "41380.659075",  
"quantity": "12.09",  
"side": "sell"  
},  
{  
"price": "41385.1578",  
"quantity": "18.14",  
"side": "sell"  
},  
{  
"price": "41392.1004",  
"quantity": "30.24",  
"side": "sell"  
},  
{  
"price": "41404.3896",  
"quantity": "60.48",  
"side": "sell"  
},  
{  
"price": "41420.988",  
"quantity": "120.96",  
"side": "sell"  
},  
{  
"price": "41443.381875",  
"quantity": "241.92",  
"side": "sell"  
}  
]  
}  
}

Use Cases

  • Display dynamic price updates on your app's UI, indicative pricing, and book depth