Bids and asks

What is this CSV for?

All bids and asks on an exchange's order book. Use Kaiko Stream for real-time tick-level updates, or CSV for backdated information.

File Structure Details

  • File Name: [kaiko_legacy_slug]_[instrument_symbol]_[date].csv.gz

    • Files are generated on a daily basis.

    • example: bf_btcusdt_2022-09-01.csv

  • Cut-off time: 00:00:00 UTC

    • We use the timestamp when exchanges send the order book data points through websocket in order to cut-off the data points between days, if the timestamps are provided by the exchanges.

    • When the timestamps are not provided by the exchanges, we use the data collection timestamp when the data points arrive at Kaiko's collection system

  • Column Delimeter: ; (semi-colon)

  • Decimal Mark (in numbers): . (dot)

The exchanges providing timestamp:

  1. Binance (binc)

  2. Binance Options (bopt)

  3. Binance US (bnus)

  4. Bitmex (btmx)

  5. Bitpanda (bpnd)

  6. Bitstamp (stmp)

  7. Coinbase (cbse)

  8. Deribit (dbrt)

  9. Gemini (gmni)

  10. Huobi (huob)

  11. OkCoin (okcn)

  12. OKX (okex)

  13. OSL (oslx)

  14. Upbit (upbt)

  15. Huobi Derivatives Market (hbdm)

  16. Crypto Facilities (crfl)

  17. Bithumb (bthb)

The exchanges NOT providing timestamp:

  1. Bitfinex (bfnx)

  2. Bitflyer (bfly)

  3. CEX.io (cexi)

  4. Kraken (krkn)

  5. Itbit (itbi)

Column
Description
Example

timestamp

Timestamp when the exchanges send the data or we collect the data, depending on exchanges. In the epoch format.

1661990400274591751

type

Type of the message. s: snapshot. u: update.

s

asks

List of [ask price, volume]

[[20103,0],[20207,0],[20057,1.00111351]]

bids

List of [bid price, volume]

[[19584,0],[19904,21.9973]]

How to create a local order book with CSV files

  1. Download the CSV files, which usually start with updates (type: u).

  2. Ignore the updates before the 1st snapshot (type: s) that appears in the CSV file.

  3. If the prices in the updates exist in the locally managed order book, update the amount. The amount 0 means to remove the price level from the order book, because it is cancelled or filled.

  4. If the prices in the updates do not exist in the locally managed order book, insert that price level in the order book.

  5. Receiving an update that removes a price level that is not in your local order book is a normal exchange's behavior that can happen. In this case, you can just ignore the updates.

Please dump the locally managed order book if you encounter a snapshot between updates while maintaining the orderbook, and start fresh with the new snapshot.

Last updated

Was this helpful?