NAV Navbar
curl

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

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.

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.

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:

Reference Data API

Endpoints

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"
    },
    {
      "code": "bch",
      "name": "Bitcoin Cash",
      "asset_class": "cryptocurrency"
    },
    {
      "code": "jpy",
      "name": "Japanese Yen",
      "asset_class": "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 fiat,cryptocurrency
code Identifier for 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 Identifier for the exchange.
kaiko_legacy_slug Identifier used in past deliveries of historical market data.
name

Instruments

Request Example

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

Response Example

{
  "result": "success",
  "data": [
    {
      "exchange_code": "bfnx",
      "class": "spot",
      "code": "xmr-btc",
      "base_asset": "xmr",
      "quote_asset": "btc",
      "kaiko_legacy_exchange_slug": "bf",
      "kaiko_legacy_symbol": "xmrbtc",
      "exchange_pair_code": "xmrbtc",
      "trade_start_time": "2017-08-09T23:36:33.0000000Z",
      "trade_start_timestamp": 1502321793000,
      "trade_end_time": null,
      "trade_end_timestamp": null,
      "trade_count": 1669022,
      "trade_compressed_size": 22107372
    },
    {
      "exchange_code": "krkn",
      "class": "spot",
      "code": "gno-eth",
      "base_asset": "gno",
      "quote_asset": "eth",
      "kaiko_legacy_exchange_slug": "kk",
      "kaiko_legacy_symbol": "gnoeth",
      "exchange_pair_code": "GNOETH",
      "trade_start_time": "2017-08-08T20:10:04.0000000Z",
      "trade_start_timestamp": 1502223004345,
      "trade_end_time": null,
      "trade_end_timestamp": null,
      "trade_count": 230316,
      "trade_compressed_size": 11588434
    },
    {
      "exchange_code": "krkn",
      "class": "spot",
      "code": "dao-btc",
      "base_asset": "dao",
      "quote_asset": "btc",
      "kaiko_legacy_exchange_slug": "kk",
      "kaiko_legacy_symbol": "daobtc",
      "exchange_pair_code": "xdaoxxbt",
      "trade_start_time": "2016-05-28T10:20:40.0000000Z",
      "trade_start_timestamp": 1464430840433,
      "trade_end_time": "2016-12-18T02:47:47.0000000Z",
      "trade_end_timestamp": 1482029267877,
      "trade_count": 67925,
      "trade_compressed_size": 4194980
    },
    /* ... */
  ]
}

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
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 trades
trade_end_timestamp Timestamp of first available trade in Kaiko's data set.
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. *

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 support Amazon Web Services S3, Google storage, Azure blob storage, and other providers. 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.

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
}

Buy/Sell, Maker/Taker sides

For trades, the way exchanges report on the type of trade varies greatly. Some exchanges only report whether a trade was a buy or sell, without specifying which side the trade is actually referring to. Others do specify the side the trade is referring to. With the following mapping, we try to rule out any ambiguous interpretation of the taker_side_sell field in our trade endpoints. This mapping is in reference to what the exchanges are reporting via their APIs and documentation, and, in some cases correspondence between Kaiko and the exchanges.

Maker side The following exchanges report trades from the perspective of maker orders. In all below cases, it was the maker who was selling.

Exchange Notation Kaiko taker_side_sell: true equivalent to: Comment
Binance1 "m": true, false "m": true
Coinbase Pro1 2 "side": "buy" or "sell" "side": "sell"
Gemini2 "type": "buy" or "sell" "type": "sell"
ZB.com2 "type": "buy" or "sell" "type": "sell"

1 Explicitly stated in docs

2 Confirmed by exchange

Taker side The following exchanges report trades from the perspective of taker orders. In all below cases, it was the taker who was selling.

Exchange Notation Kaiko taker_side_sell: true equivalent to: Comment
Bitfinex2 "type": "sell" or "buy" "type":"sell"
Ethfinex2 "type": "sell" or "buy" "type":"sell"
Huobi2 "direction": "buy" or "sell" "direction": "sell"
Kraken2 "b" (buy) "s" (sell) "s"
BitMEX2 "side": "Sell" or "Buy" "side": "Sell"
Gatecoin2 way: "bid" or "ask" way: "ask"
Quoine1 taker_side: "buy" or "sell" inverse notation: taker_side: "buy" Incorrect notation by Kaiko. Taker was buying.

1 Explicitly stated in docs

2 Confirmed by exchange

Taker / Maker side unspecified The following exchanges do not report on the side of the trades.

Exchange Notation Kaiko taker_side_sell: true equivalent to: Comment
bitFlyer "side": "BUY" or "SELL" "side": "SELL"
Bithumb "type": "bid" or "ask" inverse notation: "type": "bid" Incorrect notation by Kaiko. Was buy order.
Bitstamp2 type: 0 (buy) or 1 (sell) type: 1
Bittrex "OrderType": "SELL" or "BUY" OrderType: SELL
Bit-Z "s": "buy" or "sell" "s": "sell"
BTCBOX2 "type": "buy" or "sell" "type":"sell"
BTC38 "type": "buy" or "sell" "type":"sell" API not live anymore
CEX.io2 type: "buy" or "sell" type: "sell"
EXX trade_type": "bid" or "ask" trade_type: "sell"
HitBTC2 "side": "buy" or "sell" "side": "sell"
OKEx "type": "buy" or "sell" type: "sell"
OKCoin "type": "buy" or "sell" type: "sell"
Poloniex type: "buy" or "sell" type: "sell"
WEX.nz (BTC-e) type: "bid" or "ask" type: "ask"
Yobit "type": "bid" or "ask" inverse notation: "type":"bid Incorrect notation by Kaiko. Was buy order.
Zaif trade_type": "bid" or "ask" trade_type: "ask"

1 Explicitly stated in docs

2 Confirmed by exchange

Taker / Maker not applicable | Exchange | Notation | Kaiko taker_side_sell: true equivalent to: | Comment | --- | --- | --- | --- | itBit | Unspecified | N/A | No data on type, nor side of orders. Kaiko alwayes returns true | Coinone | "is_ask": "0"(buy)/"1"(sell) | N/A | No data on side tracked by Kaiko yet. | Korbit | Unspecified | N/A | No data on type, nor side of orders. Kaiko returns empty field.

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://<eu|us>.market-api.kaiko.io/v1/data/trades.v1/exchanges/bfnx/spot/btc-usd/trades'

Response Example

{
  "query": {
    "data_version": "v1",
    "commodity": "trades",
    "page_size": 100,
    "exchange": "bfnx",
    "instrument_class": "spot",
    "instrument": "btc-usd",
    "request_time": "2019-01-22T15:47:47.655Z"
  },
  "time": "2019-01-22T15:47:47.721Z",
  "timestamp": 1548172067721,
  "data": [
    {
      "timestamp": 1364774869000,
      "trade_id": "63018",
      "price": "93.3",
      "amount": "80.62851795",
      "taker_side_sell": null
    },
    {
      "timestamp": 1364774893000,
      "trade_id": "63020",
      "price": "100.0",
      "amount": "20.0",
      "taker_side_sell": null
    },
  /* ... */
  ],
  "result": "success",
  "continuation_token": "rbd28vrmb1cwaxfykuJBKAABhNi1Bfv1EY55P3QPSnYnm8VuX1LqLhA2d3yVfYgMKtfBYxJg7sHrkTfkQGysW23Lm9Lp9rsVpVk2Esmgz9VQZvNE4xWN8hh3LgLrCa7ty4B3YGCwtH",
  "next_url": "https://<eu|us>.market-api.kaiko.io/v1/data/trades.v1/exchanges/bfnx/spot/btc-usd/trades?continuation_token=rbd28vrmb1cwaxfykuJBKAABhNi1Bfv1EY55P3QPSnYnm8VuX1LqLhA2d3yVfYgMKtfBYxJg7sHrkTfkQGysW23Lm9Lp9rsVpVk2Esmgz9VQZvNE4xWN8hh3LgLrCa7ty4B3YGCwtH",
  "access": {
    "access_range": {
      "start_timestamp": 1546300800000,
      "end_timestamp": 1577836800000
    },
    "data_range": {
      "start_timestamp": 1356998400000,
      "end_timestamp": 1577836800000
    }
  }
}

This endpoint retrieves trades for an instrument on a specific exchange. By default returns the 100 first trades in our dataset. Trades are sorted by time, ascendingly. Note that taker_side_sell can be null in the cases where this information was not available at collection.

HTTP request

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).

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://<eu|us>.market-api.kaiko.io/v1/data/trades.v1/exchanges/krkn/spot/eth-eur/trades/recent'

Response Example

{
  "query": {
    "data_version": "v1",
    "commodity": "trades",
    "exchange": "krkn",
    "instrument_class": "spot",
    "instrument": "eth-eur",
    "limit": 100,
    "request_time": "2019-01-24T09:41:03.035Z"
  },
  "time": "2019-01-24T09:41:03.065Z",
  "timestamp": 1548322863065,
  "data": [
    {
      "timestamp": 1548322820041,
      "trade_id": "23f4328e31049e8175385fdee4492f12878cdcf22e1c1ab47cf013f767762aae",
      "price": "101.49000",
      "amount": "18.48254949",
      "taker_side_sell": true
    },
    {
      "timestamp": 1548322820035,
      "trade_id": "58f1981dcaef3c65389b2c5c1039fa88bb0b6f960ebc690f2ca0d46107f2d92f",
      "price": "101.50000",
      "amount": "11.00000000",
      "taker_side_sell": true
    },
  /* ... */
  ],
  "result": "success",
  "access": {
    "access_range": {
      "start_timestamp": 1546300800000,
      "end_timestamp": 1577836800000
    },
    "data_range": {
      "start_timestamp": 1356998400000,
      "end_timestamp": 1577836800000
    }
  }
}

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

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

Parameters

Parameter Required Description
cont 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.
limit No Maximum number of results (min: 1, default: 100, max: 10000).

SPOT price

Request Example

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

GET https://<eu|us>.market-api.kaiko.io/v1/data/{commodity}.{data_version}/exchanges/spots/recent{?pattern,limit,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)
limit No Maximum number of results (min: 1, default: 100, max: 10000).
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.

Order Book data

Recent Order Book Snapshot (ALPHA-RELEASE)

Request Example

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

Response Example

{  
  "query":{  
    "data_version":"v1",
    "commodity":"order_book_snapshots",
    "exchange":"krkn",
    "instrument_class":"spot",
    "instrument":"eth-eur",
    "request_time":"2019-01-24T09:41:03.035Z"
  },
  "time":"2019-03-06T13:57:03.065Z",
  "timestamp":1551877023065,
  "data":{  
    "asks":[  
      [  
        "3849.45",
        "0.000097"
      ],
      [  
        "3849.47",
        "0.377883"
      ],
      /* ... */
    ],
    "bids":[  
      [  
        "3849.16",
        "0.000089"
      ],
      [  
        "3848.38",
        "0.455536"
      ],
      /* ... */
    ],
    "time":"2019-03-06T13:55:53.000+00:00",
    "timestamp":1551880553973
  },
  "result":"success",
  "access":{  
    "access_range":{  
      "start_timestamp":1546300800000,
      "end_timestamp":1577836800000
    },
    "data_range":{  
      "start_timestamp":1356998400000,
      "end_timestamp":1577836800000
    }
  }
}

This endpoint retrieves the most recent order book snapshot for an instrument on a specific exchange. The number of bids and asks can vary depending on the maximum order book size supported by the exchange. This endpoint does not support pagination. Asks and bids are sorted by price, from best to worst. time and timestamp represent the time and timestamp at which the snapshot was taken.

HTTP request

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

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.

Order Book Quotes (ALPHA-RELEASE)

Request Example

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

Response Example

{
  "query": {
    "data_version": "v1",
    "commodity": "order_book_snapshots",
    "exchange": "krkn",
    "instrument_class": "spot",
    "instrument": "eth-eur",
    "request_time": "2019-01-24T09:41:03.035Z"
  },
  "time": "2019-03-06T13:57:03.065Z",
  "timestamp": 1551877023065,
  "data": {
    "best_ask": {
      "price": "3849.45",
      "amount": "0.000097"
    },
    "best_bid": {
      "price": "3849.16",
      "amount": "0.000089"
    },
    "spread": "0.29",
    "time": "2019-03-06T13:55:53.000+00:00",
    "timestamp": 1551880553973
  },
  "result": "success",
  "access": {
    "access_range": {
      "start_timestamp": 1546300800000,
      "end_timestamp": 1577836800000
    },
    "data_range": {
      "start_timestamp": 1356998400000,
      "end_timestamp": 1577836800000
    }
  }
}

This endpoint retrieves the order book quotes (best bid and ask) and spread for an instrument on a specific exchange. This endpoint does not support pagination. time and timestamp represent the time and timestamp at which the snapshot was taken.

HTTP request

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

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.

Aggregates

Historical OHLCV (Candles)

Request Example

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

Response Example

{
  "query": {
    "data_version": "v1",
    "commodity": "trades",
    "page_size": 100,
    "exchange": "krkn",
    "instrument_class": "spot",
    "instrument": "btc-usd",
    "interval": "1d",
    "aggregation": "ohlcv",
    "request_time": "2019-01-22T15:56:32.165Z"
  },
  "time": "2019-01-22T15:56:32.277Z",
  "timestamp": 1548172592277,
  "data": [
    {
      "timestamp": 1381017600000,
      "open": "122.0",
      "high": "122.0",
      "low": "122.0",
      "close": "122.0",
      "volume": "0.1"
    },
    {
      "timestamp": 1381104000000,
      "open": "123.61",
      "high": "123.61",
      "low": "123.61",
      "close": "123.61",
      "volume": "0.1"
    },
  /* ... */
  ],
  "result": "success",
  "continuation_token": "rbd2bcDp35GmDscQbvZ9YzQHZJkT3jdeFx9fSBDdVmcCZaHvQRTCTfmfQ6QCrvDNp5ciRRuGPTedVL5LMZv1qmSXhRpZFbpvBW2uA62RSYpfJ1hVykJKZfhtmXXrxz",
  "next_url": "https://<eu|us>.market-api.kaiko.io/v1/data/trades.v1/exchanges/krkn/spot/btc-usd/aggregations/ohlcv?continuation_token=rbd2bcDp35GmDqdfaz3fZJkT3jdeFx9fSBDdVmcCZaHvQRTCTfmfQ6QCrvDNp5ciRRuGPTedVL5LMZv1qmSXhRpZFbpvBW2uA62RSYpfJ1hVykJKZfhtmXXrxz",
  "access": {
    "access_range": {
      "start_timestamp": 1546300800000,
      "end_timestamp": 1577836800000
    },
    "data_range": {
      "start_timestamp": 1356998400000,
      "end_timestamp": 1577836800000
    }
  }
}

This endpoint retrieves aggregated history for an instrument on an exchange. Returns the earliest available intervals by default. The interval parameter is suffixed with s, m, h or d to specify seconds, minutes, hours or days, respectively. Values are sorted by time, ascendingly.

HTTP request

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}

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).

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
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

The following intervals are currently supported: 1m, 2m, 3m, 5m, 10m, 15m, 30m, 1h, 2h, 3h, 4h, 1d.

Recent OHLCV (ALPHA-RELEASE)

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://<eu|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, up to 10000 values. The interval parameter is suffixed with s, m, h or d to specify seconds, minutes, hours or days, respectively. Values are sorted by time, descendingly. Please note that periods for which no data present won't be returned.

HTTP request

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

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.
limit No Maximum number of results (min: 1, default: 100, max: 10000).

Fields

Field Description
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

The following intervals are currently supported: 1m, 2m, 3m, 5m, 10m, 15m, 30m, 1h, 2h, 3h, 4h, 1d.

Recent OHLCV Period (ALPHA-RELEASE)

Request Example

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

Response Example

{
    "query": {
        "data_version": "v1",
        "commodity": "trades",
        "exchange": "krkn",
        "instrument_class": "spot",
        "instrument": "btc-usd",
        "interval": "1d",
        "period": "1d",
        "aggregation": "ohlcv",
        "request_time": "2019-03-28T09:34:31.156Z"
    },
    "time": "2019-03-28T09:34:31.207Z",
    "timestamp": 1553765671207,
    "data": [
        {
            "timestamp": 1553644800000,
            "open": "3919.0",
            "high": "4037.3",
            "low": "3913.0",
            "close": "4025.8",
            "volume": "4241.28435209"
        }
    ],
    "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, for a predetermined period. The period parameter is suffixed with a d, M or Yto specify days, months or years, respectively. The interval parameter is suffixed with s, m, h or d to specify seconds, minutes, hours or days, respectively. The maximum number of values is 10000. Consequently, requests with a broad period and a high granularity (for instance 1Y period with 1m interval) will return a too many data points requested error.

HTTP request

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

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.
period No Period for which to return data. Default 1d.
interval No Interval period. Default 1d.

Fields

Field Description
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.

Periods

The following periods are currently supported: 1d, 5d, 1M, 3M, 6M, 1Y.

Intervals

The following intervals are currently supported: 1m, 2m, 3m, 5m, 10m, 15m, 30m, 1h, 2h, 3h, 4h, 1d.

Historical VWAP (Prices)

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://<eu|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 price history for an instrument on an exchange. Returns the earliest available intervals by default. The interval parameter is suffixed with s, m, h or d to specify seconds, minutes, hours or days, respectively. Values are sorted by time, ascendingly.

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).

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
price Volume-weighted average price.

Intervals

The following intervals are currently supported: 1m, 2m, 3m, 5m, 10m, 15m, 30m, 1h, 2h, 3h, 4h, 1d.

Recent VWAP (ALPHA-RELEASE)

Request Example

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

Response Example

{
  "query": {
      "data_version": "v1",
      "commodity": "trades",
      "exchange": "cbse",
      "instrument_class": "spot",
      "instrument": "btc-usd",
      "interval": "1d",
      "limit": 100,
      "aggregation": "vwap",
      "request_time": "2019-03-26T17:28:38.618Z"
  },
  "time": "2019-03-26T17:28:38.685Z",
  "timestamp": 1553621318685,
  "data": [
      {
          "timestamp": 1553472000000,
          "price": "3928.9568246175739625018415246600135064034680485923"
      },
      {
          "timestamp": 1553385600000,
          "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 VWAP data points for an instrument on an exchange, up to 10000 values. The interval parameter is suffixed with s, m, h or d to specify seconds, minutes, hours or days, respectively. Values are sorted by time, descendingly. Please note that periods for which no data present won't be returned.

HTTP request

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

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.
limit No Maximum number of results (min: 1, default: 100, max: 10000).

Fields

Field Description
price Volume-weighted average price.

Intervals

The following intervals are currently supported: 1m, 2m, 3m, 5m, 10m, 15m, 30m, 1h, 2h, 3h, 4h, 1d.

Recent VWAP Period (ALPHA-RELEASE)

Request Example

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

Response Example

{
    "query": {
        "data_version": "v1",
        "commodity": "trades",
        "exchange": "krkn",
        "instrument_class": "spot",
        "instrument": "btc-usd",
        "interval": "1d",
        "period": "1d",
        "aggregation": "vwap",
        "request_time": "2019-03-28T10:02:01.921Z"
    },
    "time": "2019-03-28T10:02:01.985Z",
    "timestamp": 1553767321985,
    "data": [
        {
            "timestamp": 1553644800000,
            "price": "3992.814087455413018280226080996980900541674343968"
        }
    ],
    "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, for a predetermined period. The period parameter is suffixed with a d, M or Yto specify days, months or years, respectively. The interval parameter is suffixed with s, m, h or d to specify seconds, minutes, hours or days, respectively. The maximum number of values is 10000. Consequently, requests with a broad period and a high granularity (for instance 1Y period with 1m interval) will return a too many data points requested error.

HTTP request

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

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.
period No Period for which to return data. Default 1d.
interval No Interval period. Default 1d.

Fields

Field Description
price Volume-weighted average price.

Periods

The following periods are currently supported: 1d, 5d, 1M, 3M, 6M, 1Y.

Intervals

The following intervals are currently supported: 1m, 2m, 3m, 5m, 10m, 15m, 30m, 1h, 2h, 3h, 4h, 1d.

Historical COUNT OHLCV VWAP

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://<eu|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 aggregated history for an instrument on an exchange. Returns the earliest available intervals by default. The interval parameter is suffixed with s, m, h or d to specify seconds, minutes, hours or days, respectively. Values are sorted by time, ascendingly.

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).

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
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

The following intervals are currently supported: 1m, 2m, 3m, 5m, 10m, 15m, 30m, 1h, 2h, 3h, 4h, 1d.

Recent COUNT OHLCV VWAP (ALPHA-RELEASE)

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://<eu|us>.market-api.kaiko.io/v1/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, up to 10000 values. The interval parameter is suffixed with s, m, h or d to specify seconds, minutes, hours or days, respectively. Values are sorted by time, descendingly. Please note that periods for which no data present won't be returned.

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}

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.
limit No Maximum number of results (min: 1, default: 100, max: 10000).

Fields

Field Description
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

The following intervals are currently supported: 1m, 2m, 3m, 5m, 10m, 15m, 30m, 1h, 2h, 3h, 4h, 1d.

Recent COUNT OHLCV VWAP Period (ALPHA-RELEASE)

Request Example

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

Response Example

{
    "query": {
        "data_version": "v1",
        "commodity": "trades",
        "exchange": "krkn",
        "instrument_class": "spot",
        "instrument": "btc-usd",
        "interval": "1d",
        "period": "1d",
        "aggregation": "count_ohlcv_vwap",
        "request_time": "2019-03-28T10:05:13.300Z"
    },
    "time": "2019-03-28T10:05:13.428Z",
    "timestamp": 1553767513428,
    "data": [
        {
            "timestamp": 1553644800000,
            "count": 9568,
            "open": "3919.0",
            "high": "4037.3",
            "low": "3913.0",
            "close": "4025.8",
            "volume": "4241.28435209",
            "price": "3992.814087455413018280226080996980900541674343968"
        }
    ],
    "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, for a predetermined period. The period parameter is suffixed with a d, M or Yto specify days, months or years, respectively. The interval parameter is suffixed with s, m, h or d to specify seconds, minutes, hours or days, respectively. The maximum number of values is 10000. Consequently, requests with a broad period and a high granularity (for instance 1Y period with 1m interval) will return a too many data points requested error.

HTTP request

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

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.
period No Period for which to return data. Default 1d.
interval No Interval period. Default 1d.

Fields

Field Description
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.

Periods

The following periods are currently supported: 1d, 5d, 1M, 3M, 6M, 1Y.

Intervals

The following intervals are currently supported: 1m, 2m, 3m, 5m, 10m, 15m, 30m, 1h, 2h, 3h, 4h, 1d.

Aggregated Price (Direct Exchange Rate)

Request Example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
  'https://<eu|us>.market-api.kaiko.io/v1/data/trades.v1/spot_direct_exchange_rate/btc/usd?start_time=2019-04-01T14:30:01.306526Z&exchanges=cbse,bfnx&sources=true'

Response Example

{
  "query": {
      "data_version": "v1",
      "commodity": "trades",
      "start_time": "2019-04-01T14:30:01.306526Z",
      "page_size": 100,
      "interval": "1d",
      "quote_asset": "usd",
      "base_asset": "btc",
      "exchanges": [
        "cbse",
        "bfnx"
      ],
      "sources": "true",
      "request_time": "2019-04-19T15:07:58.312Z",
      "instruments": [
        "cbse:spot:btc-usd",
        "bfnx:spot:btc-usd"
      ],
      "start_timestamp": 1554129001306
  },
  "time": "2019-04-19T15:07:58.628Z",
  "timestamp": 1555686478628,
  "data": [
      {
          "timestamp": 1554163200000,
          "count": 196820,
          "volume": "87295.43661361",
          "price": "4740.4093255788025069466586284357500546253003304934",
          "sources": [
              {
                "timestamp": 1554163200000,
                "count": 93009,
                "volume": "33147.1777243",
                "price": "4691.4261615778743924149431359978765792555424446918",
                "exchange_code": "cbse",
                "class": "spot",
                "code": "btc-usd"
              },
              {
                "timestamp": 1554163200000,
                "count": 103811,
                "volume": "54148.25888931",
                "price": "4770.3946598433145887159011303569907228081941306301",
                "exchange_code": "bfnx",
                "class": "spot",
                "code": "btc-usd"
              }
          ]
      },
      {
          "timestamp": 1554249600000,
          "count": 224812,
          "volume": "81864.22103255",
          "price": "5071.3897096064964650482723101057632528630231040653",
          "sources": [
              {
                "timestamp": 1554249600000,
                "count": 119919,
                "volume": "37595.25563337",
                "price": "5060.9855583090699912471491320857686484860047127867",
                "exchange_code": "cbse",
                "class": "spot",
                "code": "btc-usd"
              },
              {
                "timestamp": 1554249600000,
                "count": 104893,
                "volume": "44268.96539918",
                "price": "5080.2253967328608796320084300252981948527928443473",
                "exchange_code": "bfnx",
                "class": "spot",
                "code": "btc-usd"
              }
          ]
      },
    /* ... */
],
    "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.

HTTP request

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}

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).
exchanges No List of exchanges' code. See Instruments Reference Data Endpoint.
interval No Interval period. Default 1d.
page_size1 No See Pagination (min: 1, default: 100, max: 100000).
quote_asset Yes The desired quote asset code. See Instruments Reference Data Endpoint.
start_time1 No Starting time in ISO 8601 (inclusive).
sources 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.

WebSocket Market Data API

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

General Information

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.

For the moment, the only available commodity is the trades commodity. Its latest data version is v1.

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>"
  }
}

For a given Client, we are allowing 1000 pending messages. Maximum number of pending messages exceeded error should be sent if the number of current pending messages exceeds this payload. Then, we close the connection.

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!