with Python

Assumes tardis-machine running on localhost:8000

import asyncio
import aiohttp
import json
import urllib.parse
async def replay_normalized():
timeout = aiohttp.ClientTimeout(total=0)
async with aiohttp.ClientSession(timeout=timeout) as session:
replay_options = {
"exchange": "bitmex",
"from": "2019-12-01",
"to": "2019-12-02",
"symbols": ["XBTUSD"],
"withDisconnectMessages": True,
"apiKey": "<YOUR API KEY>",
# other available data types: eg: 'book_change', 'trade',
# 'book_snapshot_10_100ms', 'derivative_ticker', 'quote',
# 'trade_bar_10ms', 'trade_bar_10s'
"dataTypes": ["book_snapshot_10_0ms"],
# url encode as json object options
encoded_options = urllib.parse.quote_plus(json.dumps(replay_options))
# assumes tardis-machine running on localhost:8000
url = f"http://localhost:8000/replay-normalized?options={encoded_options}"
# returned data is in NDJSON format http://ndjson.org/ streamed
# each line is separate message JSON encoded
# messages formats documented at
# https://docs.tardis.dev/api/tardis-machine#normalized-data-types
async with session.get(url) as response:
# otherwise we may get line to long errors
response.content._high_water = 100_000_000
async for line in response.content:
message = json.loads(line)

More examples coming soon...