Links

Streaming

Subscriptions (ClientSubscription) are the primary contract between the client and WebSocket server, and determine what you are streaming. Each subscription contains a resource.
The client can subscribe and unsubscribe to resources with the ClientSubscribeMessage and ClientUnsubscribeMessage.
Subscribe Request
Unsubscribe Request
{
"subscribe": {
"subscriptions": [
{
"streamSubscription": {
"resource": "pairs:9:trades"
}
},
{
"streamSubscription": {
"resource": "pairs:231:trades"
}
}
]
}
}
{
"unsubscribe": {
"subscriptions": [
{
"streamSubscription": {
"resource": "pairs:9:trades"
}
},
{
"streamSubscription": {
"resource": "pairs:231:trades"
}
}
]
}
}

Resources

A StreamSubscription contains one property resource, which is a string formatted as a colon-separated scope, entity ID, and subject.
[scope]:[id]:[subject]
For example, this resource would be scoped to a single market, like Kraken BTC/USD:
markets:86:[subject]
This is scoped to all markets on a single exchange, like Kraken:
exchanges:4:[subject]
This is scoped to all markets for a single instrument, like BTC/USD:
instruments:9:[subject]
Finally, this is scoped to all markets for all instruments with a given base asset (like BTC/*):
assets:60:[subject]
As a complete example, a client that subscribes to exchanges:4:trades will receive all trades that happen on the Kraken exchange.
Read more about all available subjects in the following sections:

Subscribing to multiple resources

A single connection can subscribe to many resources. This is really the power of the Cryptowatch WebSocket API - for example, one could subscribe to instruments:9:trades (BTC/USD), instruments:231:trades (BTC/USDT), and instruments:232:trades (BTC/EUR) to get all major BTC trade activity across the US and Europe on a single connection.

Object IDs

Every object in our system, such as an asset, instrument, or market, has a numeric ID that will never change. The WebSocket API uses these IDs (like 160) instead of human-readable symbols (like xrpusd) to avoid breaking changes when assets or exchanges rebrand and change their own name.

Looking up Object IDs

We provide REST API endpoints which you can use to look up Object IDs automatically.