Skip to content

Instantly share code, notes, and snippets.

@thaaddeus
Created October 26, 2020 13:21
Show Gist options
  • Save thaaddeus/cdb2078e6429696926cd35cc2440d022 to your computer and use it in GitHub Desktop.
Save thaaddeus/cdb2078e6429696926cd35cc2440d022 to your computer and use it in GitHub Desktop.
# pip install tardis-client
import asyncio
from tardis_client import TardisClient, Channel
tardis_client = TardisClient(api_key="YOUR_API_KEY")
async def replay():
messages = tardis_client.replay(
exchange="binance-futures",
from_date="2020-10-01",
to_date="2020-10-02",
filters=[Channel(name="aggTrade", symbols=["btcusdt"])]
)
# messages as provided by Binance USDT Futures real-time stream
async for local_timestamp, message in messages:
# for the sake of example, just print the message
# you can add the code here to map the message to different shape and save it
print(message)
asyncio.run(replay())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment