Websocket Streaming APICryptowatch offers a real-time Websocket Streaming API. It streams data for all of the markets supported on Cryptowatch.
The API is hosted at
Alpha Testing Invitation
This API is currently in an invite-only alpha testing phase. Please inquire here if you are interested in getting access to it.
All messages sent over the Streaming API are encoded using Protocol Buffers. Protocol Buffers were chosen over JSON for their high efficiency, among other benefits.
Our protobuf definitions are available at github.com/cryptowatch/proto.
Client LibrariesYou will want to use a client libeary to handle authenticating and connecting to the api. So far we have libraries written for `Golang` and `NodeJS`.
Since this API is not freely available to the public like our REST API, each client must authenticate their connection. Our authentication scheme relies on an API key and a secret key; when establishing a connection the client must send an APIAuthenticationMessage containing their public key, a nonce, and a token which is an HMAC-SHA-512 created with the corresponding secret key.
An example implementation of this HMAC can be found at stream-client-go.
A client subscribes to a feed using the ClientSubscribeMessage. One can subscribe to market data using various scopes:
- a single market (kraken:btceur)
- all markets on an exchange (kraken)
- all markets for a given pair (btceur)
- all markets for a given asset (btc)
- all markets in the system
Subscriptions are represented as colon-delimited strings. For example,
exchanges:4:trades is a feed of all trades on the
id=4 exchange (Kraken). A client need only subscribe to this single feed to receive all trade updates for the Kraken exchange.
One must know the entity ID associated with the scope they want to subscribe to. These IDs can be looked up in our REST API:
- the Kraken BTC/EUR market is ID
- the Gemini exchange is ID
- the ETH/BTC pair is ID
- the XVG asset is ID
In some cases, one can also use a wildcard ID to scope their subscription to all markets.
Below we enumerate all possible subscription types, and the scopes they support.
Proto message type: TradesUpdate
|markets:68:trades||A feed of trades for a single market|
|markets:*:trades||A feed of trades for all markets; this is the firehose|
|exchanges:4:trades||A feed of all trades on a given exchange|
|pairs:232:trades||A feed of all trades for a given pair|
|assets:60:trades||A feed of all trades for a given asset|
See our example code for consuming a trade feed.
24 Hour Market Summary
Periodic messages summarizing a given market over the last 24 hours, including last price, total volume, total quote volume, and price change.
Proto message type: SummaryUpdate
|markets:68:summary||Market summary updates for a single market|
|markets:*:summary||Market summary updates for all markets|
|markets:*:summary-low-volume||Market summary updates for all markets.|
Throttled to one update per market per 2 minutes.
|exchanges:4:summary||Market summary updates for a given exchange|
|pairs:232:summary||Market summary updates for a given pair|
|assets:60:summary||Market summary updates for a given asset|
Otherwise known as "candlestick" data, an OHLC subscription publishes updates to the latest candlestick for each time period. See also REST API OHLC data for reference.
Proto message type: IntervalsUpdate
|markets:68:ohlc||OHLC (candlestick) updates for a single market|
We publish real-time updates to the spread (best bid & ask) for the order book.
Proto message type: OrderBookSpreadUpdate
|markets:68:book:spread||Order book spread updates for a given market|
|markets:*:book:spread||Order book spread updates for all markets|
|exchanges:4:book:spread||Order book spread updates for a given exchange|
|pairs:232:book:spread||Order book spread updates for a given pair|
|assets:60:book:spread||Order book spread updates for a given asset|
The structure of our orderbook data is going through some changes. We will document full order book feeds soon! Let us know if you are interested in this data.
Here's some example code showing how to connect, authenticate, subscribe to feeds, and consume the messages received: