Quickstart
Install, configure and get started with the tardis-dev npm package
Node.js tardis-dev library provides access to tick-level historical and real-time cryptocurrency market data both in exchange-native and normalized formats. Instead of callbacks, it uses async iteration (for await ...of), which works well for switching between real-time streaming and historical replay and computing derived data locally.
Features
historical tick-level market data replay backed by Tardis.dev HTTP API — includes full order book depth snapshots plus incremental updates, trades, historical open interest, funding, index, mark prices, liquidations and more
consolidated real-time data streaming API connecting directly to exchanges' public WebSocket APIs
support for both exchange-native and normalized market data formats (unified format for accessing market data across all supported exchanges — normalized trades, order book and ticker data)
seamless switching between real-time streaming and historical market data replay thanks to
async iterablesproviding unified way of consuming data messagestransparent historical local data caching (cached data is stored on disk in compressed format and decompressed on demand when reading the data)
support for top cryptocurrency exchanges: Deribit, Binance Spot, Binance USDS-M Futures, OKX Spot, HTX Spot, bitFlyer, Bitstamp, Coinbase Exchange, Kraken Futures (Crypto Facilities), Gemini, Kraken, Bitfinex, Bybit Derivatives and more
automatic closed connections and stale connections reconnection logic for real-time streams
combining multiple exchanges feeds into single one via
combinehelper function — synchronized historical market data replay and consolidated real-time data streaming from multiple exchangescomputing derived data locally like order book imbalance, customizable trade bars, book snapshots and more via
computehelper function andcomputables, e.g., volume based bars, top 20 levels order book snapshots taken every 10 ms etcfull limit order book reconstruction both for real-time and historical data via
OrderBookobjectfast and lightweight architecture — low memory footprint and no heavy in-memory buffering
extensible mapping logic that allows adjusting normalized formats for specific needs
built-in TypeScript support
Installation
Requires Node.js v24.22.1+ (24.x) or v26.12.1+ installed.
Historical Replay
Real-Time Streaming
Debugging and logging
tardis-dev lib uses debug package for verbose logging and debugging purposes that can be enabled via DEBUG environment variable set to tardis-dev*.
ES Modules and TypeScript
Examples in this page use standard ES module imports and top-level await:
This works in modern Node.js and gives you first class TypeScript typings.
Historical market data helpers
init(options)
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).
Use init to set an apiKey, custom cacheDir, and preferred compression for historical replay requests. apiKey can also be provided directly via replay and replayNormalized options; that overrides anything set via init.
init options
apiKey
string (optional)
undefined
Data 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
dataFeedCompression
'zstd' | 'gzip' (optional)
'zstd'
preferred compression for historical replay requests; set to 'gzip' when you need the client to request gzip-compressed slices
getExchangeDetails(exchange)
Given exchange id provides exchange details (available symbols, availability dates, available channels, incident reports 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 the account's historical data access: exchanges, access type, data plan, date ranges, and symbol restrictions.
type of response returned by awaiting on getApiKeyAccessInfo()
clearCache()
Clears local data cache dir.
downloadDatasets(options)
Downloads CSV datasets for specified exchange, data types, symbols and date range. Handles day-by-day downloads, retries and skipping already-downloaded files automatically.
downloadDatasets options
exchange
string
-
exchange id with supportsDatasets=true; use getExchangeDetails() to inspect available dataset symbols and data types
dataTypes
string[]
-
dataset types to download, e.g. trades, incremental_book_L2, quotes, book_snapshot_25, book_snapshot_5, book_ticker, derivative_ticker, options_chain, liquidations
symbols
string[]
-
dataset symbols to download, e.g. BTCUSDT or grouped symbols such as OPTIONS
from
string
-
start date in ISO format, e.g. 2024-03-01
to
string
-
end date in ISO format (non-inclusive)
apiKey
string (optional)
apiKey from init()
Data API key for Tardis.dev datasets API - if not provided only first day of each month of historical data is accessible
downloadDir
string (optional)
'./datasets'
local directory where downloaded files will be stored
format
'csv' (optional)
'csv'
dataset file format
concurrency
number (optional)
20
number of parallel requests, shared by all files and the parts of large files; must be greater than 0
getFilename
function (optional)
getFilenameDefault
function that returns the relative output path for each downloaded file
skipIfExists
boolean (optional)
true
when true, skips files that already exist locally
verifyMd5
boolean (optional)
false
when true, checks each file against the MD5 announced by the datasets API, if any, and downloads it again on a mismatch
getInstrumentInfo(exchange, symbol)
Returns instrument metadata (tick sizes, contract multipliers, base/quote currencies) for a given exchange and symbol.
You can also pass an instrument metadata filter, or an array of exchanges, when you need full metadata records.
findInstrumentSymbols(exchanges, filter, selector?)
Use this helper when you know the market you want but not each exchange's symbol format. It queries the Instruments Metadata API with normalized criteria and returns the correct exchange-specific id for each requested exchange, ready to pass to replay, streaming, or raw data feeds.
The optional selector defaults to id. Pass datasetId only when you need symbols for direct CSV dataset file downloads:
Returned id symbols are exchange-provided IDs and are not normalized by the client. Returned datasetId symbols are CSV dataset IDs for instruments whose symbols appear in exported dataset metadata; downloadDatasets() URL-encodes them when constructing dataset URLs.
Last updated
Was this helpful?
