Quick Start — L3 Atom

Notion Page

The official version of this guide can be found on our Notion page. It has better layout and formatting, so we recommend reading it there instead.

Introduction

Welcome! This guide will take you through how to easily start streaming data from the L3 Atom MVP v1.0. Included is a step-by-step guide on how to start collecting live data, how to interact with our feed, and an FAQ.

The L3 Atom MVP collects live BTCUSD, BTCUSDT, and BTCUSD-PERPETUAL order book and trades data from eleven centralised exchanges and two decentralised exchanges. We handle the data cleaning and normalisation, then make both the raw data and normalised data available for streaming through our websocket feed.

Coverage

  • Binance (L2) | CEX
  • Apollox | DEX
  • DYDX | DEX
  • Bitfinex (L3) | CEX
  • Bybit (L2) | CEX
  • Coinbase (L3) | CEX
  • Deribit (L2) | CEX
  • FTX (L2) | CEX
  • Huobi (L2) | CEX
  • Kraken (L2) | CEX
  • Kucoin (L2) | CEX
  • Okex (L2) | CEX
  • Phemex (L2) | CEX

Orderbook, Trades, Open Interest, Open Value, Funding Rate, Mark Price, Index Price, Total Volume, Total Turnover

Endpoint

Websocket Endpoint: ws://194.233.73.248:30205/

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.

pip install websockets

Afterwards we can write a short Python script to establish a connection to our Websocket server.

import asyncio
import websockets
endpoint = "ws://194.233.73.248:30205/"async def connect():
async with websockets.connect(endpoint) as websocket:
print("Connected")
if __name__ == "__main__":
asyncio.run(connect())

Subscribing

Once we’re connected, we can subscribe to any available topic by sending the server the json string {'op': 'subscribe', 'topic': <exchange>}. For example, to subscribe to the Okex raw feed, we can add the following lines to our code:

import asyncio
import websockets
import json # For the json.dumps function
endpoint = "ws://194.233.73.248:30205/"async def connect():
async with websockets.connect(endpoint) as websocket:
print("Connected")
# Subscribing to Okex raw feed
request = {'op': 'subscribe', 'topic': 'okex'}
request_json = json.dumps(request).encode('utf-8')
await websocket.send(request_json)
print("Subscribed")
if __name__ == "__main__":
asyncio.run(connect())

We then asynchronously iterate through the websocket to print out the data coming in.

import asyncio
import websockets
import json # For the json.dumps function
endpoint = "ws://194.233.73.248:30205/"async def connect():
async with websockets.connect(endpoint) as websocket:
print("Connected")
# Subscribing to Okex raw feed
request = {'op': 'subscribe', 'topic': 'okex'}
request_json = json.dumps(request).encode('utf-8')
# Sending message to service
await websocket.send(request_json)
print("Subscribed")
# Printing out data
async for message in websocket:
print(message)
if __name__ == "__main__":
asyncio.run(connect())

Running the above code should start printing the data received from our service.

Unsubscribing

To unsubscribe, send {'op': 'unsubscribe', 'topic': 'okex'} 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.

Available Topics

There are seventeen total topics supported by our service, fourteen of which are raw data and three of which are aggregated and normalised data.

Raw Data Feeds

Normalised and Aggregated Data Feeds

More details about our data schema can be found in our official documentation.

FAQ

Question: Why did the service stop sending data?

Answer: The MVP v1.0 is the first iteration in a series of improvements we will continuously add to this project. This prototype is hosted on low-spec servers and so may crash at unexpected times. Sometimes, particular feeds may crash while others remain functional. If this happens we will have to restart the service. Please contact us if anything unexpected happens!

Question: How have you implemented your data feed?

Answer: The GitHub repository for the service is public.

Question: Are we allowed to fork and extend your implementation?

Answer: Absolutely! The project is completely open source. **

Question: Which ticker symbols can we access for each supported exchange?

Answer: Each exchange only supports one trading pair by default — one of BTCUSD, BTCUSDT, or one of the derivatives of those pairs.

Question: When will you add support for more ticker symbols?

Answer: We are not planning to add support for more ticker symbols in this version of the MVP. We are current developing the second version of this project, which we can scale to collect a larger volume of data.

Question: Do I have to use Python to stream data from your service?

Answer: No, any programming language which supports websocket connections can use the service.

Question: Do you have any code for dumping the data from your service into a file on disk?

Answer: Not at the moment, but we can update the guide with code for that on request. We can extend the repository we created earlier which dumps Coinbase data into a csv file to work for all feeds provided by our service.

Coming Soon

We are currently working on separating the feeds for each exchange into their own topic. Instead of having to use BTCUSD to receive data aggregated across all exchanges, you will be able to find the data separated by exchanges by subscribing to topics such as "coinbase-normalised" instead.

For each normalised feed, you will also receive an Orderbook snapshot as the first message upon subscription.

Please fill out the Google Form if you would like to receive an email reminder whenever there’s an update to the project.

Stay Updated

We will be sending out emails to all users which are registered for updates. Whenever we modify the behaviour of the public endpoints or details in this guide, a succinct version of the update will be sent out as a notification.

Registration Link: https://forms.gle/LhU1P7V4JFHfQzrj6

Giving Feedback

We want to ensure that using the MVP goes as smoothly as possible for you. If you have any suggestions or detect any issues with our feeds, we encourage you to reach out to us!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
GDA Fund

GDA Fund

222 Followers

GDA is developing the decentralized financial application development environment and rapid financial engineering protocol built on Ethereum.