Package: tardis-dev
tardis-clientPython client fortardis.dev- historical tick-level cryptocurrency market data replay API.
Provides fast, high level and developer friendly wrapper for more low levelHTTP APIwith local file based caching build in.InstallationRequires Python 3.7.0+ installed.pipinstalltardis-clientUsageimportasynciofromtardis_clientimportTardisClient,Channelasyncdefreplay():tardis_client=TardisClient()# replay method returns Async Generator# https://rickyhan.com/jekyll/update/2018/01/27/python36.htmlmessages=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)asyncforlocal_timestamp,messageinmessages:# 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 streamprint(message)asyncio.run(replay())APItardis-clientpackage providesTardisClientandChannelclasses.fromtardis_clientimportTardisClient,ChannelTardisClientOptional client constructor parameters.nametypedefault valuedescriptionapi_key(optional)string""optionalstringcontaining API key fortardis.devAPI. If not provided only first day of each month of data is accessible (free access)cache_dir(optional)string<os.tmpdir>/.tardis-cacheoptionalstringwith path to local dir that will be used as cache location. If not provided defaulttempdir 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 keytardis_client=TardisClient(api_key="YOUR_API_KEY")# creates new client with custom cache dirtardis_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.ReturnsAsync Generatorwith named tuples (namedtuple("Response", ["local_timestamp", "message"])).local_timestampis a Python datetime object specyfying when message has been received from the exchange real-time data feed.messageis Python dict with parsed JSON that has exactly the same format as message provided by particular exchange's real-time data feed.replaymethod parameters:nametypedefault valuedescriptionexchangestring-requested exchange name - seeallowed exchangeslistfrom_datestring-requested UTC start date of data feed -valid ISO date string, eg:2019-04-05or2019-05-05T00:00:00to_datestring-requested UTC end date of data feed -valid ISO date string, eg:2019-04-05or2019-05-05T00:00:00filters(optional)List[Channel][]optional filters of requested data feed. Use/exchanges/:exchangeAPI call to get allowed channel names and symbols for requested exchangeChannelclassChannelclass constructor parameters.nametypedescriptionnamestringUse/exchanges/:exchangeAPI call to get allowed channel names and symbols for requested exchangesymbolsList[string]Use/exchanges/:exchangeAPI call to get allowed channel names and symbols for requested exchangeChannel(name="trade",symbols=["XBTUSD","ETHUSD"])Channel("orderBookL2",["XBTUSD"])FAQHow to debug it if something went wrong?tardis-clientuses Python logging onDEBUGlevel 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 outAPI docs.LicenseMPL-2.0