NAV Navbar
curl python

Introduction

Kaiko provides live and historical institutional quality market data for digital assets. Our service retrieves and validates millions of trades each day from the world's leading cryptocurrency exchanges to deliver robust and reliable market data to financial institutions globally.

Kaiko currently provides two HTTP APIs:

In addition, Kaiko also offers a WebSocket Market Data API:

Making Requests

When interacting with Kaiko HTTP APIs, you are expected to pass two headers:

curl --compressed -H 'Accept: application/json' 'https://<api_hostname>/<endpoint>'

Timestamps

Input

import pandas as pd
pd.to_datetime(<timestamp>, unit='ms')

All time parameters are in UTC and returned in the following ISO 8601 datetime format:

YYYY-MM-DDThh:mm:ss.sssZ

For example:

2017-12-17T13:35:24.351Z

The "T" separates the date from the time. The trailing "Z" indicates UTC time.

Output

All timestamps are returned as millisecond Unix timestamps (the number of milliseconds elapsed since 1970-01-01 00:00:00.000 UTC). For metadata fields, times are also returned in millisecond-resolution ISO 8601 datetime strings in the same format as input for convenience.

Data Dictionary

Kaiko's Data Dictionary includes schemas, methodologies, data samples, and additional information about all data types we provide and the delivery channels they are accessible through. You can access the Data Dictionary here.

Market open and close

Digital asset exchanges operate approximately 24x7x365.

For daily aggregated data, the opening price is calculated as the first trade at or after 00:00:00 UTC. The closing price is calculated as the last trade prior to 00:00:00 UTC.

"taker_side_sell" Explained

We created the variable taker_side_sell to account for the variety of ways in which exchanges report trade direction. While the majority of exchanges report trade direction from the perspective of a "taker", some exchanges report from the perspective of a "maker", and others opt to exclude a buy/sell field entirely from their transaction data. We researched every single exchange that we cover to determine from which perspective they report trade direction. The result is a normalized variable called taker_side_sell which takes the value of either true or false.

We have built this variable under the assumption that a taker’s sell order will always be filled by a maker’s buy order and a taker’s buy order will always be filled by a maker’s sell order. Thus, it is possible to create a single binary variable that indicates whether a taker was on the sell side or buy side of a transaction, no matter from which perspective an exchange reports trade direction. taker_side_sell takes the value of true when a taker's sell order fills a maker's buy order and false when a taker's buy order fills a maker's sell order.

If an exchange does not appear below, it can be assumed that all data we provide is normalized correctly. For exchanges where we were unable to confirm as reporting data from either a taker or a maker's perspective, we have included the notation mapping from the exchange's trade direction field to our taker_side_sell field. This is necessary so that researchers who want to further study trade direction can make their own conclusions. For exchanges that classify trade direction differently or exclude the field entirely, we also include the notation mapping and a short explanation for how their variable differs.

Finally, we have made a couple of errors in classifying exchanges as "maker" or "taker", typically early on in the process of developing taker_side_sell. Rather than switch our trade reporting after years of data collection, we have simply marked exchanges where the inverse of the notation stated should be applied. For these exchanges, researchers should be aware that when taker_side_sell: false, the inverse should be assumed.

To read an in-depth explanation of this variable, read our post here.

Unconfirmed, Misclassified or Absent Trade Direction Field

Exchange Exchange Notation Kaiko taker_side_sell: true equivalent to: Comment
BTCBox "type": "buy" or "sell" inverse notation: "type": "sell" Inverse, but confirmed perspective from exchange.
Liquid (Quoine) taker_side: "buy" or "sell" inverse notation: taker_side: "buy" Inverse, but confirmed perspective from exchange.
Bithumb "type": "bid" or "ask" inverse notation: "type": "bid" Inverse, but confirmed perspective from exchange.
Coinone "is_ask": "0"(if seller is taker)/"1"(if seller is maker) inverse notation: "is_ask": "1" Inverse, confirmed from exchange but slightly different notation format
Bitstamp type: 0 (buy) or 1 (sell) type: 1 Unconfirmed perspective from exchange
Bit-Z "s": "buy" or "sell" "s": "sell" Unconfirmed perspective from exchange
EXX type": "buy" or "sell" type: "sell" Unconfirmed perspective from exchange
CEX.io2 type: "buy" or "sell" type: "sell" Unconfirmed perspective from exchange
Yobit "type": "bid" or "ask" "type": "bid" Unconfirmed perspective from exchange
itBit None Always returns true No buy/sell field
Korbit None Always returns null No buy/sell field
Coinflex None Always returns null No buy/sell field

Reference Data API

General

The base URL for the Reference Data Endpoints is: https://reference-data-api.kaiko.io/. Authentication is not required.

Assets

Request Example

curl --compressed -H 'Accept: application/json' 'https://reference-data-api.kaiko.io/v1/assets'

Response Example

{
  "result": "success",
  "data": [
    {
      "code": "btc",
      "name": "Bitcoin",
      "asset_class": "cryptocurrency",
      "asset_classes": [
        "cryptocurrency"
      ]
    },
    {
      "code": "bch",
      "name": "Bitcoin Cash",
      "asset_class": "cryptocurrency",
      "asset_classes": [
        "cryptocurrency"
      ]
    },
    {
      "code": "jpy",
      "name": "Japanese Yen",
      "asset_class": "fiat",
      "asset_classes": [
        "fiat"
      ]
    },
    /* ... */
  ]
}

This endpoint retrieves a list of supported assets.

HTTP request

GET https://reference-data-api.kaiko.io/v1/assets

Parameters

No parameters supported.

Fields

Field Description
asset_class The asset's primary asset class
asset_classes The asset's secondary asset classes
code Kaiko identifier for the asset.
name The asset name

Exchanges

Request Example

curl --compressed -H 'Accept: application/json' 'https://reference-data-api.kaiko.io/v1/exchanges'

Response Example


{
  "result": "success",
  "data": [
    {
      "code": "bfly",
      "name": "bitFlyer",
      "kaiko_legacy_slug": "bl"
    },
    {
      "code": "bfnx",
      "name": "Bitfinex",
      "kaiko_legacy_slug": "bf"
    }
    /* ... */
  ]
}

This endpoint retrieves a list of supported exchanges.

HTTP request

GET https://reference-data-api.kaiko.io/v1/exchanges

Parameters

No parameters supported.

Fields

Field Description
code Kaiko identifier for the exchange.
kaiko_legacy_slug Identifier used in delivery of aggregated data.
name The exchange name.

Instruments

Request Example

curl --compressed -H 'Accept: application/json' 'https://reference-data-api.kaiko.io/v1/instruments'

Response Example

{
  "result": "success",
  "data": [
    {
      "kaiko_legacy_exchange_slug": "bf",
      "trade_start_time": "2017-08-09T23:36:33.0000000Z",
      "trade_end_time": null,
      "code": "xmr-btc",
      "exchange_code": "bfnx",
      "exchange_pair_code": "XMRBTC",
      "base_asset": "xmr",
      "quote_asset": "btc",
      "kaiko_legacy_symbol": "xmrbtc",
      "class": "spot",
      "trade_start_timestamp": 1502321793000,
      "trade_end_timestamp": null,
      "trade_count": 2439870,
      "trade_compressed_size": 35037071
    },
    {
      "kaiko_legacy_exchange_slug": "kk",
      "trade_start_time": "2017-08-08T20:10:04.0000000Z",
      "trade_end_time": null,
      "code": "gno-eth",
      "exchange_code": "krkn",
      "exchange_pair_code": "GNOETH",
      "base_asset": "gno",
      "quote_asset": "eth",
      "kaiko_legacy_symbol": "gnoeth",
      "class": "spot",
      "trade_start_timestamp": 1502223004345,
      "trade_end_timestamp": null,
      "trade_count": 380822,
      "trade_compressed_size": 21119034
    },
    /* ... */
  ]
}

This endpoint retrieves a list of supported instruments. There are three possible cases regarding the trading period:

HTTP request

GET https://reference-data-api.kaiko.io/v1/instruments

Parameters

No parameters supported.

Fields

Field Description
base_asset1 Base asset.
class spot, future, perpetual-future,...
code2 Kaiko identifier for the instrument. Always base_asset-quote_asset for spot instruments.
exchange_code Exchange code.
exchange_pair_code2 Identifier for the instrument used by the exchange.
kaiko_legacy_exchange_slug Exchange kaiko_legacy_slug.
kaiko_legacy_symbol Identifier used in past deliveries of historical market data and Data Feed.
quote_asset1 Quote asset.
trade_start_time Time of first available trade in Kaiko's data set.
trade_start_timestamp Timestamp of first available trade in Kaiko's data set.
trade_end_time Time of last available trade in Kaiko's data set. null if instrument is still active
trade_end_timestamp Timestamp of last available trade in Kaiko's data set. null if instrument is still active
trade_count Total number of trades available through Kaiko Market Data API and Data Feed. For active pairs, this is an approximation.
trade_compressed_size Approximate size in bytes of all available trades in Kaiko Data Feed.

*1: Some exchanges may refer to base and quote currencies differently. Kaiko denotes prices in units of quote and volume in units of base, as reported by exchanges. * *2: Some exchanges reverse the ordering of base/quote in their codes. *

Market Data API

General

Base endpoints

The base URL for the Market Data Endpoints is regionalized. We are currently offering endpoints in the US and in Europe:

Usage

Authentication

Request Syntax

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://<api_hostname>/<endpoint>'

Each API lives under its own hostname. Clients must include an API key in the header of every request they make. The format is as follows:

X-Api-Key: <client-api-key>

Data versioning

Kaiko takes transparency and accountability very seriously. Therefore, our provided datasets are versioned. Dataset versioning is orthogonal to API versioning. Any potential breaking changes in results (e.g. semantical changes or corrections of historically incorrect data) will result in a new dataset version - no corrections or adjustments will be done in the dark. Addition of new data will not result in a new dataset version. Data is versioned on a per-base-data level.

The versioning is selected by selecting a base data set and a version. All current Market Data API endpoints take the commodity and data_version parameters.

By setting this to latest, you will get the most recent version. The returned version is always included in the query field and can be referred to if you would ever need to compare results, should we ever need to adjust historical data. Paginating over a request with version set to latest will preserve the current version across subsequent pagination requests.

We recommend using the most current version explicitly in production integrations as the latest label might move at any time to a breaking change. For the trades and order_book_snapshots commodities the latest version is currently v1

Response Example

{
  "timestamp": 1540474596175,
  "trade_id": "68024786",
  "price": "6559.84000000",
  "amount": "0.00646600",
  "taker_side_sell": true
}

Envelope

Response Example

{
  "result": "success",
  "time": "2018-06-14T17:19:40.303Z",
  "timestamp": 1528996780303,
  "query": { /* ... */ },
  "data": [ /* ... */ ],
  "access": {
    "access_range": {
      "start_timestamp": 1546300800000,
      "end_timestamp": 1577836800000
    },
    "data_range": {
      "start_timestamp": 1356998400000,
      "end_timestamp": 1577836800000
    }
  }
}

All API responses are in JSON format. A result field, with a value of success or error is returned with each request. In the event of an error, a message field will provide an error message.

An access object is also echoed back. It contains two ranges of timestamps:

Key Data type Description
access {} Time ranges of accesses.
data [] | {} Response result data.
message string Error message, if query was not successful.
query {} All handled query parameters echoed back.
result string success if query successful, error otherwise.
time string The current time at our endpoint.
timestamp long The current time at our endpoint.

Pagination

Pagination Example

{
  "result": "success",
  "time": "2018-06-14T17:19:40.303Z",
  "timestamp": 1528996780303,
  "query": {...},
  "data": [...],
  "continuation_token": "ab25lIG1vcmUgYmVlciBpcyBvbmUgbW9yZSBiZWVyIHRvbyBtYW55",
  "next_url": "https://<eu|us>.market-api.kaiko.io/v1/data/trades.v1/exchanges/bfnx/spot/btc-usd/trades?continuation_token=ab25lIG1vcmUgYmVlciBpcyBvbmUgbW9yZSBiZWVyIHRvbyBtYW55",
  "access": {...}
}

For queries that result in a larger dataset than can be returned in a single response, a continuation_token field is included. Calling the same endpoint again with the continuation_token query parameter added will return the next result page. For convenience, a next_url field is also included, containing a URL that can be called directly to get the next page. Paginated endpoints also takes a page_size parameter that specifies the maximum number of items that should be included in each response. Only the first call should include page_size, all subsequent calls should only use continuation_token. Paginating over a request with version set to latest will preserve the current version across subsequent pagination requests.

Parameters

Parameter Required Description
continuation_token No
page_size No Maximum number of records to return in one response

Errors

All API responses are in JSON format. A result field, with a value of success or error is returned with each request. In the event of an error, a message field will provide an error message.

HTTP error codes

The Kaiko platform API uses the following error codes:

Error Code Meaning
400 Bad Request
401 Unauthorized -- You are not authenticated properly. See Authentication.
403 Forbidden -- You don't have access to the requested resource.
404 Not Found
405 Method Not Allowed
406 Not Acceptable
429 Too Many Requests -- Rate limit exceeded. Contact us if you think you have a need for more.
500 Internal Server Error -- We had a problem with our service. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance.

Trade data

Historical Trades

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v2/data/trades.v1/exchanges/bfnx/spot/btc-usd/trades'

Response Example

{
    "query": {
        "page_size": 100,
        "exchange": "bfnx",
        "instrument_class": "spot",
        "instrument": "btc-usd",
        "data_version": "v1",
        "commodity": "trades",
        "request_time": "2020-05-26T21:11:42.582Z"
    },
    "time": "2020-05-26T21:11:45.563Z",
    "timestamp": 1590527505563,
    "data": [
        {
            "timestamp": 1590527492000,
            "trade_id": "451899781",
            "price": "8872.9",
            "amount": "0.001953",
            "taker_side_sell": false
        },
        {
            "timestamp": 1590527492000,
            "trade_id": "451899759",
            "price": "8872.8",
            "amount": "0.00195",
            "taker_side_sell": false
        },
  /* ... */
  ],
  "result": "success",
  "continuation_token": "rbd28vrmb1cwaxfykuJBKAABhNi1Bfv1EY55P3QPSnYnm8VuX1LqLhA2d3yVfYgMKtfBYxJg7sHrkTfkQGysW23Lm9Lp9rsVpVk2Esmgz9VQZvNE4xWN8hh3LgLrCa7ty4B3YGCwtH",
  "next_url": "https://us.market-api.kaiko.io/v1/data/trades.v1/exchanges/bfnx/spot/btc-usd/trades?continuation_token=rbd28vrmb1cwaxfykuJBKAABhNi1Bfv1EY55P3QPSnYnm8VuX1LqLhA2d3yVfYgMKtfBYxJg7sHrkTfkQGysW23Lm9Lp9rsVpVk2Esmgz9VQZvNE4xWN8hh3LgLrCa7ty4B3YGCwtH",
  "access": {
    "access_range": {
      "start_timestamp": null,
      "end_timestamp": null
    },
    "data_range": {
      "start_timestamp": null,
      "end_timestamp": null
    }
  }
}

This endpoint retrieves trades for an instrument on a specific exchange. Trades are sorted by time; ascendingly in v1, descendingly in v2. Note that taker_side_sell can be null in the cases where this information was not available at collection.

HTTP request

v1: GET https://<eu|us>.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/trades{?start_time,end_time,page_size,continuation_token}

v2: GET https://<eu|us>.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/trades{?start_time,end_time,page_size,continuation_token}

Parameters

Parameter Required Description
commodity Yes The data commodity.
continuation_token No See Pagination.
data_version Yes The data version. (v1, v2 ... or latest)
end_time1 No Ending time in ISO 8601 (exclusive).
exchange Yes Exchange code. See Exchanges Reference Data Endpoint.
instrument_class Yes Instrument class. See Instruments Reference Data Endpoint.
instrument Yes Instrument code. See Instruments Reference Data Endpoint.
page_size1 No See Pagination (min: 1, default: 100, max: 100000).
start_time1 No Starting time in ISO 8601 (inclusive).

Fields

Field Description
timestamp The timestamp provided by the exchange.
trade_id Unique trade ID (unique to the exchange). In case the exchange does not provide an ID, we generate it ourselves.
price Price displayed in quote currency.
amount Quantity of asset bought or sold, displayed in base currency.
taker_side_sell See Taker Side Sell

1: When paginating, these parameters should only be included in the first request. For subsequent requests, they are encoded in the continuation token.

Recent Trades

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v2/data/trades.v1/exchanges/krkn/spot/eth-eur/trades/recent'

Response Example

{
    "query": {
        "exchange": "krkn",
        "instrument_class": "spot",
        "instrument": "eth-eur",
        "page_size": 100,
        "data_version": "v1",
        "commodity": "trades",
        "request_time": "2020-05-26T21:13:10.683Z"
    },
    "time": "2020-05-26T21:13:10.946Z",
    "timestamp": 1590527590946,
    "data": [
        {
            "timestamp": 1590527512203,
            "trade_id": "f9e70fc27c214c9559ac53c5ab13b100a5767703704e8f5cc9299c93326864d6",
            "price": "184.40000",
            "amount": "4.72000000",
            "taker_side_sell": false
        },
        {
            "timestamp": 1590527512200,
            "trade_id": "22b69f263d6600fb41c4ce80a8346eca4012c236ff6c589419dd585400e71ccb",
            "price": "184.36000",
            "amount": "5.88000000",
            "taker_side_sell": false
        },
  /* ... */
  ],
  "result": "success",
  "access": {
    "access_range": {
      "start_timestamp": null,
      "end_timestamp": null
    },
    "data_range": {
      "start_timestamp": null,
      "end_timestamp": null
    }
  }
}

This endpoint retrieves the most recent trades for an instrument on a specific exchange. By default returns the 100 most recent trades. This endpoint does not support pagination. Trades are sorted by time, descendingly. Note that taker_side_sell can be null in the cases where this information was not available at collection.

HTTP request

v1 :GET https://<eu|us>.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/trades/recent{?limit}

v2: GET https://<eu|us>.market-api.kaiko.io/v2/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/trades/recent{?page_size}

Parameters

Parameter Required Description
commodity Yes The data commodity.
data_version Yes The data version. (v1, v2 ... or latest)
exchange Yes Exchange code. See Exchanges Reference Data Endpoint.
instrument_class Yes Instrument class. See Instruments Reference Data Endpoint.
instrument Yes Instrument code. See Instruments Reference Data Endpoint.
page_size1 No Maximum number of results (min: 1, default: 100, max: 10000).

1: For consistency, the limit parameter from v1 has been replaced by page_size in v2

Fields

Field Description
timestamp The timestamp provided by the exchange.
trade_id Unique trade ID (unique to the exchange). In case the exchange does not provide an ID, we generate it ourselves.
price Price displayed in quote currency.
amount Quantity of asset bought or sold, displayed in base currency.
taker_side_sell See Taker Side Sell

SPOT price

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v2/data/trades.v1/exchanges/spots/recent?pattern=bnce:*:*'

Response Example

{
    "query": {
        "data_version": "v1",
        "commodity": "trades",
        "pattern": "bnce:*:*",
        "page_size": 100,
        "request_time": "2019-04-16T13:48:13.248Z"
    },
    "time": "2019-04-16T13:48:13.934Z",
    "timestamp": 1555422493934,
    "data": [
        {
            "result": "success",
            "data": {
                "exchange": "bnce",
                "instrument": "ada-bnb",
                "timestamp": 1555422319378,
                "price": "0.00419000"
            }
        },
        {
            "result": "success",
            "data": {
                "exchange": "bnce",
                "instrument": "ada-btc",
                "timestamp": 1555422450041,
                "price": "0.00001608"
            }
        },
        /* ... */
 ],
    "result": "success",
    "continuation_token": "Nc7viLeeeVtRmqkNAbHxgRTMCyNXtyRonafwoEiz8eJi73GRybpzTEum6S6dHdznaNe5Zoi",
    "next_url": "https://us-staging-beta.market-api.kaiko.io/v1/data/trades.v1/exchanges/spots/recent?continuation_token=NztZ8SAshEsEiz8eJi73GRybpzTEum6S6dHdznaNe5Zoi",
    "access": {
        "access_range": {
            "start_timestamp": null,
            "end_timestamp": null
        },
        "data_range": {
            "start_timestamp": null,
            "end_timestamp": null
        }
    }
}       

This endpoint retrieves the most recent price of all requested instruments that have actively traded within 24 hours. Using globbing patterns (see Instruments Selection), instruments can be selected and filtered by exchange, instrument_class, and instrument. By default, the most recent price of all actively trading instruments are returned.

HTTP request

v1: GET https://<eu|us>.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/spots/recent{?pattern,page_size,start_time,end_time,continuation_token}

v2: GET https://<eu|us>.market-api.kaiko.io/v2/data/{commodity}.{data_version}/exchanges/spots/recent{?pattern,page_size,start_time,end_time,continuation_token}

Parameters

Parameter Required Description
commodity Yes The data commodity.
continuation_token No See Pagination
data_version Yes The data version. (v1, v2 ... or latest)
end_time1 No Ending time in ISO 8601 (exclusive).
page_size1 No See Pagination (min: 1, default: 100, max: 100000).
pattern No The glob pattern specifying exchange, class and instrument. See Kaiko's Instruments Globbing.
start_time1 No Starting time in ISO 8601 (inclusive).

1: When paginating, these parameters should only be included in the first request. For subsequent requests, they are encoded in the continuation token.

Fields

Field Description
timestamp The timestamp provided by the exchange.
exchange Exchange code. See Exchanges Reference Data Endpoint.
instrument Instrument code. See Instruments Reference Data Endpoint.
price Price displayed in quote currency.

Order Book data

Order Book Snapshots: Full

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
'https://us.market-api.kaiko.io/v1/data/order_book_snapshots.v1/exchanges/krkn/spot/btc-usd/snapshots/full?slippage=100000&page_size=10&limit_orders=2&slippage_ref=best'

Response Example

{
    "query": {
        "page_size": 10,
        "exchange": "krkn",
        "instrument_class": "spot",
        "instrument": "btc-usd",
        "slippage": 100000,
        "limit_orders": 2,
        "slippage_ref": "best",
        "metric": "full",
        "data_version": "v1",
        "commodity": "order_book_snapshots",
        "request_time": "2020-05-26T14:10:06.320Z"
    },
    "time": "2020-05-26T14:10:06.418Z",
    "timestamp": 1590502206418,
    "data": [
        {
            "poll_timestamp": 1590502155757,
            "poll_date": "2020-05-26T14:09:15.757Z",
            "timestamp": null,
            "bid_volume0_1": "46.595",
            "bid_volume0_2": "110.570",
            "bid_volume0_3": "167.920",
            "bid_volume0_4": "198.416",
            "bid_volume0_5": "243.554",
            "bid_volume0_6": "346.467",
            "bid_volume0_7": "354.090",
            "bid_volume0_8": "359.058",
            "bid_volume0_9": "381.422",
            "bid_volume1": "384.066",
            "bid_volume1_5": "467.014",
            "bid_volume2": "522.441",
            "bid_volume4": "918.911",
            "bid_volume6": "1187.306",
            "bid_volume8": "1187.306",
            "bid_volume10": "1187.306",
            "ask_volume0_1": "13.158",
            "ask_volume0_2": "40.072",
            "ask_volume0_3": "71.129",
            "ask_volume0_4": "179.463",
            "ask_volume0_5": "259.140",
            "ask_volume0_6": "266.315",
            "ask_volume0_7": "324.288",
            "ask_volume0_8": "353.024",
            "ask_volume0_9": "376.738",
            "ask_volume1": "405.965",
            "ask_volume1_5": "467.665",
            "ask_volume2": "506.326",
            "ask_volume4": "862.843",
            "ask_volume6": "1322.553",
            "ask_volume8": "1428.856",
            "ask_volume10": "1428.856",
            "spread": "0.1",
            "mid_price": "8819.95",
            "ask_slippage": "0.0002782477139043083900226757369614512",
            "bid_slippage": "0.0",
            "asks": [
                {
                    "amount": "5.914",
                    "price": "8820"
                },
                {
                    "amount": "0.08",
                    "price": "8821"
                }
            ],
            "bids": [
                {
                    "amount": "11.814",
                    "price": "8819.9"
                },
                {
                    "amount": "4.197",
                    "price": "8819.8"
                }
            ]
        },
      /* ... */
],
    "result": "success",
    "continuation_token": "Ehad6pjoEpvpZSkvbtsyx8WxTj9vgZ2cRZRc4s5VSow1USG8pXP1UGFSxSF7fTacxA54rYoqebnMTdCpE3ZxB3nSTM5CYNModkKRASDWMHymPFHNXnGL73RdkHSVUv6UYa4YwrRinH7JbwRqbB5HwmZdxWaonnaVkeZZc1wZiuK2oR4ePQdotGEnvKY8spPjYwnX8s3D6w1bCqZqL6ENaNH5Pa6b53MdbmyQBjE8F",
    "next_url": "https://us.market-api.kaiko.io/v1/data/order_book_snapshots.v1/exchanges/krkn/spot/btc-usd/snapshots/full?continuation_token=Ehad6pjoEpvpZSkvbtsyx8WxTjvgZ2cRZRc4s5VSow1USG8pXP1UGFSxSF7fTacxA54rYoqebnMTdCpE3ZxB3nSTM5CYNModkKRASDWMHymPFHNXnGL73RdkHSVUv6UYa4YwrRinH7JbwRqbB5HwmZdxWaonnaVkeZZc1wZiuK2oR4ePQdotGEnvKY8spPjYwnX8s3D6w1bCqZqL6ENaNH5Pa6b53MdbmyQBjE8F",
    "access": {
        "access_range": {
            "start_timestamp": null,
            "end_timestamp": null
        },
        "data_range": {
            "start_timestamp": null,
            "end_timestamp": null
        }
    }
}

This endpoint gives access to two weeks of historical 10% order book snapshots. The full endpoint returns all the following order book data: the snapshot itself (bids and asks), the depth of the order book (the cummulative volume of the base asset at 0.1%, 0.2%, 0.3%, 0.4%, 0.5%, 0.6%, 0.7%, 0.8%, 0.9%, 1%, 1.5%, 2%, 4%, 6%, 8% and 10% from the mid price), the spread, the mid price and, when the slippage parameter is not empty, the percentage of slippage for a given order size, either calculated from the best bid/ask or calculated from the mid price. All data is returned in descending order.

HTTP request

GET https://us.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/snapshots/full{?start_time,end_time,page_size,continuation_token,slippage,slippage_ref,orders,limit_orders}

Parameters

Parameter Required Description
commodity Yes The data commodity.
continuation_token No See Pagination.
data_version Yes The data version. (v1, v2 ... or latest)
end_time1 No Ending time in ISO 8601 (exclusive).
exchange Yes Exchange code. See Exchanges Reference Data Endpoint.
instrument_class Yes Instrument class. See Instruments Reference Data Endpoint.
instrument Yes Instrument code. See Instruments Reference Data Endpoint.
limit_orders No Number of orders to return on bid and ask side per snapshot. To retreive the best bid/ask, set this parameter to 1 (default: 10)
page_size1 No Number of snapshots to return. See Pagination (default: 10, max: 100).
start_time1 No Starting time in ISO 8601 (inclusive).
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.

1: When paginating, these parameters should only be included in the first request. For subsequent requests, they are encoded in the continuation token.

Fields

Field Description
poll_timestamp The timestamp at which the raw data snapshot was taken.
poll_date The date at which the raw data snapshot was taken.
timestamp The timestamp provided by the exchange. null when not provided.
bid_volume_x The volume of bids placed within 0 and x% of the midprice.
ask_volume_x The volume of asks placed within 0 and x% of the midprice.
spread The difference between the best bid and the best ask at the time the snapshot was taken.
mid_price The mid price between the best bid and the best ask.
ask_slippage The percentage price slippage for a market buy order placed at the time that the order book snapshot was taken.
bid_slippage The percentage price slippage for a market sell order placed at the time that the order book snapshot was taken.
asks The sell orders in the snapshot. If the limit_oders parameter is used, this will be reflected here. amount is the quantity of asset to sell, displayed in the base currency. price is displayed in the quote currency.
bids The buy orders in the snapshot. If the limit_oders parameter is used, this will be reflected here. amount is the quantity of asset to buy, displayed in the base currency. price is displayed in the quote currency.

Order Book Snapshots: Raw

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v1/data/order_book_snapshots.v1/exchanges/krkn/spot/btc-usd/snapshots/raw?page_size=10&limit_orders=2'

Response example

{
    "query": {
        "page_size": 10,
        "exchange": "krkn",
        "instrument_class": "spot",
        "instrument": "btc-usd",
        "slippage": 0,
        "limit_orders": 2,
        "slippage_ref": "mid_price",
        "metric": "raw",
        "data_version": "v1",
        "commodity": "order_book_snapshots",
        "request_time": "2020-05-26T14:13:08.823Z"
    },
    "time": "2020-05-26T14:13:08.899Z",
    "timestamp": 1590502388899,
    "data": [
        {
            "poll_timestamp": 1590502335760,
            "poll_date": "2020-05-26T14:12:15.760Z",
            "timestamp": null,
            "asks": [
                {
                    "amount": "12",
                    "price": "8830"
                },
                {
                    "amount": "3.67",
                    "price": "8832.9"
                }
            ],
            "bids": [
                {
                    "amount": "13.316",
                    "price": "8829.9"
                },
                {
                    "amount": "0.097",
                    "price": "8829.4"
                }
            ]
        }
      /* ... */         
    ],
    "result": "success",
    "continuation_token": "Z8FjTagUoHd3UCqMvqmRJXlwzbTxSnSXpxxZpHWNCmrsrcnhSpMG2gdcmFKRPd88",
    "next_url": "https://us.market-api.kaiko.io/v1/data/order_book_snapshots.v1/exchanges/cbse/spot/btc-usd/snapshots/raw?continuation_token=Z8FjTagUoHd3UCqMvqmRJXlwzbTxSnSXpxxZpHWNCmrsrcnhSpMG2gdcmFKRPd88",
    "access": {
        "access_range": {
            "start_timestamp": null,
            "end_timestamp": null
        },
        "data_range": {
            "start_timestamp": null,
            "end_timestamp": null
        }
    }
}

This endpoint is identical to the Full endpoint but only returns the raw snapshots of bids and asks without any additional metrics. The Full specific parameters (such as slippage and slippage_ref) are disabled but won't yield any errors when used. All data is returned in descending order.

HTTP request

GET https://us.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/snapshots/raw{?start_time,end_time,page_size,continuation_token,limit_orders}

Parameters

Parameter Required Description
commodity Yes The data commodity.
continuation_token No See Pagination.
data_version Yes The data version. (v1, v2 ... or latest)
end_time1 No Ending time in ISO 8601 (exclusive).
exchange Yes Exchange code. See Exchanges Reference Data Endpoint.
instrument_class Yes Instrument class. See Instruments Reference Data Endpoint.
instrument Yes Instrument code. See Instruments Reference Data Endpoint.
limit_orders No Number of orders to return on bid and ask side per snapshot. To retreive the best bid/ask, set this parameter to 1 (default: 10)
page_size1 No Number of snapshots to return. See Pagination (default: 10, max: 100).
start_time1 No Starting time in ISO 8601 (inclusive).

1: When paginating, these parameters should only be included in the first request. For subsequent requests, they are encoded in the continuation token.

Fields

Field Description
poll_timestamp The timestamp at which the raw data snapshot was taken.
poll_date The date at which the raw data snapshot was taken.
timestamp The timestamp provided by the exchange. null when not provided.
asks The sell orders in the snapshot. If the limit_oders parameter is used, this will be reflected here. amount is the quantity of asset to sell, displayed in the base currency. price is displayed in the quote currency.
bids The buy orders in the snapshot. If the limit_oders parameter is used, this will be reflected here. amount is the quantity of asset to buy, displayed in the base currency. price is displayed in the quote currency.

Order Book Snapshots: Depth

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v1/data/order_book_snapshots.v1/exchanges/krkn/spot/btc-usd/snapshots/depth?page_size=10'

Response Example

{
    "query": {
        "page_size": 10,
        "exchange": "krkn",
        "instrument_class": "spot",
        "instrument": "btc-usd",
        "slippage": 0,
        "limit_orders": 0,
        "slippage_ref": "mid_price",
        "metric": "depth",
        "data_version": "v1",
        "commodity": "order_book_snapshots",
        "request_time": "2020-05-26T14:29:44.757Z"
    },
    "time": "2020-05-26T14:29:44.816Z",
    "timestamp": 1590503384816,
    "data": [
        {
            "poll_timestamp": 1590503344916,
            "poll_date": "2020-05-26T14:29:04.916Z",
            "timestamp": null,
            "bid_volume0_1": "37.606",
            "bid_volume0_2": "102.304",
            "bid_volume0_3": "141.907",
            "bid_volume0_4": "177.446",
            "bid_volume0_5": "203.634",
            "bid_volume0_6": "218.450",
            "bid_volume0_7": "283.128",
            "bid_volume0_8": "293.533",
            "bid_volume0_9": "321.986",
            "bid_volume1": "348.213",
            "bid_volume1_5": "405.080",
            "bid_volume2": "444.782",
            "bid_volume4": "837.949",
            "bid_volume6": "1110.065",
            "bid_volume8": "1110.065",
            "bid_volume10": "1110.065",
            "ask_volume0_1": "7.401",
            "ask_volume0_2": "13.744",
            "ask_volume0_3": "58.917",
            "ask_volume0_4": "131.104",
            "ask_volume0_5": "165.971",
            "ask_volume0_6": "193.786",
            "ask_volume0_7": "257.001",
            "ask_volume0_8": "286.384",
            "ask_volume0_9": "312.040",
            "ask_volume1": "319.040",
            "ask_volume1_5": "382.927",
            "ask_volume2": "475.467",
            "ask_volume4": "909.144",
            "ask_volume6": "1229.664",
            "ask_volume8": "1323.505",
            "ask_volume10": "1323.505"
        },
      /* ... */
],
    "result": "success",
    "continuation_token": "Z8FjYwcAjf7MZEG382e5MpmZx7wkuziQTyy2k5fVgSrcF8jAYqUpRgPH5cbQ9MhJiFaxGRbwiERMp3cWhXJshy",
    "next_url": "https://us.market-api.kaiko.io/v1/data/order_book_snapshots.v1/exchanges/cbse/spot/btc-usd/snapshots/depth?continuation_token=Z8FjYwcAjf7MZEG382e5MpmZx7wkuziQTyy2k5fVgSrcF8jAYqUpRgPH5cbQ9MhJiFaxGRbwiERMp3cWhXJshy",
    "access": {
        "access_range": {
            "start_timestamp": null,
            "end_timestamp": null
        },
        "data_range": {
            "start_timestamp": null,
            "end_timestamp": null
        }
    }
}        

This endpoint is identical to the Full endpoint but only returns metrics on the depth of the order book (the cummulative volume of the base asset at 0.1%, 0.2%, 0.3%, 0.4%, 0.5%, 0.6%, 0.7%, 0.8%, 0.9%, 1%, 1.5%, 2%, 4%, 6%, 8% and 10% from the mid price) per snapshot. The Full specific parameters (such as slippage, slippage_ref and limit_orders) are disabled but won't yield any errors when used. All data is returned in descending order.

HTTP request

GET https://us.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/snapshots/depth{?start_time,end_time,page_size,continuation_token}

Parameters

Parameter Required Description
commodity Yes The data commodity.
continuation_token No See Pagination.
data_version Yes The data version. (v1, v2 ... or latest)
end_time1 No Ending time in ISO 8601 (exclusive).
exchange Yes Exchange code. See Exchanges Reference Data Endpoint.
instrument_class Yes Instrument class. See Instruments Reference Data Endpoint.
instrument Yes Instrument code. See Instruments Reference Data Endpoint.
page_size1 No Number of snapshots to return data for. See Pagination (default: 10, max: 100).
start_time1 No Starting time in ISO 8601 (inclusive).

1: When paginating, these parameters should only be included in the first request. For subsequent requests, they are encoded in the continuation token.

Fields

Field Description
poll_timestamp The timestamp at which the raw data snapshot was taken.
poll_date The date at which the raw data snapshot was taken.
timestamp The timestamp provided by the exchange. null when not provided.
bid_volume_x The volume of bids placed within 0 and x% of the midprice.
ask_volume_x The volume of asks placed within 0 and x% of the midprice.

Order Book Snapshots: Slippage

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  https://us.market-api.kaiko.io/v1/data/order_book_snapshots.v1/exchanges/krkn/spot/btc-usd/snapshots/slippage?end_time=2019-12-09T00:00:00Z&slippage_ref=best&start_time=2019-12-01T00:00:00Z&slippage=1000000&page_size=10'

Response Example

{
    "query": {
        "page_size": 10,
        "exchange": "krkn",
        "instrument_class": "spot",
        "instrument": "btc-usd",
        "slippage": 100000,
        "limit_orders": 0,
        "slippage_ref": "best",
        "metric": "slippage",
        "data_version": "v1",
        "commodity": "order_book_snapshots",
        "request_time": "2020-05-26T14:42:17.053Z"
    },
    "time": "2020-05-26T14:42:17.123Z",
    "timestamp": 1590504137123,
    "data": [
        {
            "poll_timestamp": 1590504124917,
            "poll_date": "2020-05-26T14:42:04.917Z",
            "timestamp": null,
            "ask_slippage": "0.0001057219873253085790064266041007855",
            "bid_slippage": "0.0001581287020485902479395059349031256"
        },
        {
            "poll_timestamp": 1590504075786,
            "poll_date": "2020-05-26T14:41:15.786Z",
            "timestamp": null,
            "ask_slippage": "0.00001534073225141691226479256404443437",
            "bid_slippage": "0.0002555856086571344339622641509433962"
        },
      /* ... */
    ],
    "result": "success",
    "continuation_token": "Z8Fj1yUWjj3uvv1U2d8fASeGLm4jZ4iHCopdsZLKUyDJE8KrBaDXwQQWXHJQxm",
    "next_url": "https://us.market-api.kaiko.io/v1/data/order_book_snapshots.v1/exchanges/cbse/spot/btc-usd/snapshots/slippage?continuation_token=Z8Fj1yUWjj3uvv1U2d8fASeGLm4jZ4iHCopdsZLKUyDJE8KrBaDXwQQWXHJQxm",
    "access": {
        "access_range": {
            "start_timestamp": null,
            "end_timestamp": null
        },
        "data_range": {
            "start_timestamp": null,
            "end_timestamp": null
        }
    }
}

This endpoint is identical to the Full endpoint but only returns slippage for a given order size, either calculated from the best bid/ask or calculated from the mid price. The Full and Raw specific parameter limit_orders is disabled but won't yield any errors when used. All data is returned in descending order.

HTTP request

GET https://us.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/snapshots/slippage{?start_time,end_time,page_size,continuation_token,slippage,slippage_ref}

Parameters

Parameter Required Description
commodity Yes The data commodity.
continuation_token No See Pagination.
data_version Yes The data version. (v1, v2 ... or latest)
end_time1 No Ending time in ISO 8601 (exclusive).
exchange Yes Exchange code. See Exchanges Reference Data Endpoint.
instrument_class Yes Instrument class. See Instruments Reference Data Endpoint.
instrument Yes Instrument code. See Instruments Reference Data Endpoint.
page_size1 No Number of snapshots to return data for. See Pagination (default: 10, max: 100).
start_time1 No Starting time in ISO 8601 (inclusive).
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.

1: When paginating, these parameters should only be included in the first request. For subsequent requests, they are encoded in the continuation token.

Fields

Field Description
poll_timestamp The timestamp at which the raw data snapshot was taken.
poll_date The date at which the raw data snapshot was taken.
timestamp The timestamp provided by the exchange. null when not provided.
ask_slippage The percentage price slippage for a market buy order placed at the time that the order book snapshot was taken.
bid_slippage The percentage price slippage for a market sell order placed at the time that the order book snapshot was taken.

Order Book Aggregations: Full

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v1/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",
        "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
        }
    }
}

This endpoint gives access to two weeks of historical 10% order book aggregated data. It returns metrics on the average depth of the order book (the cummulative volume of the base asset at 0.1%, 0.2%, 0.3%, 0.4%, 0.5%, 0.6%, 0.7%, 0.8%, 0.9%, 1%, 1.5%, 2%, 4%, 6%, 8% and 10% from the mid price), the average spread, the average mid price and, when the slippage parameter is not empty, the average percentage of slippage for a given order size, either calculated from the best bid/ask or calculated from the mid price for a given interval. For each interval, the aggregates are calculated by taking the average metrics of each snapshot within that interval. For example, the aggregated 1 hour spread is calculated by taking all spreads of each snapshot within an hour and calculating the average. All data is returned in descending order.

HTTP request

GET https://us.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/ob_aggregations/full{?start_time,end_time,page_size,continuation_token,slippage,slippage_ref,interval}

Parameters

Parameter Required Description
commodity Yes The data commodity.
continuation_token No See Pagination.
data_version Yes The data version. (v1, v2 ... or latest)
end_time1 No Ending time in ISO 8601 (exclusive).
exchange Yes Exchange code. See Exchanges Reference Data Endpoint.
instrument_class Yes Instrument class. See Instruments Reference Data Endpoint.
instrument Yes Instrument code. See Instruments Reference Data Endpoint.
interval No Interval period. Default 1h.
page_size1 No Number of snapshots to return data for. See Pagination (default: 10, max: 100).
start_time1 No Starting time in ISO 8601 (inclusive).
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.

1: When paginating, these parameters should only be included in the first request. For subsequent requests, they are encoded in the continuation token.

Field Description
poll_timestamp The timestamp at which the interval begins.
bid_volume_x The average volume of bids placed within 0 and x% of the midprice over a specified interval.
ask_volume_x The average volume of asks placed within 0 and x% of the midprice 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.

Order Book Aggregations: Depth

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v1/data/order_book_snapshots.v1/exchanges/krkn/spot/btc-usd/ob_aggregations/depth?page_size=10&interval=1h'

Response Example

{
    "query": {
        "page_size": 10,
        "exchange": "krkn",
        "instrument_class": "spot",
        "instrument": "btc-usd",
        "interval": "1h",
        "slippage": 0,
        "slippage_ref": "mid_price",
        "aggregation": "depth",
        "data_version": "v1",
        "commodity": "order_book_snapshots",
        "request_time": "2020-05-26T14:58:55.582Z"
    },
    "time": "2020-05-26T14:58:56.395Z",
    "timestamp": 1590505136395,
    "data": [
        {
            "poll_timestamp": 1590501600000,
            "bid_volume0_1": "31.31635593220339",
            "bid_volume0_2": "90.78996610169492",
            "bid_volume0_3": "144.16212711864407",
            "bid_volume0_4": "182.9676525423729",
            "bid_volume0_5": "219.1858220338983",
            "bid_volume0_6": "263.02182203389833",
            "bid_volume0_7": "296.666686440678",
            "bid_volume0_8": "322.5334237288136",
            "bid_volume0_9": "340.6282881355932",
            "bid_volume1": "356.4558474576271",
            "bid_volume1_5": "427.1106949152542",
            "bid_volume2": "475.76238135593223",
            "bid_volume4": "863.1048559322035",
            "bid_volume6": "1137.2281271186441",
            "bid_volume8": "1137.5447796610172",
            "bid_volume10": "1137.5447796610172",
            "ask_volume0_1": "22.772533898305085",
            "ask_volume0_2": "36.96916101694915",
            "ask_volume0_3": "78.57454237288135",
            "ask_volume0_4": "144.87783898305085",
            "ask_volume0_5": "195.61884745762714",
            "ask_volume0_6": "237.96824576271186",
            "ask_volume0_7": "282.3425338983051",
            "ask_volume0_8": "314.0606779661017",
            "ask_volume0_9": "330.76757627118644",
            "ask_volume1": "344.3153644067797",
            "ask_volume1_5": "413.4595423728814",
            "ask_volume2": "475.48172033898305",
            "ask_volume4": "886.8459152542373",
            "ask_volume6": "1272.5998644067795",
            "ask_volume8": "1371.7920847457626",
            "ask_volume10": "1371.7920847457626"
        },
      /* ... */
    ],
    "result": "success",
    "access": {
        "access_range": {
            "start_timestamp": null,
            "end_timestamp": null
        },
        "data_range": {
            "start_timestamp": null,
            "end_timestamp": null
        }
    }
}

This endpoint is identical to the Full endpoint but only returns metrics on average the depth of the order book (the cummulative volume of the base asset at 0.1%, 0.2%, 0.3%, 0.4%, 0.5%, 0.6%, 0.7%, 0.8%, 0.9%, 1%, 1.5%, 2%, 4%, 6%, 8% and 10% from the mid price) per snapshot. For each interval, the aggregates are calculated by taking the average metrics of each snapshot within that interval. For example, the aggregated 1 hour spread is calculated by taking all spreads of each snapshot within an hour and calculating the average. The Full specific parameters (such as slippage, slippage_ref) are disabled but won't yield any errors when used. All data is returned in descending order.

HTTP request

GET https://us.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/ob_aggregations/depth{?start_time,end_time,page_size,continuation_token,interval}

Parameters

Parameter Required Description
commodity Yes The data commodity.
continuation_token No See Pagination.
data_version Yes The data version. (v1, v2 ... or latest)
end_time1 No Ending time in ISO 8601 (exclusive).
exchange Yes Exchange code. See Exchanges Reference Data Endpoint.
instrument_class Yes Instrument class. See Instruments Reference Data Endpoint.
instrument Yes Instrument code. See Instruments Reference Data Endpoint.
interval No Interval period. Default 1h.
page_size1 No Number of snapshots to return data for. See Pagination (default: 10, max: 100).
start_time1 No Starting time in ISO 8601 (inclusive).

1: When paginating, these parameters should only be included in the first request. For subsequent requests, they are encoded in the continuation token.

Fields

Field Description
poll_timestamp The timestamp at which the interval begins
bid_volume_x The average volume of bids placed within 0 and x% of the midprice over a specified interval.
ask_volume_x The average volume of asks placed within 0 and x% of the midprice over a specified interval.

Order Book Aggregations: Slippage

Request Example

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

Response Example

{
    "query": {
        "page_size": 10,
        "exchange": "krkn",
        "instrument_class": "spot",
        "instrument": "btc-usd",
        "interval": "1h",
        "slippage": 100000,
        "slippage_ref": "mid_price",
        "aggregation": "slippage",
        "data_version": "v1",
        "commodity": "order_book_snapshots",
        "request_time": "2020-05-26T15:07:06.840Z"
    },
    "time": "2020-05-26T15:07:07.260Z",
    "timestamp": 1590505627260,
    "data": [
        {
            "poll_timestamp": 1590505200000,
            "ask_slippage": "0.00012513598764468878",
            "bid_slippage": "0.0003678539692963374"
        },
        {
            "poll_timestamp": 1590501600000,
            "ask_slippage": "0.00030969034268815156",
            "bid_slippage": "0.00024353107110561094"
        },
      /* ... */
    ],
    "result": "success",
    "access": {
        "access_range": {
            "start_timestamp": null,
            "end_timestamp": null
        },
        "data_range": {
            "start_timestamp": null,
            "end_timestamp": null
        }
    }
}

This endpoint is identical to the Full endpoint but only returns the average slippage for a given order size, either calculated from the best bid/ask or calculated from the mid price. For each interval, the aggregates are calculated by taking the average metrics of each snapshot within that interval. For example, the aggregated 1 hour spread is calculated by taking all spreads of each snapshot within an hour and calculating the average. All data is returned in descending order.

HTTP request

GET https://us.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/ob_aggregations/depth{?start_time,end_time,page_size,continuation_token,interval,slippage,slippage_ref}

Parameters

Parameter Required Description
commodity Yes The data commodity.
continuation_token No See Pagination.
data_version Yes The data version. (v1, v2 ... or latest)
end_time1 No Ending time in ISO 8601 (exclusive).
exchange Yes Exchange code. See Exchanges Reference Data Endpoint.
instrument_class Yes Instrument class. See Instruments Reference Data Endpoint.
instrument Yes Instrument code. See Instruments Reference Data Endpoint.
interval No Interval period. Default 1h.
page_size1 No Number of snapshots to return data for. See Pagination (default: 10, max: 100).
start_time1 No Starting time in ISO 8601 (inclusive).
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.

1: When paginating, these parameters should only be included in the first request. For subsequent requests, they are encoded in the continuation token.

Fields

Field Description
poll_timestamp The timestamp at which the interval begins.
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.

Aggregates

Historical OHLCV (Candles)

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v2/data/trades.v1/exchanges/cbse/spot/btc-usd/aggregations/ohlcv'

Response Example

{
    "query": {
        "page_size": 100,
        "exchange": "cbse",
        "instrument_class": "spot",
        "instrument": "btc-usd",
        "interval": "1d",
        "sort": "desc",
        "aggregation": "ohlcv",
        "data_version": "v1",
        "commodity": "trades",
        "request_time": "2020-05-26T17:25:56.221Z"
    },
    "time": "2020-05-26T17:26:00.160Z",
    "timestamp": 1590513960160,
    "data": [
        {
            "timestamp": 1590451200000,
            "open": "8900.0",
            "high": "9016.99",
            "low": "8694.23",
            "close": "8811.36",
            "volume": "9014.60281966"
        },
        {
            "timestamp": 1590364800000,
            "open": "8715.69",
            "high": "8977.0",
            "low": "8632.93",
            "close": "8899.31",
            "volume": "12091.06145914"
        },
  /* ... */
  ],
  "result": "success",
  "continuation_token": "rbd2bcDp35GmDscQbvZ9YzQHZJkT3jdeFx9fSBDdVmcCZaHvQRTCTfmfQ6QCrvDNp5ciRRuGPTedVL5LMZv1qmSXhRpZFbpvBW2uA62RSYpfJ1hVykJKZfhtmXXrxz",
  "next_url": "https://us.market-api.kaiko.io/v1/data/trades.v1/exchanges/krkn/spot/btc-usd/aggregations/ohlcv?continuation_token=rbd2bcDp35GmDqdfaz3fZJkT3jdeFx9fSBDdVmcCZaHvQRTCTfmfQ6QCrvDNp5ciRRuGPTedVL5LMZv1qmSXhRpZFbpvBW2uA62RSYpfJ1hVykJKZfhtmXXrxz",
  "access": {
    "access_range": {
      "start_timestamp": null,
      "end_timestamp": null
    },
    "data_range": {
      "start_timestamp": null,
      "end_timestamp": null
    }
  }
}

This endpoint retrieves the OHLCV history for an instrument on an exchange. The interval parameter is suffixed with s, m, h or d to specify seconds, minutes, hours or days, respectively. By making use of the sort parameter, data can be returned in ascending asc or descending desc order.

HTTP request

v1: GET https://<eu|us>.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/aggregations/ohlcv{?interval,start_time,end_time,page_size,continuation_token}

v2: GET https://<eu|us>.market-api.kaiko.io/v2/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/aggregations/ohlcv{?interval,start_time,end_time,page_size,continuation_token}

Parameters

Parameter Required Description
commodity Yes The data commodity.
continuation_token No See Pagination.
data_version Yes The data version. (v1, v2 ... or latest)
end_time1 No Ending time in ISO 8601 (exclusive).
exchange Yes Exchange code.
instrument_class Yes Instrument class. See Instruments Reference Data Endpoint.
instrument Yes Instrument code. See Instruments Reference Data Endpoint.
interval No Interval period. Default 1d.
page_size1 No See Pagination (min: 1, default: 100, max: 100000).
start_time1 No Starting time in ISO 8601 (inclusive).
sort1 No Return the data in ascending (asc) or descending (desc) order. Default for API v1 is asc, for v2 desc

1: When paginating, these parameters should only be included in the first request. For subsequent requests, they are encoded in the continuation token.

Fields

Field Description
timestamp Timestamp at which the interval begins.
open Opening price of interval.
high Highest price during interval.
low Lowest price during interval.
close Closing price of interval.
volume Volume traded in interval.

Intervals

Any arbitrary value between one second and one day can be used as an interval, as long as it sums up to 1 day. The suffixes are s (second), m (minute), h (hour) and d (day).

Recent OHLCV

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v1/data/trades.v1/exchanges/cbse/spot/btc-usd/aggregations/ohlcv/recent'

Response Example

{
  "query": {
      "data_version": "v1",
      "commodity": "trades",
      "exchange": "cbse",
      "instrument_class": "spot",
      "instrument": "btc-usd",
      "interval": "1d",
      "limit": 100,
      "aggregation": "ohlcv",
      "request_time": "2019-03-26T16:41:17.184Z"
  },
  "time": "2019-03-26T16:41:17.254Z",
  "timestamp": 1553618477254,
  "data": [
      {
          "timestamp": 1553472000000,
          "open": "3969.52",
          "high": "3976.47",
          "low": "3858.0",
          "close": "3908.0",
          "volume": "6336.1390175"
      },
      {
          "timestamp": 1553385600000,
          "open": "3982.45",
          "high": "3982.45",
          "low": "3946.0",
          "close": "3969.06",
          "volume": "2699.17228833"
      },
  /* ... */
  ],
  "result": "success",
  "access": {
    "access_range": {
      "start_timestamp": null,
      "end_timestamp": null
    },
    "data_range": {
      "start_timestamp": null,
      "end_timestamp": null
    }
  }
}

This endpoint retrieves the most recent OHLCV data points for an instrument on an exchange going 30 days back in time, for up to 10000 values. The interval parameter is suffixed with s, m, h or d to specify seconds, minutes, hours or days, respectively.

HTTP request

v1: GET https://<eu|us>.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/aggregations/ohlcv/recent{?interval,limit}

v2: GET https://<eu|us>.market-api.kaiko.io/v2/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/aggregations/ohlcv/recent{?interval,page_size}

Parameters

Parameter Required Description
commodity Yes The data commodity.
data_version Yes The data version. (v1, v2 ... or latest)
exchange Yes Exchange code.
instrument_class Yes Instrument class. See Instruments Reference Data Endpoint.
instrument Yes Instrument code. See Instruments Reference Data Endpoint.
interval No Interval period. Default 1d.
page_size1 No Maximum number of results (min: 1, default: 100, max: 10000).

1: For consistency, the limit parameter from API v1 has been replaced by page_size in v2.

Fields

Field Description
timestamp Timestamp at which the interval begins.
open Opening price of interval.
high Highest price during interval.
low Lowest price during interval.
close Closing price of interval.
volume Volume traded in interval.

Intervals

Any arbitrary value between one second and one day can be used as an interval, as long as it sums up to 1 day. The suffixes are s (second), m (minute), h (hour) and d (day).

Historical VWAP (Prices)

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v1/data/trades.v1/exchanges/cbse/spot/btc-usd/aggregations/vwap'

Response Example

{
  "query": {
    "commodity": "trades",
    "data_version": "v1",
    "page_size": 100,
    "exchange": "cbse",
    "instrument_class": "spot",
    "instrument": "btc-usd",
    "interval": "1d",
    "aggregation": "vwap",
    "request_time": "2018-10-17T12:39:58.365Z"
  },
  "time": "2018-10-17T12:39:58.542Z",
  "timestamp": 1539779998542,
  "data": [
    {
      "timestamp": 1417392000000,
      "price": "345.24557275909663315035096473307477923471334550072"
    },
    {
      "timestamp": 1417478400000,
      "price": "377.99517104491927319230564288378536793307401289498"
    },
    /* ... */
  ],
  "result": "success",
  "continuation_token": "55qoNvASfrVdCIjrF8Ygw6TVJ4yamzUyeL9QXAmvWZZur3iaKoPcVBW1V4unNJi2zMjojbsYr9Pgt9XFCUpnAiuBiECm8X4cedvYc9t2WxHXnHKjgAp2wRAeV8ZPUSj8WNgpWTCBVymGaQZPj3oMDZwVeCPyuTLFdVPfTXVjZA94BtHeBmghoPv92JtWxN3yRvCkrw79hJBu",
  "next_url": "https://<eu|us>.market-api.kaiko.io/v1/data/trades.v1/exchanges/cbse/spot/btc-usd/aggregations/vwap?continuation_token=55qoNvASfrVdCIjrF8Ygw6TVJ4yamzUyeL9QXAmvWZZur3iaKoPcVBW1V4unNJi2zMjojbsYr9Pgt9XFCUpnAiuBiECm8X4cedvYc9t2WxHXnHKjgAp2wRAeV8ZPUSj8WNgpWTCBVymGaQZPj3oMDZwVeCPyuTLFdVPfTXVjZA94BtHeBmghoPv92JtWxN3yRvCkrw79hJBu",
  "access": {
    "access_range": {
      "start_timestamp": 1546300800000,
      "end_timestamp": 1577836800000
    },
    "data_range": {
      "start_timestamp": 1417391000000,
      "end_timestamp": 1577836800000
    }
  }
}

This endpoint retrieves aggregated VWAP (volume-weighted average price) history for an instrument on an exchange. The interval parameter is suffixed with s, m, h or d to specify seconds, minutes, hours or days, respectively. By making use of the sort parameter, data can be returned in ascending asc (default) or descending desc order.

HTTP request

GET https://<eu|us>.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/aggregations/vwap{?interval,start_time,end_time,page_size,continuation_token}

Parameters

Parameter Required Description
commodity Yes The data commodity. (trades)
continuation_token No See Pagination.
data_version Yes The data version. (v1, v2 ... or latest)
end_time1 No Ending time in ISO 8601 (exclusive).
exchange Yes Exchange code. See Instruments Reference Data Endpoint.
instrument_class Yes Instrument class. See Instruments Reference Data Endpoint.
instrument Yes Instrument code. See Instruments Reference Data Endpoint.
interval No Interval period. Default 1d.
page_size1 No See Pagination (min: 1, default: 100, max: 100000).
start_time1 No Starting time in ISO 8601 (inclusive).
sort1 No Return the data in ascending (asc) or descending (desc) order. Default for API v1 is asc, for v2 desc

1: When paginating, these parameters should only be included in the first request. For subsequent requests, they are encoded in the continuation token.

Fields

Field Description
timestamp Timestamp at which the interval begins.
price Volume-weighted average price.

Intervals

Any arbitrary value between one second and one day can be used as an interval, as long as it sums up to 1 day. The suffixes are s (second), m (minute), h (hour) and d (day).

Recent VWAP

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v2/data/trades.v1/exchanges/cbse/spot/btc-usd/aggregations/vwap/recent'

Response Example

{
    "query": {
        "exchange": "cbse",
        "instrument_class": "spot",
        "instrument": "btc-usd",
        "interval": "1d",
        "page_size": 100,
        "aggregation": "vwap",
        "data_version": "v1",
        "commodity": "trades",
        "request_time": "2020-05-26T18:22:46.411Z"
    },
    "time": "2020-05-26T18:22:46.806Z",
    "timestamp": 1590517366806,
    "data": [
        {
            "timestamp": 1590451200000,
            "price": "8852.285581467739"
        },
        {
            "timestamp": 1590364800000,
            "price": "8806.571311616884"
        }
    /* ... */
  ],
  "result": "success",
  "access": {
    "access_range": {
      "start_timestamp": null,
      "end_timestamp": null
    },
    "data_range": {
      "start_timestamp": null,
      "end_timestamp": null
    }
  }
}

This endpoint retrieves the most recent VWAP data points for an instrument on an exchange going 30 days back in time, for up to 10000 values. The interval parameter is suffixed with s, m, h or d to specify seconds, minutes, hours or days, respectively.

HTTP request

v1: GET https://<eu|us>.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/aggregations/vwap{?interval,limit}

v2: GET https://<eu|us>.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/aggregations/vwap{?interval,page_size}

Parameters

Parameter Required Description
commodity Yes The data commodity.
data_version Yes The data version. (v1, v2 ... or latest)
exchange Yes Exchange code.See Instruments Reference Data Endpoint.
instrument_class Yes Instrument class. See Instruments Reference Data Endpoint.
instrument Yes Instrument code. See Instruments Reference Data Endpoint.
interval No Interval period. Default 1d.
page_size1 No Maximum number of results (min: 1, default: 100, max: 10000).

1: For consistency, the limit parameter from API v1 has been replaced by page_size in v2.

Fields

Field Description
timestamp Timestamp at which the interval begins.
price Volume-weighted average price.

Intervals

Any arbitrary value between one second and one day can be used as an interval, as long as it sums up to 1 day. The suffixes are s (second), m (minute), h (hour) and d (day).

Historical COUNT OHLCV VWAP

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v1/data/trades.v1/exchanges/cbse/spot/btc-usd/aggregations/count_ohlcv_vwap'

Response Example

{
  "query": {
    "commodity": "trades",
    "data_version": "v1",
    "page_size": 100,
    "exchange": "bfnx",
    "instrument_class": "spot",
    "instrument": "xmr-usd",
    "interval": "1d",
    "aggregation": "count_ohlcv_vwap",
    "request_time": "2018-10-17T13:11:00.639Z"
  },
  "time": "2019-01-22T12:24:01.258Z",
    "timestamp": 1548159841258,
    "data": [
    {
      "timestamp": 1417392000000,
      "count": 4,
      "open": "300.0",
      "high": "370.0",
      "low": "300.0",
      "close": "370.0",
      "volume": "0.05655554",
      "price": "345.24557275909663315035096473307477923471334550072"
    },
    {
      "timestamp": 1417478400000,
      "count": 8,
      "open": "377.0",
      "high": "378.0",
      "low": "377.0",
      "close": "378.0",
      "volume": "15.0136",
      "price": "377.99517104491927319230564288378536793307401289498"
    },
    /* ... */
  ],
  "result": "success",
  "continuation_token": "rbd1XbkjMwv2SyUfvJwsqFGmCKzg3WToTvqigui1bejckYnxd9DM1V3v58iqMCdXa4dJSXap6p6fBuvzz32tiHVrv5LC76MyRyYNbZyvSEoVzd1krSWWeXYEtEtR",
  "next_url": "https://<eu|us>.market-api.kaiko.io/v1/data/trades.v1/exchanges/cbse/spot/btc-usd/aggregations/count_ohlcv_vwap?continuation_token=rbd1XbkjMwv2SyUfvJwsui1bejckYnxd9DM1V3v58iqMCdXa4dJSXap6p6fBuvzz32tiHVrv5LC76MyRyYNbZyvSEoVzd1krSWWeXYEtEtR",
  "access": {
    "access_range": {
      "start_timestamp": 1546300800000,
      "end_timestamp": 1577836800000
    },
    "data_range": {
      "start_timestamp": 1417391000000,
      "end_timestamp": 1577836800000
    }
  }
}

This endpoint retrieves the trade count, OHLCV and VWAP history for an instrument on an exchange. The interval parameter is suffixed with s, m, h or d to specify seconds, minutes, hours or days, respectively. By making use of the sort parameter, data can be returned in ascending asc (default) or descending desc order.

HTTP request

GET https://<eu|us>.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/aggregations/count_ohlcv_vwap{?interval,start_time,end_time,page_size,continuation_token}

Parameters

Parameter Required Description
commodity Yes The data commodity.
continuation_token No See Pagination.
data_version Yes The data version. (v1, v2 ... or latest)
end_time1 No Ending time in ISO 8601 (exclusive).
exchange Yes Exchange code.See Instruments Reference Data Endpoint.
instrument_class Yes Instrument class. See Instruments Reference Data Endpoint.
instrument Yes Instrument code. See Instruments Reference Data Endpoint.
interval No Interval period. Default 1d.
page_size1 No See Pagination (min: 1, default: 100, max: 100000).
start_time1 No Starting time in ISO 8601 (inclusive).
sort1 No Return the data in ascending (asc) or descending (desc) order. Default for API v1 is asc, for v2 desc

1: When paginating, these parameters should only be included in the first request. For subsequent requests, they are encoded in the continuation token.

Fields

Field Description
timestamp Timestamp at which the interval begins.
trade_count Then number of trades.
open Opening price of interval.
high Highest price during interval.
low Lowest price during interval.
close Closing price of interval.
volume Volume traded in interval.

Intervals

Any arbitrary value between one second and one day can be used as an interval, as long as it sums up to 1 day. The suffixes are s (second), m (minute), h (hour) and d (day).

Recent COUNT OHLCV VWAP

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v2/data/trades.v1/exchanges/cbse/spot/btc-usd/aggregations/count_ohlcv_vwap/recent'

Response Example

{
  "query": {
      "data_version": "v1",
      "commodity": "trades",
      "exchange": "cbse",
      "instrument_class": "spot",
      "instrument": "btc-usd",
      "interval": "1d",
      "limit": 100,
      "aggregation": "count_ohlcv_vwap",
      "request_time": "2019-03-26T17:29:39.794Z"
  },
  "time": "2019-03-26T17:29:39.859Z",
  "timestamp": 1553621379859,
  "data": [
      {
          "timestamp": 1553472000000,
          "count": 36899,
          "open": "3969.52",
          "high": "3976.47",
          "low": "3858.0",
          "close": "3908.0",
          "volume": "6336.1390175",
          "price": "3928.9568246175739625018415246600135064034680485923"
      },
      {
          "timestamp": 1553385600000,
          "count": 31363,
          "open": "3982.45",
          "high": "3982.45",
          "low": "3946.0",
          "close": "3969.06",
          "volume": "2699.17228833",
          "price": "3965.9951286706028183476597215069186024122061752599"
      },
    /* ... */
  ],
  "result": "success",
    "access": {
        "access_range": {
            "start_timestamp": null,
            "end_timestamp": null
        },
        "data_range": {
            "start_timestamp": null,
            "end_timestamp": null
    }
  }
}

This endpoint retrieves the most recent Count-OHLCV-VWAP data points for an instrument on an exchange going 30 days back in time, for up to 10000 values. The interval parameter is suffixed with s, m, h or d to specify seconds, minutes, hours or days, respectively.

HTTP request

v1: GET https://<eu|us>.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/aggregations/count_ohlcv_vwap{?interval,limit}

v2: GET https://<eu|us>.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/aggregations/count_ohlcv_vwap{?interval,page_size}

Parameters

Parameter Required Description
commodity Yes The data commodity.
data_version Yes The data version. (v1, v2 ... or latest)
exchange Yes Exchange code.See Instruments Reference Data Endpoint.
instrument_class Yes Instrument class. See Instruments Reference Data Endpoint.
instrument Yes Instrument code. See Instruments Reference Data Endpoint.
interval No Interval period. Default 1d.
page_size1 No Maximum number of results (min: 1, default: 100, max: 10000).

1: For consistency, the limit parameter from API v1 has been replaced by page_size in v2.

Fields

Field Description
timestamp Timestamp at which the interval begins.
trade_count Then number of trades.
open Opening price of interval.
high Highest price during interval.
low Lowest price during interval.
close Closing price of interval.
volume Volume traded in interval.

Intervals

Any arbitrary value between one second and one day can be used as an interval, as long as it sums up to 1 day. The suffixes are s (second), m (minute), h (hour) and d (day).

Direct Exchange Rate

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v2/data/trades.v1/spot_direct_exchange_rate/btc/usd?include_exchanges=cbse,bfnx&sources=true'

Response Example

{
    "query": {
        "page_size": 100,
        "interval": "1d",
        "sort": "desc",
        "base_asset": "btc",
        "quote_asset": "usd",
        "sources": true,
        "include_exchanges": [
            "cbse",
            "bfnx"
        ],
        "data_version": "v1",
        "commodity": "trades",
        "request_time": "2020-05-26T20:09:13.000Z",
        "instruments": [
            "bfnx:spot:btc-usd",
            "cbse:spot:btc-usd"
        ]
    },
    "time": "2020-05-26T20:09:14.277Z",
    "timestamp": 1590523754277,
    "data": [
        {
            "timestamp": 1590451200000,
            "price": "8847.968719074968",
            "volume": "13589.95633007",
            "count": 122143,
            "sources": [
                {
                    "exchange_code": "cbse",
                    "count": 66991,
                    "price": "8848.388264128678",
                    "volume": "10187.26739386"
                },
                {
                    "exchange_code": "bfnx",
                    "count": 55152,
                    "price": "8846.712648441991",
                    "volume": "3402.68893621"
                }
            ]
        },
    /* ... */
],
    "result": "success",
    "access": {
        "access_range": {
            "start_timestamp": null,
            "end_timestamp": null
        },
        "data_range": {
            "start_timestamp": null,
            "end_timestamp": null
        }
    }
}    

This endpoint generates an aggregated price for an asset pair across all exchanges with spot markets for the pair. Only asset combinations which are actively being traded on one of our covered exchanges are being taken into account for the calculation of the price. Unsupported asset combinations will return no data. To return data used as input for the calculation of the aggregated price, set the sources parameter to true. Setting the sourcesparameter to false (default) will yield a faster response time. By making use of the sort parameter, data can be returned in ascending asc (default in API v1) or descending desc order (default in API v2).

Regardless of page_size, one page always only returns max. one month of data. For example: A query with start_time=2020-01-27T00:00:00Z, end_time=2020-03-04T00:00:00Z, page_size=100, interval=1d and sort=asc will return 3 pages: first page will return 5 data points (2020-01-27 to 2020-01-31 included), second page will return 29 data points (2020-02-01 to 2020-02-29 included), last page will return 3 data points (2020-03-01 to 2020-03-04 excluded). This implies that pagination needs to be used for queries spanning across multiple months.

HTTP request

v1 :GET https://<eu|us>.market-api.kaiko.io/v1/data/{commodity}.{data_version}/spot_direct_exchange_rate/{base_asset}/{quote_asset}/{?exchanges,start_time,end_time,interval,page_size,sources}

v2: GET https://<eu|us>.market-api.kaiko.io/v2/data/{commodity}.{data_version}/spot_direct_exchange_rate/{base_asset}/{quote_asset}/{?include_exchanges,exclude_exchanges,start_time,end_time,interval,page_size,sources}

Parameters

Parameter Required Description
base_asset Yes The desired base asset code. See Instruments Reference Data Endpoint.
commodity Yes The data commodity.
data_version Yes The data version. (v1, v2 ... or latest)
end_time1 No Ending time in ISO 8601 (exclusive).
exchanges1 No List of exchanges' code. See Instruments Reference Data Endpoint. Only available in API v1.
exclude_exchanges1 No List of exchanges' code to exclude from the calculation. See Instruments Reference Data Endpoint. Only available in API v2.
interval1 No Interval period. Default 1d.
include_exchanges1 No List of exchanges' code to include in the calculation. See Instruments Reference Data Endpoint. Only available in API v2.
page_size1 No See Pagination (min: 1, default: 100, max: 1000).
quote_asset Yes The desired quote asset code. See Instruments Reference Data Endpoint.
start_time1 No Starting time in ISO 8601 (inclusive).
sort1 No Return the data in ascending (asc) or descending (desc) order. Default is asc in API v1, desc in API v2.
sources1 No boolean. If true, returns all prices which were used to calculate aggregated price. Default is false

1: When paginating, these parameters should only be included in the first request. For subsequent requests, they are encoded in the continuation token.*

Exchange Rate

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v2/data/trades.v1/spot_exchange_rate/btc/gbp?sources=true&include_exchanges=cbse,bfnx'

Response Example

{
    "query": {
        "page_size": 100,
        "interval": "1d",
        "sort": "desc",
        "base_asset": "btc",
        "sources": true,
        "include_exchanges": [
            "cbse",
            "bfnx"
        ],
        "quote_asset": "gbp",
        "data_version": "v1",
        "commodity": "trades",
        "request_time": "2020-05-26T20:57:58.242Z",
        "instruments": [
            "cbse:spot:btc-usd",
            "bfnx:spot:btc-usd",
            "cucy:spot:gbp-usd"
        ]
    },
    "time": "2020-05-26T20:57:59.695Z",
    "timestamp": 1590526679695,
    "data": [
        {
            "timestamp": 1590451200000,
            "price": "7208.7461032021966809677654589948362838641883836329621241705333587645106611314",
            "sources": {
                "btc-usd": {
                    "price": "8847.948886897764",
                    "data": [
                        {
                            "exchange_code": "cbse",
                            "count": 69719,
                            "price": "8848.341729428626",
                            "volume": "10465.2047928"
                        },
                        {
                            "exchange_code": "bfnx",
                            "count": 57031,
                            "price": "8846.784570909409",
                            "volume": "3530.98091747"
                        }
                    ]
                },
                "gbp-usd": {
                    "price": null,
                    "simple_price": "1.2273908333333334",
                    "data": [
                        {
                            "exchange_code": "cucy",
                            "count": 108,
                            "price": null,
                            "volume": "0.0",
                            "simple_price": "1.2273908333333334"
                        }
                    ]
                }
            }
        }
    /* ... */
],
    "result": "success",
    "access": {
        "access_range": {
            "start_timestamp": null,
            "end_timestamp": null
        },
        "data_range": {
            "start_timestamp": null,
            "end_timestamp": null
        }
    }
}    

This endpoint returns the price of any asset in USD, EUR, GBP, AUD or NZD. The USD price is calculated based on the path of the highest liquidity, with an additional step using forex rates to get the EUR, GBP AUD and NZD prices. This means that, even though an asset might trade directly against USD, EUR, GBP, AUD or NZD on one or more exchanges, the price might still be established by using cross-rates1. In cases where the most liquid path changed over time, this will be taken into account in the calculation of the price for each interval. To have an overview of what data was used to calculate the price, set the sources parameter to true. Setting the sourcesparameter to false (default) will yield a faster response time. By making use of the sort parameter, data can be returned in ascending asc (default) or descending desc order.

Regardless of page_size, one page always only returns max. one month of data. For example: A query with start_time=2020-01-27T00:00:00Z, end_time=2020-03-04T00:00:00Z, page_size=100, interval=1d and sort=asc will return 3 pages: first page will return 5 data points (2020-01-27 to 2020-01-31 included), second page will return 29 data points (2020-02-01 to 2020-02-29 included), last page will return 3 data points (2020-03-01 to 2020-03-04 excluded). This implies that pagination needs to be used for queries spanning across multiple months.

1: A cross rate is an intermediary currency pair that does not involve the target quote asset.

HTTP request

v1: GET https://<eu|us>.market-api.kaiko.io/v1/data/trades.v1/spot_exchange_rate/{base_asset}/{quote_asset}{?exchanges,start_time,end_time,interval,page_size,sources}

v2: GET https://<eu|us>.market-api.kaiko.io/v2/data/trades.v1/spot_exchange_rate/{base_asset}/{quote_asset}{?include_exchanges,exclude_exchanges,start_time,end_time,interval,page_size,sources}

Parameters

Parameter Required Description
base_asset Yes The desired base asset code. See Instruments Reference Data Endpoint.
commodity Yes The data commodity.
data_version Yes The data version. (v1, v2 ... or latest)
end_time1 No Ending time in ISO 8601 (exclusive).
exchanges1 No List of exchanges' code. See Instruments Reference Data Endpoint. Only available in API v1.
exclude_exchanges1 No List of exchanges' code to exclude from the calculation. See Instruments Reference Data Endpoint. Only available in API v2.
interval1 No Interval period. Default 1d.
include_exchanges1 No List of exchanges' code to include in the calculation. See Instruments Reference Data Endpoint. Only available in API v2.
page_size1 No See Pagination (min: 1, default: 100, max: 1000).
quote_asset Yes The desired quote asset code. See Instruments Reference Data Endpoint.
start_time1 No Starting time in ISO 8601 (inclusive).
sort1 No Return the data in ascending (asc) or descending (desc) order. Default is asc
sources1 No boolean. If true, returns all prices which were used to calculate aggregated price. Default is false

1: When paginating, these parameters should only be included in the first request. For subsequent requests, they are encoded in the continuation token.

Derivatives

Derivatives-specific data unique to futures, options, and perpetual futures contracts. We currently provide real-time derivatives data, updated one average once per minute. List of currently supported exchanges: BitMEX, Deribit, OKEx, Kraken Futures, Binance Futures, FTX and Bybit. More to be added soon.

Futures

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v2/data/instrument_metrics.v1/exchanges/okex/future/ethusd200626/full'

Response Example

{
    "query": {
        "exchange": "okex",
        "instrument_class": "future",
        "instrument": "ethusd200703",
        "data_version": "v1",
        "commodity": "instrument_metrics",
        "request_time": "2020-07-01T15:33:17.738Z"
    },
    "time": "2020-07-01T15:33:17.748Z",
    "timestamp": 1593617597748,
    "data": {
        "24h_volume": "1537502",
        "ask": "229.154",
        "bid": "229.153",
        "index_price": "228.93861032",
        "mark_price": "229.046",
        "open_interest": "890327",
        "expiry": "1593734400000",
        "price": "229.07"
    },
    "result": "success",
    "access": {
        "access_range": {
            "start_timestamp": null,
            "end_timestamp": null
        },
        "data_range": {
            "start_timestamp": null,
            "end_timestamp": null
        }
    }
}

HTTP request

GET https://us.market-api.kaiko.io/v2/data/instrument_metrics.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/full

Parameters

Parameter Required Description
data_version Yes The data version. (v1, v2 ... or latest)
exchange Yes Exchange code.See Instruments Reference Data Endpoint.
instrument_class Yes Instrument class. See Instruments Reference Data Endpoint.
instrument Yes Instrument code. See Instruments Reference Data Endpoint.

Fields

Field Description
24_volume The total 24h traded volume (in base currency).
ask The current best ask price. null when no asks are placed.
bid The current best bid price. null when no asks are placed.
index_price The price of the underlying index.
mark_price The mark price of the contract. The mark price is calculated from the index price, often as a weighted average across multiple exchange's spot price, in order to avoid price manipulation.
open_interest The total oustanding number of contracts.
expiry The contract expiry date.
price The latest recorded spot price.

Perpetual Futures

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v2/data/instrument_metrics.v1/exchanges/bybt/perpetual-future/btc-usd/full'

Response Example

{
    "query": {
        "exchange": "bybt",
        "instrument_class": "perpetual-future",
        "instrument": "btc-usd",
        "data_version": "v1",
        "commodity": "instrument_metrics",
        "request_time": "2020-07-01T15:57:36.070Z"
    },
    "time": "2020-07-01T15:57:36.753Z",
    "timestamp": 1593619056753,
    "data": {
        "24h_volume": "447675449",
        "ask": "9217.5",
        "bid": "9217",
        "funding_rate": "0.0001",
        "mark_price": "9224.82",
        "open_interest": "231742782",
        "predicted_funding_rate": "0.0001",
        "price": "9217.50",
        "index_price": "9224.69"
    },
    "result": "success",
    "access": {
        "access_range": {
            "start_timestamp": null,
            "end_timestamp": null
        },
        "data_range": {
            "start_timestamp": null,
            "end_timestamp": null
        }
    }
}

HTTP request

GET https://us.market-api.kaiko.io/v2/data/instrument_metrics.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/full

Parameters

Parameter Required Description
data_version Yes The data version. (v1, v2 ... or latest)
exchange Yes Exchange code.See Instruments Reference Data Endpoint.
instrument_class Yes Instrument class. See Instruments Reference Data Endpoint.
instrument Yes Instrument code. See Instruments Reference Data Endpoint.

Fields

Field Description
24_volume The total 24h traded volume (in base currency).
ask The current best ask price. null when no asks are placed.
bid The current best bid price. null when no asks are placed.
funding_rate The current funding rate.
mark_price The mark price of the contract. The mark price is calculated from the index price, often as a weighted average across multiple exchange's spot price, in order to avoid price manipulation.
open_interest The total oustanding number of contracts.
predicted_funding_rate The predicted funding rate for the next period.
price The latest recorded spot price.
index_price The price of the underlying index.

Options

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://us.market-api.kaiko.io/v2/data/instrument_metrics.v1/exchanges/okex/future/ethusd200626/full'

Response Example

{
    "query": {
        "exchange": "drbt",
        "instrument_class": "option",
        "instrument": "btc28aug209500c",
        "data_version": "v1",
        "commodity": "instrument_metrics",
        "request_time": "2020-07-01T16:15:52.737Z"
    },
    "time": "2020-07-01T16:15:52.744Z",
    "timestamp": 1593620152744,
    "data": {
        "ask_iv": "56.66",
        "bid_iv": "54.45",
        "ask_amount": "41.2",
        "expiry": "1598572800000",
        "index_price": "9252.56",
        "delta": "0.50582",
        "underlying_index": "SYN.BTC-28AUG20",
        "bid": "0.077",
        "gamma": "0.0002",
        "bid_amount": "33",
        "mark_iv": "55.05",
        "strike_price": "9500",
        "rho": "6.29082",
        "open_interest": "122.2",
        "ask": "0.0805",
        "kind": "C",
        "24h_volume": "0.1",
        "price": "0.0785",
        "theta": "-7.04133",
        "vega": "14.75422",
        "mark_price": "0.07795004"
    },
    "result": "success",
    "access": {
        "access_range": {
            "start_timestamp": null,
            "end_timestamp": null
        },
        "data_range": {
            "start_timestamp": null,
            "end_timestamp": null
        }
    }
}

HTTP request

GET https://us.market-api.kaiko.io/v2/data/instrument_metrics.{data_version}/exchanges/{exchange}/{instrument_class}/{instrument}/full

Parameters

Parameter Required Description
data_version Yes The data version. (v1, v2 ... or latest)
exchange Yes Exchange code.See Instruments Reference Data Endpoint.
instrument_class Yes Instrument class. See Instruments Reference Data Endpoint.
instrument Yes Instrument code. See Instruments Reference Data Endpoint.

Fields

Field Description
ask_iv Implied volatility for the best ask.
bid_iv Implied volatility for the best bid.
ask_amount Size of the best ask.
expiry The contract expiry date.
index_price The price of the underlying index.
delta The delta value for the option.
underlying_index The name of the underlying index.
bid The current best bid price. null when no bids are placed.
gamma The gamma value for the option.
bid_amount Size of the best bid.
mark_iv The implied volatility for the mark price.
strike_price The strike price of the contract in USD.
 rho The rho value for the option.
 open_interest  The total oustanding number of contracts.
ask The current best ask price. null when no asks are placed.
kind  The kind of contract: "C" for call, "P" for put.
24h_volume  The total 24h traded volume (in base currency).
price  The latest recorded contract price.
theta The theta value for the option.
vega The vega value for the option.
mark_price The mark price of the contract. The mark price is calculated from the index price, often as a weighted average across multiple exchange's spot price, in order to avoid price manipulation.

WebSocket Market Data API

Kaiko's WebSocket Market Data API provides a continuous stream of real-time, low latency market updates.

General

Protocol

The WebSocket protocol can be separated into two main parts:

Current API version

Kaiko WebSocket Market Data API's version is v2.

Message Format

All messages sent or received through the WebSocket API are encoded in JSON format.

Data Versioning

Data versioning for WebSocket is also available through the data_version parameter in the endpoint.

By setting the data_version to latest, you will get the most recent version. The resulting version is always included in results.

We recommend using the latest version explicitly in production integrations as the latest label might move at any time to a new version with breaking changes.

Commodities

WebSocket Market Data API endpoints also take the commodity parameter.

Two commodities are available :

For both commodities, the latest data version is v1.

Trades Commodity

The trades commodity corresponds to the data from the polling collection feeding our Market Data API. Due to the nature of polling ingestion, trades will generally be published in batches in intervals. All exchanges are available for this commodity.

Trades_ws Commodity

The trades_ws commodity corresponds to the data from our Websocket collection. Trades latency distribution is significantly lower compared to the trades commodity.

For the moment, trades_ws is available for the following exchanges:

Subscriptions

To subscribe to topics' instruments, the client has two options:

Both options require a glob pattern to specify the desired instruments.

Endpoints

Base URL

Like for the Market Data API, the base URL for the WebSocket Market Data API endpoints is regionalized between the US and Europe:

RPC Endpoint

The RPC Endpoint allows bidirectional communication between the Client and the Server:

HTTP Request

GET wss://<us|eu>.market-ws.kaiko.io/v2/rpc

Subscription Endpoint

The Subscription Endpoint allows the Client to subscribe directly through the URL. On this endpoint, the communication is unidirectional:

HTTP Request

GET wss://<us|eu>.market-ws.kaiko.io/v2/data/{commodity}.{data_version}/{pattern}

Parameter Required Description
commodity Yes The data commodity. See Commodities
data_version Yes The data version. (v1, v2 ... or latest). See Data Versioning
pattern No The subscription glob pattern. See Kaiko's Instruments Globbing.

Connection

Upgrading the Connection

Upgrade Header

Connection: Upgrade  
Upgrade: websocket

Sec-WebSocket-Key Header

Sec-WebSocket-Key: <key>

Sec-WebSocket-Key Header

Sec-WebSocket-Protocol: api_key, <client-api-key>

JavaScript Client Connection Example

const ws = new WebSocket('wss://<ws_api_hostname>/<endpoint>', ['api_key', '<client-api-key>']);

To connect, the Client must send an HTTP request to the server. This request must include:

To validate the upgrade and complete the handshake, the Server checks that both the Upgrade header and the Sec-WebSocket-Key are present.

Also, the Server verifies that the Client has the right to connect. To do so, the Client must pass an api_key in the Sec-WebSocket-Protocol header to authenticate itself.

If the connection is validated by the Server, it will return an HTTP 101 WebSocket Protocol Handshake status code to the Client. The HTTP connection is then upgraded to a WebSocket connection.

Starting from this point, RPC messages can be exchanged between the client and the server.

For more information about the opening handshake of the WebSocket protocol, please read the RFC 6455 Websocket standard.

HTTP Errors

The Kaiko WebSocket Market Data API uses the following error codes for the connection part:

Code Name Message Meaning
400 INVALID_ENDPOINT Invalid endpoint You provided an invalid endpoint
400 INVALID_GLOB_FORMAT Invalid glob format You provided and invalid endpoint
400 INVALID_COMMODITY_VERSION Invalid commodity version You provided invalid commodity version
401 NO_API_KEY No api key You didn't provide an API key
403 NOT_AUTHORIZED  Not authorized You provided an invalid API key
403 UNAUTHORIZED_SUBSCRIPTIONS Unauthorized subscriptions You provided unauthorized subscriptions
404 SUBSCRIPTIONS_NOT_FOUND Subscriptions not found You provided a glob pattern that returned no instrument
404 DEPRECATED_API_VERSION Deprecated api version You provided a deprecated api's version
426 NOT_WEBSOCKET Not WebSocket You provided an invalid WebSocket request
500 INTERNAL_ERROR Internal error We had a problem with our service. Try again later

RPC Messages

Once the connection has been upgraded to the WebSocket protocol, messages can be sent between the Client and the Server:

All messages should be in JSON format.

Note that the Client should expect a reconnect message at some point. When this happens, the Client will have some time to reconnect before the connection is actually closed.

Client to Server

Command Format

{
  "command": <command>,
  "args": {
    ...
  }
}

Clients can send commands to the Server. All commands should follow the same format.

A command can have one or more arguments. Arguments can have one or more parameters.

Subscribe Command

Subscribe Command Example

{
  "command": "subscribe",
  "args": {
    "subscriptions": {
      "topic": <topic>,
      "pattern": <pattern>,
      "data_version": <data_version>
    }
  }
}

The Client must send a subscription message once the connection is established.

The subscribe command has a subscriptions argument. This argument can have multiple parameters:

Parameter Required Description
data_version No The data version. (v1, v2 ... or latest). Defaulting to latest. See Data Versioning
pattern Yes The subscription glob pattern. See Kaiko's Instruments Globbing.
topic Yes The topic's type to subscribe to. This corresponds to the data commodity. See Commodities

Note that if the Client send multiple subscribe commands through the same WebSocket connection, previous commands will be overwritten and only the last command will be taken into account.

Server to Client

Message Format

{
  "event": <info/error/update>,
  "payload": {
    ...
  }
}

The Messages' types sent from the Server to the Client can be:

Subscribed Message

Subscribed Message Example

{
  "event": "info",
  "payload": {
    "message": "subscribed",
    "subscriptions_size": <subscriptions_size>,
    "total_size": <total_size>,
    "total_authorized_size": <total_authorized_size>,
    "requested_size": <requested_size>,
    "not_authorized_requested_size": <not_authorized_requested_size>
  }
}

The Client will receive a subscribed message when the subscription is successful. It will contain:

This is an info message type.

Heartbeat Message

Heartbeat Message Example

{
  "event": "info",
  "payload": {
    "message": "heartbeat",
    "ts": 1524241200000 // Current Server time
  }
}

The client will receive heartbeat messages once the connection is established. These messages will be sent each 1 second to notify the Client that the Server is alive and healthy.

This is an info message type.

Reconnect Message

Reconnect Message Example

{
  "event": "info",
  "payload": {
    "message": "reconnect"
  }
}

The Client should expect a reconnect message at some point. When this happens, the Client will have some time to reconnect before the connection is actually closed.

This is an info message type.

Closed Message

Closed Message Example

{
  "event": "info",
  "payload": {
    "message": "closed"
  }
}

The client will receive a closed message when the connection is closed from the Server. Note that there is no strict guarantee that a closed message will always be received before connections are closed.

This is an info message type.

Update Message

Update Message Example

{
  "event": "update",
  "payload": {
    "subscription": {
      "topic": "trades",
      "data_version": "v1",
      "exchange": "krkn",
      "instrument_class": "spot",
      "instrument": "eth-eur"
    },
    "data": [
      {
        "timestamp": 1539781665641,
        "trade_id": "1a1e635ee192480354126a8f58c64cf63f2ac3a18f12f5988aee87175f627721",
        "price": "176.37000",
        "amount": "0.23696093",
        "taker_side_sell": true
      }
    ]
  }
}

Once the subscription is acknowledged, updates will be broadcasted with update messages.

Error Messages

Error Messages Format

{
  "event": "error",
  "payload": {
    "name": <STRING_ERROR_CODE>
    "message": <message>
  }
}

error messages can be sent from the Server to the Client.
All messages have the same base format.

No RPC Message

No RPC Message Example

{
    "event": "error",
    "payload": {
        "name": "NO_RPC_MESSAGE",
        "message": No rpc message allowed when subscribing through the URL
    }
}

A no rpc message error should be sent if the Client send a message to the Server whereas he subscribed through the URL.

Invalid Command

Invalid Command Error Message Example

{
  "event": "error",
  "payload": {
    "name": "INVALID_COMMAND",
    "message": <reason>
  }
}

A invalid command error should be sent if the Client either provides: - A command message that has not the expected format - An unknown/not allowed command

The reason of the error should be passed to the message.

Command Message Timeout

Command Timeout Error Message Example

{
  "event": "error",
  "payload": {
    "name": "COMMAND_TIMEOUT",
    "message": "No valid command received. Timeout reached."
  }
}

A command timeout error should be sent if the Client doesn't provide a valid command message after 10 seconds. The connection is closed after this timeout.

Max Pending Messages Reached

Max Pending Messages Reached Error Message Example

{
  "event": "error",
  "payload": {
    "name": "MAX_PENDING_MESSAGES",
    "message": "Maximum number of pending messages exceeded <max_pending_mess>"
  }
}

We reserve the right to allow 1000 pending messages per client. Maximum number of pending messages exceeded error could be sent if the number of current pending messages exceeds this payload. Then, we close the connection.

Instrument Selection

Kaiko's instruments can be selected and filtered using globbing patterns, constructed from a set of parameters with optional wildcards. A single string can be used to select an arbitrary set of instruments. This process can be used to subscribe to feeds through Kaiko's WebSocket Market Data API. See Subscriptions.

Glob Patterns Examples

Assumption: Available Instruments for the subsequent examples:

[
  {
    "exchange": "krkn", "instrument_class": "spot", "instrument": "btc-usd"
  },
  {
    "exchange": "krkn", "instrument_class": "spot", "instrument": "eth-usd"
  },
  {
    "exchange": "cbse", "instrument_class": "spot", "instrument": "eth-btc"
  },
  {
    "exchange": "okex", "instrument_class": "future", "instrument": "btc_usd__this_week"
  }
]

btc-usd spot market for krkn exchange: krkn:spot:btc-usd

[
  {
    "exchange": "krkn", "instrument_class": "spot", "instrument": "btc-usd"
  }
]

The general format for passing a glob pattern is as follows:

pattern = <exchange>:<instrument_class>:<instrument>

Parameter Description
exchange List1 of Exchange code. See Exchanges Reference Data Endpoint.
instrument_class List1 of Instrument class. See Instruments Reference Data Endpoint.
instrument List1 of Instrument code. See Instruments Reference Data Endpoint.

1: Lists are comma separated

Wildcard

All spot markets for krkn exchange: krkn:spot:*

[
  {
    "exchange": "krkn", "instrument_class": "spot", "instrument": "btc-usd"
  },
  {
    "exchange": "krkn", "instrument_class": "spot", "instrument": "eth-usd"
  }
]

All instruments for krkn that have btc as part of the instrument code: krkn:*:*btc*

[
  {
    "exchange": "krkn", "instrument_class": "spot", "instrument": "btc-usd"
  }
]

Kaiko Instrument Globbing allows the use of the wildcard *.

It can replace any parameter of the pattern:

It can also be used inside a parameter:

Cartesian Product of Patterns

All krkn and okex instruments that have usd as part of the instrument code: krkn,okex:*:*usd*

[
  {
    "exchange": "krkn", "instrument_class": "spot", "instrument": "btc-usd"
  },
  {
    "exchange": "krkn", "instrument_class": "spot", "instrument": "eth-usd"
  },
  {
    "exchange": "okex", "instrument_class": "future", "instrument": "btc_usd__this_week"
  }
]

If the params lists contain more than one element, the resulting pattern will be constructed as a cartesian product of each element of the lists, i.e:

pattern = exchange1,exchange2:instrument_class:instrument1,instrument2

will be equivalent to the union of 4 patterns:

Union of Patterns

All krkn and cbse instruments that have btc as part of the instrument code plus the krkn:spot:eth-usd instrument: krkn,cbse:*:*btc*+krkn:spot:eth-usd

[
  {
    "exchange": "krkn", "instrument_class": "spot", "instrument": "btc-usd"
  },
  {
    "exchange": "krkn", "instrument_class": "spot", "instrument": "eth-usd"
  },
  {
    "exchange": "cbse", "instrument_class": "spot", "instrument ": "eth-btc"
  }
]

Multiple patterns can also be combined with the + operator:

pattern = pattern1+pattern2

where:

Data Feed

Receive historical and on-going data directly to your cloud provider. If you purchased a monthly subscription of Trade Data, 10% Order Books, OHLCV or VWAP, your data will be delivered once a day to your cloud bucket. We currently support Amazon Web Services S3 and Google storage. Cloud storage services allow us to easily synchronize our data with you once a day.

Cloud providers offer extensive storage services that will help you store large amounts of data. This eases the integration setup to feed whatever system you choose to integrate the data with.

If you do not already have a cloud provider, we suggest working with Amazon Web Services which is a major provider with a strong track record.

AWS S3 - How to receive our data through

  1. Open https://s3.console.aws.amazon.com/s3/buckets/
  2. Create a new bucket in the region of your choice. We suggest calling the bucket kaiko-delivery-nameofyourcompany
  3. We suggest you use the us-east-1 (N. Virginia) region unless you are already using a different region as your main presence
  4. Leave the properties on the default setting, finish the review and click on 'Create bucket'
  5. After creating the bucket, click on it and navigate to the 'Permissions' tab. Click on 'Access Control List' to set the right permissions.
  6. Under Access for other AWS accounts, press Add account and use the following id: 4d6be087cf0b9ee7af2f8d8c51469c81bc711e68ee9c6be386aee2322abc8175
  7. Check all the checkboxes for permissions and press Save
  8. Ensure that the permissions dialog resembles the following: AWS Dialog
  9. Enter the details into this form
  10. You should receive a confirmation email within a few working days confirming that the integration was set up correctly

GCS - How to receive our data through

  1. Open https://console.cloud.google.com/storage/
  2. We suggest calling the bucket kaiko-delivery-nameofyourcompany
  3. Once created, click on the "3 dots" on the right side of the corresponding bucket
  4. Click on Edit bucket permissions: GCS_Bucket_Permissions_Tab
  5. Press Add members and add our service account kaiko-facteur@kaiko-facteur.iam.gserviceaccount.com
  6. Press on Select a role, select Storage, then select Storage Admin as follows:
    GCS_Bucket_Add_Perm
  7. Press on Add to validate the changes
  8. Enter the details into this form
  9. You should receive a confirmation email within a few working days confirming that the integration was set up correctly

For other cloud providers

Please contact us at hello@kaiko.com.

Future development

We are continously extending the feature set across all our products. We are very happy to receive your feedback on our services and documentation. Do you have a proposal on how we can make your day better? Give us a shout!