HTTP API Reference

HTTP based API providing historical market data feeds, supported exchanges details and more

Base API Endpoint: https://api.tardis.dev/v1

/data-feeds/:exchange

GET https://api.tardis.dev/v1/data-feeds/:exchange

Provides historical cryptocurrency market data feed for requested exchange in minute by minute slices in new line delimited JSON format (NDJSON) with addition of local timestamp at the beginning of each line - in ISO 8601 format. JSON message in each line is a data message in exchange-native format. Empty lines in response are being used as markers for disconnect events that occurred when collecting the data. Responses are gzip compressed (content-encoding: gzip) and each one contains one minute of historical market data starting from requested date which is from date plus minute offset param. Parallel request to this endpoint are supported and can speed up overall data fetching process substantially, but using more than ~60 parallel requests doesn't bring speed benefits. In order to achieve best performance HTTP 1.1 protocol is recommended, in our testing HTTP 2 was noticeable slower. As this is relatively low level API you may also want to try official client libraries that are built on top of it and provide more convenient way of consuming historical market data like requesting whole date ranges of data at once instead of minute by minute pagination or providing normalized data format.

Path Parameters

NameTypeDescription

exchange*

string

one of https://api.tardis.dev/v1/exchanges (field id)

Query Parameters

NameTypeDescription

from*

string

requested UTC start date of historical market data feed (e.g.: 2019-04-05 or 2019-04-05T01:02:00.000Z)

offset

number

minute offset that together with from date specifies exact minute slice of historical data that will be returned (e.g.: from date: 2019-04-05 with offset: 2 will provide historical data between 2019-04-05T00:02:00.000Z and 2010-04-05T00:03:00.000Z)

filters

string

URL encoded JSON string with{channel:string, symbols?: string[]}[] format with optional historical market data filters, e.g.: [{"channel":"trade", "symbols":["XBTUSD"]}] In order to get the list of allowed channels and symbols for each exchange usehttps://api.tardis.dev/v1/exchanges/:exchange API (documented below).

Headers

NameTypeDescription

Authorization

string

For authenticated requests provide Authorization header with value: 'Bearer YOUR_API_KEY'. Without API key historical data feeds for the first day of each month are available.

2019-04-01T00:00:34.8345516Z {"table":"trade","action":"insert","data":[{"timestamp":"2019-04-01T00:00:34.815Z","symbol":"ETHUSD","side":"Sell","size":7000,"price":141.2,"tickDirection":"ZeroMinusTick","trdMatchID":"baa369de-cb3b-b18f-685e-0ffdec00358c","grossValue":98840000,"homeNotional":28.654468050268125,"foreignNotional":4046.010888697859}]}
2019-04-01T00:00:34.8346465Z {"table":"orderBookL2","action":"update","data":[{"symbol":"ETHUSD","id":29699997176,"side":"Buy","size":65350}]}
2019-04-01T00:00:34.8395743Z {"table":"orderBookL2","action":"update","data":[{"symbol":"BCHM19","id":32999999571,"side":"Sell","size":333},{"symbol":"BCHM19","id":32999999572,"side":"Sell","size":576},{"symbol":"BCHM19","id":32999999573,"side":"Sell","size":353}]}
2019-04-01T00:00:34.8567501Z {"table":"trade","action":"insert","data":[{"timestamp":"2019-04-01T00:00:34.830Z","symbol":"XBTUSD","side":"Buy","size":182,"price":4089,"tickDirection":"ZeroPlusTick","trdMatchID":"fa93bd9b-e1b6-d38d-f4d4-65337a766e34","grossValue":4450992,"homeNotional":0.04450992,"foreignNotional":182}]}
2019-04-01T00:00:34.8567741Z {"table":"orderBookL2","action":"update","data":[{"symbol":"XBTUSD","id":8799591100,"side":"Sell","size":351568}]}
2019-04-01T00:00:34.8567783Z {"table":"orderBookL2","action":"update","data":[{"symbol":"ETHUSD","id":29699997176,"side":"Buy","size":55349}]}
2019-04-01T00:00:34.8567812Z {"table":"orderBookL2","action":"update","data":[{"symbol":"ETHUSD","id":29699997167,"side":"Sell","size":430305}]}
2019-04-01T00:00:34.8567847Z {"table":"orderBookL2","action":"insert","data":[{"symbol":"EOSM19","id":33199989652,"side":"Buy","size":216,"price":0.0010348}]}
2019-04-01T00:00:34.8605618Z {"table":"orderBookL2","action":"update","data":[{"symbol":"XBTUSD","id":8799591850,"side":"Buy","size":154511}]}
2019-04-01T00:00:34.8605944Z {"table":"orderBookL2","action":"update","data":[{"symbol":"TRXM19","id":33299999258,"side":"Sell","size":1493}]}
2019-04-01T00:00:34.8617223Z {"table":"orderBookL2","action":"update","data":[{"symbol":"ADAM19","id":33099998260,"side":"Buy","size":224039}]}Requests examples

See downloadable CSV files documentation and related datasets API if you'd like to access historical tick-level trades, order book snapshots, incremental order book L2 updates, options chains, quotes, derivative tickers and liquidations datasets in daily intervals split by exchange, data type and symbol. It may be faster and more native to your toolkit to access the historical data this way.

import json
import requests


def get_data_feeds():
    filters = [
        {"channel": "trade", "symbols": ["XBTUSD", "ETHUSD"]},
        {"channel": "orderBookL2", "symbols": ["XBTUSD", "ETHUSD"]},
    ]
    qs_params = {"from": "2019-07-01", "offset": 3, "filters": json.dumps(filters)}

    headers = {"Authorization": "Bearer YOUR_API_KEY"}

    url = "https://api.tardis.dev/v1/data-feeds/bitmex"

    response = requests.get(url, headers=headers, params=qs_params, stream=True)

    for line in response.iter_lines():
        # empty lines in response are being used as markers
        # for disconnect events that occurred when collecting the data
        if len(line) <= 1:
            continue

        parts = line.decode("utf-8").split(" ")
        local_timestamp = parts[0]
        message = json.loads(parts[1])
        # local_timestamp string marks message arrival timestamp
        # message is a message dict as provided by exchange real-time stream
        print(local_timestamp, message)


get_data_feeds()

See also Python client library with built-in data caching that provides more convenient access to tick-level historical market data — it returns data for the whole time periods in contrast to HTTP API where single call returns data for single minute time period.

Sample requests

Full BitMEX data feed from 2019-04-01T00:02:00.000Z to 2019-04-01T00:03:00.000Z

BitMEX trades for all instruments from 2019-05-01T00:00:00.000Z to 2019-05-01T00:01:00.000Z

BitMEX trades for XBTUSD from 2019-06-01T00:00:00.000Z to 2019-06-01T00:01:00.000Z

Full Deribit data feed from 2019-06-01T00:10:00.000Z to 2019-06-01T00:11:00.000Z

/exchanges

GET https://api.tardis.dev/v1/exchanges

Gets the list of all supported exchanges that historical market data is available for.

[
  {
    "id": "bitmex",
    "name": "BitMEX",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-03-30T00:00:00.000Z"
  },
  {
    "id": "deribit",
    "name": "Deribit",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-03-30T00:00:00.000Z"
  },
  {
    "id": "binance-futures",
    "name": "Binance Futures",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-11-17T00:00:00.000Z"
  },
  {
    "id": "binance",
    "name": "Binance (high caps)",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-03-30T00:00:00.000Z"
  },
  {
    "id": "ftx",
    "name": "FTX",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-08-01T00:00:00.000Z"
  },
  {
    "id": "okex-futures",
    "name": "OKEx Futures",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-03-30T00:00:00.000Z"
  },
  {
    "id": "okex-options",
    "name": "OKEx Options",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2020-02-01T00:00:00.000Z"
  },
  {
    "id": "okex-swap",
    "name": "OKEx Perpetual Swap",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-03-30T00:00:00.000Z"
  },
  {
    "id": "okex",
    "name": "OKEx Spot (high caps)",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-03-30T00:00:00.000Z"
  },
  {
    "id": "huobi-dm",
    "name": "Huobi DM",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-11-19T00:00:00.000Z"
  },
  {
    "id": "huobi-dm-swap",
    "name": "Huobi DM Swap",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2020-03-28T00:00:00.000Z"
  },
  {
    "id": "huobi",
    "name": "Huobi Spot (high caps)",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-11-19T00:00:00.000Z"
  },
  {
    "id": "bitfinex-derivatives",
    "name": "Bitfinex Derivatives",
    "enabled": true,
    "filterable": false,
    "supportsDatasets": true,
    "availableSince": "2019-09-14T00:00:00.000Z"
  },
  {
    "id": "bitfinex",
    "name": "Bitfinex (high caps)",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-05-23T00:00:00.000Z"
  },
  {
    "id": "bitfinex-alts",
    "name": "Bitfinex (alts)",
    "enabled": true,
    "filterable": false,
    "supportsDatasets": true,
    "availableSince": "2020-02-01T00:00:00.000Z"
  },
  {
    "id": "bitflyer",
    "name": "bitFlyer",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-08-30T00:00:00.000Z"
  },
  {
    "id": "cryptofacilities",
    "name": "Kraken Futures (Crypto Facilities)",
    "enabled": false,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-03-30T00:00:00.000Z"
  },
  {
    "id": "kraken",
    "name": "Kraken",
    "enabled": false,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-06-04T00:00:00.000Z"
  },
  {
    "id": "bitstamp",
    "name": "Bitstamp",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-03-30T00:00:00.000Z"
  },
  {
    "id": "coinbase",
    "name": "Coinbase Pro",
    "enabled": false,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-03-30T00:00:00.000Z"
  },
  {
    "id": "gemini",
    "name": "Gemini",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-08-30T00:00:00.000Z"
  },
  {
    "id": "coinflex",
    "name": "CoinFLEX",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": false,
    "availableSince": "2020-02-01T00:00:00.000Z"
  },
  {
    "id": "bybit",
    "name": "Bybit",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-11-07T00:00:00.000Z"
  },
  {
    "id": "phemex",
    "name": "Phemex",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2020-03-17T00:00:00.000Z"
  },
  {
    "id": "okcoin",
    "name": "OKCoin",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-11-19T00:00:00.000Z"
  },
  {
    "id": "hitbtc",
    "name": "HitBTC (high caps)",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": false,
    "availableSince": "2019-11-19T00:00:00.000Z"
  },
  {
    "id": "binance-jersey",
    "name": "Binance Jersey",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-10-30T00:00:00.000Z"
  },
  {
    "id": "binance-us",
    "name": "Binance US",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": true,
    "availableSince": "2019-09-25T00:00:00.000Z"
  },
  {
    "id": "binance-dex",
    "name": "Binance DEX",
    "enabled": true,
    "filterable": true,
    "supportsDatasets": false,
    "availableSince": "2019-06-04T00:00:00.000Z"
  }
]

Sample request

/exchanges/:exchange

GET https://api.tardis.dev/v1/exchanges/:exchange

Gets the exchanges details: available symbols, availability dates, available channels, CSV datasets info, incidents etc.

Path Parameters

NameTypeDescription

exchange*

string

one of https://api.tardis.dev/v1/exchanges (field id)

{
  "id": "binance-futures",
  "name": "Binance Futures",
  "enabled": true,
  "availableSince": "2019-11-17T00:00:00.000Z",
  "availableChannels": [
    "trade",
    "aggTrade",
    "ticker",
    "depth",
    "markPrice",
    "depthSnapshot",
    "bookTicker",
    "forceOrder"
  ],
  "availableSymbols": [
    {
      "id": "btcusdt",
      "type": "perpetual",
      "availableSince": "2019-11-17T00:00:00.000Z"
    },
    {
      "id": "ethusdt",
      "type": "perpetual",
      "availableSince": "2019-11-27T00:00:00.000Z"
    }
  ],
  "datasets": {
    "dataTypes": [
      "trades",
      "incremental_book_L2",
      "quotes",
      "derivative_ticker"
    ],
    "formats": [
      "csv"
    ],
    "exportedFrom": "2019-11-17T00:00:00.000Z",
    "exportedUntil": "2020-05-06T00:00:00.000Z",
    "stats": {
      "trades": 261878395,
      "bookChanges": 10097435451
    },
    "symbols": [
      {
        "id": "PERPETUALS",
        "type": "perpetual",
        "availableSince": "2019-11-17T00:00:00.000Z",
        "availableTo": "2020-05-06T00:00:00.000Z",
        "stats": {
          "trades": 261878395,
          "bookChanges": 10097435432
        }
      },
      {
        "id": "BTCUSDT",
        "type": "perpetual",
        "availableSince": "2019-11-17T00:00:00.000Z",
        "availableTo": "2020-05-06T00:00:00.000Z",
        "stats": {
          "trades": 96479149,
          "bookChanges": 3312038141
        }
      },
      {
        "id": "ETHUSDT",
        "type": "perpetual",
        "availableSince": "2019-11-27T00:00:00.000Z",
        "availableTo": "2020-05-06T00:00:00.000Z",
        "stats": {
          "trades": 37859849,
          "bookChanges": 1470630154
        }
      }
    ]
  },
  "incidentReports": [
    {
      "from": "2020-03-25T13:32:00.000Z",
      "to": "2020-03-25T13:39:00.000Z",
      "status": "resolved",
      "details": "Google Cloud K8s node networking issue caused connection timeouts and as a result missing data for approximately 6 minutes due to not being able to connect to WS endpoints. Node has been automaticaly replaced with healthy node by auto-repair logic."
    }
  ]
}

Sample request

/api-key-info

GET https://api.tardis.dev/v1/api-key-info

Given API_KEY provided in request header provides information about what historical data (exchanges, date ranges, symbols) is available for given API_KEY.

Headers

NameTypeDescription

Authorization*

string

Authorization header with value: 'Bearer YOUR_API_KEY'

[
  {
    "exchange": "bitmex",
    "accessType": "pro",
    "from": "2019-03-30T00:00:00.000Z",
    "to": "2050-12-02T00:00:00.000Z",
    "symbols": [],
    "dataPlan": "unlimited"
  },
  {
    "exchange": "deribit",
    "accessType": "one-off-purchase",
    "from": "2019-03-30T00:00:00.000Z",
    "to": "2050-12-02T00:00:00.000Z",
    "symbols": [],
    "dataPlan": "unlimited"
  }
]

Last updated