The following documentation covers the Cryptowatch WebSocket API for streaming market data. The API provides a standardized way to access market data for 26 major crypto exchanges. You need a Pro Plan to access the WebSocket API.
We recommend using one of the SDKs since they properly handle authentication, connection logic, and provide many useful abstractions from our messaging layer. We have libraries written for
All messages sent over the WebSocket API are encoded using Protocol Buffers. Our protobuf definitions are publicly available here:
Strings Vs Floats
All price, ID, and subscription data are represented as
strings. This is to prevent loss of significant digits from using
float, as well as to provide a consistent and simple API.
protobuf message fields that use
float are deprecated in favor of a
string replacement. It is recommended you use the latest version of our client libraries which properly handle this deprecation.
Connect to the API at the following url.
Each connection to the WebSocket API must be authenticated with an API key and secret key.
After establishing a connection, the client sends an APIAuthenticationMessage
containing their public key, a nonce, and a token which is an
created with the corresponding secret key. An example implementation of generating the token in Go can be found
Subscriptions (ClientSubscription) are the primary contract between the client and WebSocket server, and determine what you are streaming. For streaming, subscriptions are data resources that receive live updates.
A ClientSubscription is always followed by a SubscriptionResult, which contains a list of the successful subscriptions, as well as any failed subscriptions if applicable. Similarly, unsubscribing (ClientUnsubscribeMessage) is always followed by a UnsubscriptionResult. When a subscription fails, it usually means the client does not have access, or the subscription key is invalid.
To stream data, clients should connect to
wss://stream.cryptowat.ch and provide a list of ClientSubscriptions (StreamSubscription) as part of the as part of the APIAuthenticationMessage. The client will receive live updates for each subscription until it unsubscribes or the connection is closed.
a StreamSubscription contains one property
resource, which is a string formatted as a colon-separated scope, ID, and subject. For example, the resource
exchanges:4:trades is a feed of all trades in the scope
exchanges where the ID is
4 (Kraken) and the subject is
trades. A client that subscribes to
exchanges:4:trades will receive all trade updates for the Kraken exchange.
The following table shows the available subscription prefixes, and where to find the resource IDs using the REST API.
|Example Prefix||Description||Resource IDs Endpoint|
|Market 86 (Kraken BTC/EUR)|
|All markets for exchange 4 (Kraken)|
|All markets for pair 232 (BTC/EUR)|
|All markets for asset 60 (BTC)|
TradesUpdate is sent for every trade on a given market.
|A feed of trades for a single market||real-time|
|A feed of trades for all markets||real-time|
|A feed of all trades on a given exchange||real-time|
|A feed of all trades for a given pair||real-time|
|A feed of all trades for a given asset||real-time|
See our example code for consuming trade feeds:
24-Hour Market Summary
A SummaryUpdate includes
volume (base and quote), and
price change (percentage and absolute).
|Market summary updates for market 68||real-time|
|Market summary updates for all markets||real-time|
|Market summary updates for all markets (throttled)||2m|
|Market summary updates for all markets in exchange 4||real-time|
|Market summary updates for all markets with pair 232||real-time|
|Market summary updates for all markets with asset 60||real-time|
Candlestick Data (OHLC)
|OHLC updates for market 68||real-time|
|OHLC updates for all markets||real-time|
|OHLC updates for all markets in exchange 4||real-time|
|OHLC updates for all markets with pair 232||real-time|
|OHLC updates for all markets with asset 60||real-time|
Order book data is separated into three streams for
spread. Order book snapshots are broadcast
once per minute, while the deltas are real-time. To maintain a real-time order book, apply deltas to the most recent snapshot.
Both deltas and snapshots contain a sequence number, so you can determine if the data is recieved in the correct order.
OrderBookUpdate contains a snapshot of the order book to the highest degree of accuracy available from the exchange.
|Order book snapshots for market 68||1m|
|Order book snapshots for all markets in exchange 4||1m|
|Order book snapshots for all markets with pair 232||1m|
|Order book snapshots for all markets with asset 60||1m|
OrderBookDeltaUpdate is sent in real-time as updates to the order book occur. These deltas are meant to be applied to a snapshot to keep a real-time order book.
|Order book delta updates for market 68||real-time|
|Order book delta updates for all markets in exchange 4||real-time|
|Order book delta updates for all markets with pair 9||real-time|
|Order book delta updates for all markets with asset 60||real-time|
OrderBookSpreadUpdate is sent when the order book spread (best bid & ask) changes.
|Order book spread updates for a given market||real-time|
|Order book spread updates for all markets||real-time|
|Order book spread updates for a given exchange||real-time|
|Order book spread updates for a given pair||real-time|
|Order book spread updates for a given asset||real-time|