Quickstart Guide
Quickly establish a connection via websocket and start receiving streaming data and analytics.
Subscribing to the Endpoint
All subscriptions go through a single endpoint URL :
wss://pro.cryptostats.dev:8443/?options=:optionsYou can add your API key to gain access to your subscribed channels:
from websocket import create_connection
import urllib
options = {
api_key: [YOUR_API_KEY],
action: 'subscribe',
channels: [YOUR_CHANNELS]
}
options_url = urllib.parse.urlencode(options)
url = f'wss://pro.cryptostats.dev:8443/?options={options_url}'
ws = create_connection(url)
const options = {
api_key: [YOUR_API_KEY],
action: 'subscribe',
channels: [YOUR CHANNELS]
}
const options_URL = encodeURIComponent(JSON.stringify(options))
const url = `wss://pro.cryptostats.dev:8443/?options=${options_URL}`
const ws = new WebSocket(url)
Channel subscriptions can be passed as part of the options parameters or can be sent separately after connecting to the WebSocket.
Full Implementation
Below is a working implementation subscribing to normalized trades on the BTC-PERPETUAL instrument at deribit:
Live Runnable Example (Node.js)
Live Runnable Example (Python)
Last updated
Was this helpful?