Getting Started

Overview

Tardis-machinearrow-up-right is a locally runnable server with built-in data caching that uses Tardis.dev HTTP API under the hood. It provides both tick-level historical and consolidated real-time cryptocurrency market data via its HTTP and WebSocket APIs and is available via npm and Docker.

circle-info

Real-time streaming via tardis-machine is available only in normalized format. Exchange-native (raw) real-time data is not provided. If you need raw real-time feeds, connect directly to exchange WebSocket APIs.

Installation

Docker

Pull and run latest version of tardisdev/tardis-machine imagearrow-up-right:

Tardis-machine server's HTTP endpoints will be available on port 8000 and WebSocket API endpoints on port 8001. Your API key will be passed via environment variable (TM_API_KEY) — simply replace YOUR_API_KEY with the API key you've received via email.

The command above does not use persistent volumes for local caching (each Docker restart will result in losing local data cache). To use ./host-cache-dir as a persistent volume (bind mountarrow-up-right) cache directory, run:

Since using volumes can cause issues especially on Windows, it's fine to run Docker image without them with the caveat of potentially poor local cache ratio after each container's restart.

Config environment variables

You can set the following environment variables to configure tardis-machine server:

name
default
description

TM_API_KEY

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

TM_PORT

8000

HTTP port on which server will be running, WebSocket port is always this value + 1 (8001 with port set to 8000)

TM_CACHE_DIR

/.cache

path to local dir that will be used as cache location

TM_CLUSTER_MODE

false

will launch cluster of Node.js processesarrow-up-right to handle the incoming requests if set to true, by default server runs in single process mode

TM_DEBUG

false

server will print verbose debug logs to stdout if set to true

TM_CLEAR_CACHE

false

server will clear local cache dir on startup if set to true

circle-info

The local cache grows without limit by default. For large backfills this can consume significant disk space. Use TM_CLEAR_CACHE=true to clear the cache on startup, or set autoCleanup: true in replay options to remove cached data after each replay completes. See the replay options section for autoCleanup concurrency caveats.

Tardis-machine also supports exchange-specific environment variables (exchange credentials, proxy, WebSocket URL overrides, Binance rate limit tuning) — see the Node.js client environment variables for the full list.

npm

circle-info

Requires Node.js v12+ and git installed.

Install and runtardis-machine server via npx command:

or install globally via npm:

and then run:

Tardis-machine server's HTTP endpoints will be available on port 8000 and WebSocket API endpoints on port 8001. Your API key will be passed via --api-key config flag — simply replace YOUR_API_KEY with API key you've received via email.

CLI config flags

circle-info

You can configure tardis-machine server via environment variables as described in Docker section as well.

You can set following CLI config flags when starting tardis-machine server installed via npm:

name
default
description

--api-key

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

--port

8000

HTTP port on which server will be running, WebSocket port is always this value + 1 (8001 with port set to 8000)

--cache-dir

<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

--cluster-mode

false

will launch cluster of Node.js processesarrow-up-right to handle the incoming requests if set to true, by default server runs in single process mode

--debug

false

server will print verbose debug logs to stdout if set to true

--clear-cache

false

server will clear local cache dir on startup is set to true

--help

shows CLI help

--version

shows tardis-machine version number

Quick examples

Historical normalized replay

See Replaying Historical Data for exchange-native replay, normalized replay over HTTP and WebSocket, and full replay options.

Real-time normalized streaming

See Streaming Real-Time Data for full stream options, multi-exchange streaming, timeout tuning, and error messages.

Last updated