Full Aggregation

Read more about how the aggregation period works: Order Book Aggregations

What is this endpoint for?

This endpoint returns the following metrics, averaged for the requested period.

  • Bid volume

  • Ask volume

  • Bid-ask spread

  • Price Slippage

Read more about how the aggregation period works here: Order Book Aggregations.

We are unable to collect the full 10% snapshot from all exchanges we cover. Thus, for some exchanges, 'Market Depth' does not accurately portray the exchange's order book volume.

Endpoint

https://us.market-api.kaiko.io/v2/data/order_book_snapshots.v1/exchanges/{exchange}/{instrument_class}/{instrument}/ob_aggregations/full

Parameters

ParameterRequiredDescription

exchange

Yes

instrument_class

Yes

instrument

Yes

end_time

No

Ending time in ISO 8601 (exclusive). Automatically included in continuation tokens.

continuation_token

No

interval

No

The interval parameter is suffixed with s, m, h or d to specify seconds, minutes, hours or days, respectively. Any arbitrary value between one second and one day can be used, as long as it sums up to a maximum of 1 day. The suffixes are s (second), m (minute), h (hour) and d (day). Default 1h.

page_size

No

Number of snapshots to return data for. (default: 10, max: 100). See Pagination Automatically included in continuation tokens.

sort

No

Return the data in ascending asc or descending desc order. Default desc Automatically included in continuation tokens.

start_time

No

Starting time in ISO 8601 (inclusive). Automatically included in continuation tokens.

slippage

No

Order size (in quote asset) for which to calculate the percentage of slippage. Default: 0. When null is returned, not enough volume is present on the order book to execute the order.

slippage_ref

No

Price point for which to calculate slippage from. Either from the mid price (mid_price) or from the best bid/ask (best). Default: mid_price.

Fields

FieldDescription

poll_timestamp

The timestamp at which the interval begins.

bid_volume_x

The average volume of bids placed within 0 and x% of the best bid over a specified interval.

ask_volume_x

The average volume of asks placed within 0 and x% of the best ask over a specified interval.

spread

The average difference between the best bid and the best ask over a specified interval.

mid_price

The average mid price between the best bid and the best ask over a specified interval

ask_slippage

The average percentage of price slippage for a market buy order over a specified interval.

bid_slippage

The average percentage of price slippage for a market sell order over a specified interval.

Request examples

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v2/data/order_book_snapshots.v1/exchanges/krkn/spot/btc-usd/ob_aggregations/full?page_size=10&slippage=100000&interval=1h&start_time=2019-12-04T00:00:00Z&end_time=2019-12-06T00:00:00Z'

Response example

{
    "query": {
        "page_size": 10,
        "exchange": "krkn",
        "instrument_class": "spot",
        "instrument": "btc-usd",
        "interval": "1h",
        "slippage": 100000,
        "slippage_ref": "mid_price",
        "sort": "desc",
        "aggregation": "full",
        "data_version": "v1",
        "commodity": "order_book_snapshots",
        "request_time": "2020-05-26T14:46:00.561Z"
    },
    "time": "2020-05-26T14:46:03.776Z",
    "timestamp": 1590504363776,
    "data": [
        {
            "poll_timestamp": 1590501600000,
            "ask_slippage": "0.00032766083806437735",
            "bid_slippage": "0.0002206511273162024",
            "bid_volume0_1": "31.751239130434783",
            "bid_volume0_2": "87.33763043478261",
            "bid_volume0_3": "139.32403260869566",
            "bid_volume0_4": "177.62314130434783",
            "bid_volume0_5": "206.71984782608695",
            "bid_volume0_6": "251.4888043478261",
            "bid_volume0_7": "287.1503043478261",
            "bid_volume0_8": "317.3515869565217",
            "bid_volume0_9": "335.79671739130436",
            "bid_volume1": "352.03117391304346",
            "bid_volume1_5": "419.0988260869565",
            "bid_volume2": "470.6285",
            "bid_volume4": "859.7884347826086",
            "bid_volume6": "1134.0595760869564",
            "bid_volume8": "1134.4657173913045",
            "bid_volume10": "1134.4657173913045",
            "ask_volume0_1": "21.558043478260867",
            "ask_volume0_2": "37.20532608695652",
            "ask_volume0_3": "78.02648913043478",
            "ask_volume0_4": "143.83753260869565",
            "ask_volume0_5": "192.98572826086954",
            "ask_volume0_6": "235.31961956521738",
            "ask_volume0_7": "280.5659565217391",
            "ask_volume0_8": "309.4857717391304",
            "ask_volume0_9": "327.8923152173913",
            "ask_volume1": "341.79707608695657",
            "ask_volume1_5": "411.3568043478261",
            "ask_volume2": "475.6048586956521",
            "ask_volume4": "885.1007826086956",
            "ask_volume6": "1263.1216413043478",
            "ask_volume8": "1364.2838369565218",
            "ask_volume10": "1364.2838369565218",
            "mid_price": "8830.427717391303",
            "spread": "1.175"
        }
      /* ... */
    ],
    "result": "success",
    "access": {
        "access_range": {
            "start_timestamp": null,
            "end_timestamp": null
        },
        "data_range": {
            "start_timestamp": null,
            "end_timestamp": null
        }
    }
}

Last updated