For the complete documentation index, see llms.txt. This page is also available as Markdown.

Bids and asks

What is this endpoint 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. When you connect, you first receive a full snapshot of the current order book with every bid and ask, followed by continuous real-time updates for every change ("delta") that takes place.

Endpoints

gateway-v0-grpc.kaiko.ovh
gateway-v0-http.kaiko.ovh
https://gateway-v0-http.kaiko.ovh/api/stream/orderbookl2_v1
https://gateway-v0-http.kaiko.ovh/api/stream/orderbookl2_replay_v1

Request parameters

Parameter
Description
Examples

instrumentCriteria

A nested object to configure following properties for your stream:

  • exchange (String) - The code(s) for the exchange(s)

  • instrument_class (String) - The class(es) of the instrument(s) .

  • code (String) - The Kaiko code for the instrument.

Explore instruments, codes and exchanges in the Instrument Explorer or Reference Data.

cbse

spot

algo-btc

Configuring a wildcard

A wildcard allows you to request all information we have on a specific instrument, class, or exchange in the same stream. Use a * in place of the relevant exchange, instrument, or class parameter.

For example, the configuration below would deliver trades for BTC/USD across all exchanges where it’s supported:

exchange: * class: spot instrument: btc-usd

Response fields

Field
Description

class

Instrument class, empty when not mapped.

code

Instrument code, empty when not mapped.

exchange

Instrument exchange code.

sequenceId

Sequence ID for event. Sortable in lexicographic order.

updateType

SNAPSHOT - A new Snapshot of the order book UPDATED- A new batch of bids & asks since the snapshot

asks

Represents sell orders

amount: the quantity of the base asset available for sale

price: the price per unit of the base that the seller is willing to accept in the quote asset, represented as a scientific notation Example: algo-btc

  • base asset = algo

  • quote asset = btc amount : 42656.0 price: 1.97e-06

  • The asker has 42656.0 Algo available

  • For each unit of Algo, the buyer is willing to accept 1.97e-06 BTC, equal to 0.00000197 when converted to a decimal number

bids

Represents buy orders.

amount: the quantity of the base asset the buyer is willing to purchase

price: the price per unit of the base that the buyer is willing to pay in the quote asset, represented as a scientific notation Example: algo-btc

  • base asset = algo

  • quote asset = btc amount : 80569.0 price: 1.96e-06

  • The buyer will purchase up to 80569.0 Algo

  • For each unit of Algo, the buyer is willing to pay 1.96e-06 BTC, equal to 0.00000196 when converted to a decimal number

tsExchange

The timestamp provided by the exchange for the data. Where exchanges do not provide this data, we fill this with tsCollection. This applies to the following exchanges:

  • Bitfinex (bfnx)

  • Bitflyer (bfly)

  • CEX.io (cexi)

tsCollection

The timestamp for when Kaiko received the data from the exchange.

tsEvent

The timestamp the data became available in the Kaiko system.

Request examples

This example demonstrates how to request historical data using replay. The maximum amount of data you can request for one replay cannot exceed a total of 24 hours in hours, seconds, and minutes.

Replay data is available on a 72-hour rolling basis and should only be used to retrieve missed data. If full history is required, please use Rest API or CSV deployment methods.

https://github.com/kaikodata/kaiko-sdk-examples/blob/master/python/code-example/orderbookl2_v1_replay_request.py

cURL requests are intended for testing purposes only.

For more advanced users, you can access our full SDK here, where you'll find more coding languages, examples and guidance.

Response Example

Last updated

Was this helpful?