Quick Start
Introduction
Welcome! This guide will take you through how to start streaming data from the L3 Atom MVP v2. Included is a step-by-step guide on how to start collecting live data and how to interact with our feed.
Endpoint
Websocket Endpoint: wss://ws.shared.projectx.network/
Getting Started
We can use any websocket connection library to establish a connection to our service. This guide will use aaugstin’s Python 3.0 websockets library. You will need to have Python installed on your computer to follow along - so please refer to the official documentation if it is not installed.
Connecting
Once Python is installed, install the websockets library by running the following command on the terminal.
Afterwards we can write a short Python script to establish a connection to our Websocket server.
Subscribing
Once we’re connected, we can subscribe to any available topic by sending the server the json string {'op': 'subscribe', 'exchange': <exchange>, 'feed': <feed>}
. For example, to subscribe to the Okex raw feed, we can add the following lines to our code:
We then asynchronously iterate through the websocket to print out the data coming in.
Running the above code should start printing the data received from our service.
If you wanted the Okex normalised or trades feed instead, replace 'raw'
in the 'feed'
field of the request
variable with 'normalised'
or 'trades'
instead. Explanations of the data schemas and request formats are explored in the API reference.
Unsubscribing
To unsubscribe, send {"op": "unsubscribe", "exchange": "okex", "feed", "raw"}
to the service in the same way as shown above.
Maintaining an Orderbook
We have written Orderbook data structures for both L2 and L3 data which can be freely used. Our feed currently doesn’t provide a snapshot, so we have to rely on the asymptotic correctness of continual updates to maintain a correct book instead. Orderbook snapshots will be implemented in the near future.
Last updated