All Projects → tardis-dev → tardis-python

tardis-dev / tardis-python

Licence: MPL-2.0 license
Python client for tardis.dev - historical tick-level cryptocurrency market data replay API.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to tardis-python

crypto-websocket-extensions
🧰 Unified and optimized data structures across cryptocurrency exchanges
Stars: ✭ 31 (-64.77%)
Mutual labels:  orderbook, orderbook-tick-data
robotframework-historic
Robotframework-historic is a free, custom html report which provides historical robotframework execution results by storing execution results info in MySQL database and generate's html reports (charts / statistics) from database using Flask.
Stars: ✭ 70 (-20.45%)
Mutual labels:  historical-data
IPASN-History
IP ASN History to find ASN announcing an IP and the closest prefix announcing it at a specific date
Stars: ✭ 76 (-13.64%)
Mutual labels:  historical-data
wetterdienst
Open weather data for humans
Stars: ✭ 190 (+115.91%)
Mutual labels:  historical-data
nse2r
Fetch data from National Stock Exchange, India
Stars: ✭ 21 (-76.14%)
Mutual labels:  historical-data
pystocklib
Python library to Fetch & Analyze Stock Market data.
Stars: ✭ 23 (-73.86%)
Mutual labels:  historical-data
bitmex-orderbook
The fastest order book implementation for the BitMEX WebSocket API.
Stars: ✭ 73 (-17.05%)
Mutual labels:  orderbook
bexhill-osm
A local mapping project using data from OpenStreetMap. Includes overlays, walking directions and historical information.
Stars: ✭ 16 (-81.82%)
Mutual labels:  historical-data
okama
Investment portfolio and stocks analyzing tools for Python with free historical data
Stars: ✭ 87 (-1.14%)
Mutual labels:  historical-data
heurist
Core development repository. gitHub: Vsn 6 (2020 - ), Vsn 5 (2018 - 2020), Vsn 4 (2014-2017). Sourceforge: Vsn 3 (2009-2013), Vsn 1 & 2 (2005-2009)
Stars: ✭ 39 (-55.68%)
Mutual labels:  historical-data
mftool
Python library for getting real-time Mutual Funds data in India
Stars: ✭ 76 (-13.64%)
Mutual labels:  historical-data
NSEDownload
Python Library to get historical, adjusted data and generate trailing returns of stocks and indices on the NSE
Stars: ✭ 65 (-26.14%)
Mutual labels:  historical-data
data-jp-covid19-vaccination
This is an unofficial repository of CSVs extracted from the Excel files posted on the Prime Minister of Japan website. Auto-updated.
Stars: ✭ 24 (-72.73%)
Mutual labels:  historical-data
yahoo-historical
Downloads historical EOD (end of day) prices from yahoo finance
Stars: ✭ 96 (+9.09%)
Mutual labels:  historical-data
tvdatafeed
A simple TradingView historical Data Downloader
Stars: ✭ 189 (+114.77%)
Mutual labels:  historical-data
soccer-bookmaker-odds
Historical data of bookmaker odds for some of the major soccer European leagues.
Stars: ✭ 16 (-81.82%)
Mutual labels:  historical-data
FinanceMarketDataGrabber
Use Yahoo Finance or Google's 'hidden' Finance APIs to retrieve current stock and forex data as well as historic quotes
Stars: ✭ 42 (-52.27%)
Mutual labels:  historical-data
fiware-sth-comet
A component of the FIWARE ecosystem in charge of managing historical and aggregated time series context information
Stars: ✭ 22 (-75%)
Mutual labels:  historical-data
MQL5-JSON-API
Metaquotes MQL5 - JSON - API
Stars: ✭ 183 (+107.95%)
Mutual labels:  historical-data
Finance-Robinhood
Trade stocks and ETFs with free brokerage Robinhood and Perl
Stars: ✭ 42 (-52.27%)
Mutual labels:  historical-data

tardis-client

PyPi Python Code style: black

Python client for tardis.dev - historical tick-level cryptocurrency market data replay API. Provides fast, high level and developer friendly wrapper for more low level HTTP API with local file based caching build in.

Installation

Requires Python 3.7.0+ installed.

pip install tardis-client

Usage

import asyncio
from tardis_client import TardisClient, Channel

async def replay():
    tardis_client = TardisClient()

    # replay method returns Async Generator
    # https://rickyhan.com/jekyll/update/2018/01/27/python36.html
    messages = tardis_client.replay(
        exchange="bitmex",
        from_date="2019-06-01",
        to_date="2019-06-02",
        filters=[Channel(name="trade", symbols=["XBTUSD","ETHUSD"]), Channel("orderBookL2", ["XBTUSD"])],
    )

    # this will print all trades and orderBookL2 messages for XBTUSD
    # and all trades for ETHUSD for bitmex exchange
    # between 2019-06-01T00:00:00.000Z and 2019-06-02T00:00:00.000Z (whole first day of June 2019)
    async for local_timestamp, message in messages:
        # local timestamp is a Python datetime that marks timestamp when given message has been received
        # message is a message object as provided by exchange real-time stream
        print(message)

asyncio.run(replay())

Try on repl.it

API

tardis-client package provides TardisClient and Channel classes.

from tardis_client import TardisClient, Channel

TardisClient

Optional client constructor parameters.

name type default value description
api_key (optional) string "" optional string containing API key for tardis.dev API. If not provided only first day of each month of data is accessible (free access)
cache_dir (optional) string <os.tmpdir>/.tardis-cache optional string with path to local dir that will be used as cache location. If not provided default temp dir for given OS will be used.

Example:

# creates new client instance with access only to sample data (first day of each month)
tardis_client = TardisClient()

# creates new client with access to all data for given API key
tardis_client = TardisClient(api_key="YOUR_API_KEY")

# creates new client with custom cache dir
tardis_client = TardisClient(cache_dir="./cache")
  • tardis_client.clear_cache()

    Removes local file cache dir and it's contents.

    Example:

    tardis_client = TardisClient()
    
    tardis_client.clear_cache()
  • tardis_client.replay(exchange, from_date, to_date, filters=[])

    Replays historical market data messages for given replay arguments.

    Returns Async Generator with named tuples (namedtuple("Response", ["local_timestamp", "message"])).

    • local_timestamp is a Python datetime object specyfying when message has been received from the exchange real-time data feed.

    • message is Python dict with parsed JSON that has exactly the same format as message provided by particular exchange's real-time data feed.

      replay method parameters:

      name type default value description
      exchange string - requested exchange name - Use /exchanges API call to get allowed exchanges ids
      from_date string - requested UTC start date of data feed - valid ISO date string, eg: 2019-04-05 or 2019-05-05T00:00:00
      to_date string - requested UTC end date of data feed - valid ISO date string, eg: 2019-04-05 or 2019-05-05T00:00:00
      filters (optional) List[Channel] [] optional filters of requested data feed. Use /exchanges/:exchange API call to get allowed channel names and symbols for requested exchange
      Channel class

      Channel class constructor parameters.

      name type description
      name string Use /exchanges/:exchange API call to get allowed channel names and symbols for requested exchange
      symbols List[string] Use /exchanges/:exchange API call to get allowed channel names and symbols for requested exchange
      Channel(name="trade", symbols=["XBTUSD","ETHUSD"])
      Channel("orderBookL2", ["XBTUSD"])

FAQ

How to debug it if something went wrong?

tardis-client uses Python logging on DEBUG level for that purpose. In doubt please create issue in this repository with steps how to reproduce the issue.

Where can I find more details about tardis.dev API?

Check out API docs.

License

MPL-2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].