A7 Header

Python API call to Retrieve Order Book Data from A7 API

This article is designed to show users how to use A7 Python API to extract data (e.g. top of the book) for a given futures contract. We cover a simple call to download data using algos functionality in A7. Addtionally this article provides the backbone of further uses cases.

The following segment of code sets up the API parameters and imports packages.

Below is the main function call to retrieve top of the order book for FGBL futures contract (Security ID 4611674) given a date. Note that a market segment ID (688) needs to be provided in the call as well. This data can be obtained from the A7 UI or from RDI (please refer to RDI usecase).

The request returns a JSON data format. This can be parsed into a data structure. For example below we expand the JSON format into a DataFrame for the bid side.

The same strategy can be used to extract for the offer side.

Once the data has been extracted and formatted as above it can be visualised.