Order Books - Level 2 Market Data

Learn how to fetch order books (level 2 market data) on CoinAPI.

What are order books?

To understand what order books are, we need to know the definition of market data, which is that market data is essentially the data that is provided by a cryptocurrency exchange to inform the stakeholders of the latest prices and other financial information for a particular cryptocurrency.

We can refer to order books are an advanced level of market data about cryptocurrencies that offer detailed information on ask and bid orders for a particular cryptocurrency. We can define order books into two levels—level 2 market data and level 3 market data. We’re going to focus on level 2 market data in this lesson.

The orderbooks endpoint

We can fetch level 2 market data using the orderbooks endpoint. As of this writing, CoinAPI provides current, latest, and historical data for level 2 order books.

Response JSON structures

The output JSON response for the orderbooks endpoint consists of the following variables:

Output Variables

Variable

Description

symbol_id

This variable represents the unique symbol identifier.

time_exchange

This variable represents the time of the trade transaction recorded by the exchange.

time_coinapi

This variable represents the time when CoinAPI first received the trade transaction from the exchange.

asks

This variable represents the 20 lowest levels which are ranked in ascending order.

bids

This variable represents the 20 highest levels which are ranked in descending order.

price

This variable represents the current price of the trade transaction. This variable will be nested inside the asks and bids variables.

size

This variable represents the amount of the base asset involved in the transaction trade. This variable will be nested inside the asks and bids variables.

Current order book data

We can get a complete list of all current level 2 order book data on CoinAPI. To fetch the ...