Skip to content

tardis-dev/tardis-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tardis-dev

PyPi Python Code style: black


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



  • support for many cryptocurrency exchanges — see docs.tardis.dev for the full list



Installation

Requires Python 3.9+ installed.

pip install tardis-dev


Documentation



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.

About

Python client for tardis.dev - historical tick-level cryptocurrency market data replay API.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages