Getting Started

Node.js tardis-dev provides convenient access to tick-level historical and real-time cryptocurrency market data both in exchange-native and normalized formats. It relies on async iteration (for await ...of)arrow-up-right, which makes it straightforward to consume replayed data, real-time streams and locally computed derived data in the same style.

Installation

Requires Node.js v12+ installed.

npm install tardis-dev --save

Historical Replay

const { replay } = require('tardis-dev')

const messages = replay({
  exchange: 'bitmex',
  filters: [
    { channel: 'trade', symbols: ['XBTUSD'] },
    { channel: 'orderBookL2', symbols: ['XBTUSD'] }
  ],
  from: '2019-05-01',
  to: '2019-05-02'
})

for await (const message of messages) {
  console.log(message)
}

Full replay reference lives on Replaying Historical Data.

Real-Time Streaming

Full streaming reference lives on Streaming Real-Time Data.

Key Capabilities

Tardis-dev GitHub repository

Debugging and logging

tardis-dev lib uses debugarrow-up-right package for verbose logging and debugging purposes that can be enabled via DEBUG environment variable set to tardis-dev*.

Usage with TypeScript

Simply change from require

to ES Modules import

to enjoy first class TypeScript typings.

Reference pages

Historical market data helpers

init(options)

circle-info

This function doesn't affect real-time streaming functionality in any way, it's useful only for historical data replay.

When working with market data via replay and replayNormalized, by default only the first day of each month of historical data is available for replay, and locally cached historical data is stored in the default location on disk (OS temp dir).

Init function allows providing an apiKey received via email after ordering historical market data access via Tardis.dev websitearrow-up-right, as well as a custom cacheDir. apiKey can also be provided directly via options of replay and replayNormalized functions - that overrides anything that was provided via init.

init options

name
type
default
description

apiKey

string (optional)

undefined

API key for Tardis.dev HTTP API - if not provided only first day of each month of historical data is accessible

cacheDir

string

<os.tmpdir>/.tardis-cache

path to local dir that will be used as cache location - if not provided default temp dir for given OS will be used

getExchangeDetails(exchange)

Given exchange id provides exchange details (available symbols, availability dates, available channels, pricing info etc) provided by exchanges/:exchange API endpoint.

type of response returned by awaiting on getExchangeDetails

getApiKeyAccessInfo(apiKey?)

Given apiKey provided as optional parameter or provided in init function provides information about what historical data is available for it - exchanges, date ranges, symbols.

type of response returned by awaiting on getApiKeyAccessInfo()

clearCache()

Clears local data cache dir.

Last updated