Python client for tardis.dev - historical tick-level cryptocurrency market data replay API.
Project description
tardis-dev
Python tardis-dev package provides convenient access to tick-level historical cryptocurrency market data in exchange-native format. It focuses on two primary workflows: replaying historical market data and downloading historical market data as CSV files. If you need normalized replay or real-time streaming, use the Node.js client or Tardis Machine.
replay() accepts ISO date strings or Python datetime values. Naive datetimes are treated as UTC.
import asyncio
from tardis_dev import Channel, replay
async def main():
async for local_timestamp, message in replay(
exchange="binance",
from_date="2024-03-01",
to_date="2024-03-02",
filters=[Channel("trade", ["btcusdt"]), Channel("depth", ["btcusdt"])],
api_key="YOUR_API_KEY",
):
print(local_timestamp, message)
asyncio.run(main())
Features
- historical tick-level market data replay backed by Tardis.dev HTTP API
- support for many cryptocurrency exchanges — see docs.tardis.dev for the full list
Installation
Requires Python 3.9+ installed.
pip install tardis-dev
Documentation
See official docs
Examples
Replay historical market data
import asyncio
from tardis_dev import Channel, replay
async def main():
async for local_timestamp, message in replay(
exchange="binance",
from_date="2024-03-01",
to_date="2024-03-02",
filters=[Channel("trade", ["btcusdt"]), Channel("depth", ["btcusdt"])],
):
print(local_timestamp, message)
asyncio.run(main())
Download CSV datasets
from tardis_dev import download_datasets
download_datasets(
exchange="binance",
data_types=["trades", "incremental_book_L2"],
symbols=["BTCUSDT"],
from_date="2024-03-01",
to_date="2024-03-02",
api_key="YOUR_API_KEY",
)
Migration from tardis-client
This package is the v3 API. Existing tardis-client and tardis_dev.datasets.download() users should migrate to the new top-level functions:
- replay:
TardisClient().replay(...)->replay(...) - datasets:
from tardis_dev import datasets; datasets.download(...)->from tardis_dev import download_datasets - cache cleanup:
tardis_client.clear_cache()->clear_cache()
See Migration Notice for the full migration guide.
See the tardis-dev docs for more examples.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tardis_dev-3.1.0.tar.gz.
File metadata
- Download URL: tardis_dev-3.1.0.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.9.25 Linux/6.17.0-1008-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c9aa14b9558f4a73ab9eefeaefa3918cf94a9f8ecec41bbec6db6f0bb5b8236
|
|
| MD5 |
382a7d84ef40b5d252eb8c2f285dc854
|
|
| BLAKE2b-256 |
d356a2db0ded1b1fa4414acdc6e692ec9327b4df64af7a9eb5de5d51cb5feda7
|
File details
Details for the file tardis_dev-3.1.0-py3-none-any.whl.
File metadata
- Download URL: tardis_dev-3.1.0-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.9.25 Linux/6.17.0-1008-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8735db2eb86714665d6e60edd426067bd01f35fdb88712529a1c6295d5b67ec1
|
|
| MD5 |
d24489ddbb02a6f3e5f0a544a05d879d
|
|
| BLAKE2b-256 |
41955a4ae1dba68d6a858c92fa6a98632637de6cf69feeda8587fae210c79a7b
|