{ "info": { "author": "Thad", "author_email": "thad@tardis.dev", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7" ], "description": "# tardis-client\n\n[![PyPi](https://img.shields.io/pypi/v/tardis-client.svg)](https://pypi.org/project/tardis-client/)\n[![Python](https://img.shields.io/pypi/pyversions/tardis-client.svg)](https://pypi.org/project/tardis-client/)\n\"Code\n\nPython client for [tardis.dev](https://tardis.dev) - historical tick-level cryptocurrency market data replay API.\nProvides fast, high level and developer friendly wrapper for more low level [HTTP API](https://docs.tardis.dev/api#http-api) with local file based caching build in.\n\n## Installation\n\nRequires Python 3.7.0+ installed.\n\n```sh\npip install tardis-client\n```\n\n## Usage\n\n```python\nimport asyncio\nfrom tardis_client import TardisClient, Channel\n\nasync def replay():\n tardis_client = TardisClient()\n\n # replay method returns Async Generator\n # https://rickyhan.com/jekyll/update/2018/01/27/python36.html\n messages = tardis_client.replay(\n exchange=\"bitmex\",\n from_date=\"2019-06-01\",\n to_date=\"2019-06-02\",\n filters=[Channel(name=\"trade\", symbols=[\"XBTUSD\",\"ETHUSD\"]), Channel(\"orderBookL2\", [\"XBTUSD\"])],\n )\n\n # this will print all trades and orderBookL2 messages for XBTUSD\n # and all trades for ETHUSD for bitmex exchange\n # between 2019-06-01T00:00:00.000Z and 2019-06-02T00:00:00.000Z (whole first day of June 2019)\n async for local_timestamp, message in messages:\n # local timestamp is a Python datetime that marks timestamp when given message has been received\n # message is a message object as provided by exchange real-time stream\n print(message)\n\nasyncio.run(replay())\n```\n\n## API\n\n`tardis-client` package provides `TardisClient` and `Channel` classes.\n\n```python\nfrom tardis_client import TardisClient, Channel\n```\n\n### TardisClient\n\nOptional client constructor parameters.\n\n| name | type | default value | description |\n| ---------------------- | -------- | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `api_key` (optional) | `string` | `\"\"` | optional `string` containing API key for [tardis.dev](https://tardis.dev) API. If not provided only first day of each month of data is accessible (free access) |\n| `cache_dir` (optional) | `string` | `/.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. |\n\nExample:\n\n```python\n# creates new client instance with access only to sample data (first day of each month)\ntardis_client = TardisClient()\n\n# creates new client with access to all data for given API key\ntardis_client = TardisClient(api_key=\"YOUR_API_KEY\")\n\n# creates new client with custom cache dir\ntardis_client = TardisClient(cache_dir=\"./cache\")\n```\n\n- ### `tardis_client.clear_cache()`\n\n Removes local file cache dir and it's contents.\n\n Example:\n\n ```python\n tardis_client = TardisClient()\n\n tardis_client.clear_cache()\n ```\n\n- ### `tardis_client.replay(exchange, from_date, to_date, filters=[])`\n\n Replays historical market data messages for given replay arguments.\n\n Returns [Async Generator](https://rickyhan.com/jekyll/update/2018/01/27/python36.html) with named tuples (`namedtuple(\"Response\", [\"local_timestamp\", \"message\"])`).\n\n - `local_timestamp` is a Python datetime object specyfying when message has been received from the exchange real-time data feed.\n\n - `message` is Python dict with parsed JSON that has exactly the same format as message provided by particular exchange's real-time data feed.\n\n #### `replay` method parameters:\n\n | name | type | default value | description |\n | -------------------- | --------------------------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n | `exchange` | `string` | - | requested exchange name - see [allowed exchanges](https://github.com/tardis-dev/python-client/blob/master/tardis_client/consts.py#L1) list |\n | `from_date` | `string` | - | requested UTC start date of data feed - [valid ISO date string](https://docs.python.org/3/library/datetime.html#datetime.date.fromisoformat), eg: `2019-04-05` or `2019-05-05T00:00:00` |\n | `to_date` | `string` | - | requested UTC end date of data feed - [valid ISO date string](https://docs.python.org/3/library/datetime.html#datetime.date.fromisoformat), eg: `2019-04-05` or `2019-05-05T00:00:00` |\n | `filters` (optional) | [`List[Channel]`](#channel-class) | [] | optional filters of requested data feed. Use [/exchanges/:exchange](https://docs.tardis.dev/api#exchanges-exchange) API call to get allowed channel names and symbols for requested exchange |\n\n ##### `Channel` class\n\n `Channel` class constructor parameters.\n\n | name | type | description |\n | --------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |\n | `name` | `string` | Use [/exchanges/:exchange](https://docs.tardis.dev/api#exchanges-exchange) API call to get allowed channel names and symbols for requested exchange |\n | `symbols` | `List[string]` | Use [/exchanges/:exchange](https://docs.tardis.dev/api#exchanges-exchange) API call to get allowed channel names and symbols for requested exchange |\n\n ```python\n Channel(name=\"trade\", symbols=[\"XBTUSD\",\"ETHUSD\"])\n Channel(\"orderBookL2\", [\"XBTUSD\"])\n ```\n\n## FAQ\n\n#### How to debug it if something went wrong?\n\n`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.\n\n#### Where can I find more details about tardis.dev API?\n\nCheck out [API docs](https://docs.tardis.dev/api).\n\n## License\n\nMPL-2.0\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/tardis-dev/python-client", "keywords": "cryptocurrency data feed,market data,api client,orderbook,crypto markets data replay,historical data,historical cryptocurrency prices,cryptocurrency api", "license": "MPL-2.0", "maintainer": "Thad", "maintainer_email": "thad@tardis.dev", "name": "tardis-client", "package_url": "https://pypi.org/project/tardis-client/", "platform": "", "project_url": "https://pypi.org/project/tardis-client/", "project_urls": { "Homepage": "https://github.com/tardis-dev/python-client" }, "release_url": "https://pypi.org/project/tardis-client/1.2.1/", "requires_dist": [ "aiohttp (>=3.5,<4.0)", "aiofiles (>=0.4.0,<0.5.0)", "sortedcontainers (>=2.1,<3.0)" ], "requires_python": ">=3.7", "summary": "Python client for tardis.dev - historical tick-level cryptocurrency market data replay API.", "version": "1.2.1" }, "last_serial": 5835827, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "af93901b84013b89231f0596cd4d1834", "sha256": "ef3a609dcf0fbc38185ffb2f5c2436724f96aab7b2a729ba2a01753d16879d67" }, "downloads": -1, "filename": "tardis_client-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "af93901b84013b89231f0596cd4d1834", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7", "size": 14012, "upload_time": "2019-08-22T12:53:52", "url": "https://files.pythonhosted.org/packages/45/77/7c73a469c7d7b68f336cfe576a20b976063aa4f82dec99151192ff5710f3/tardis_client-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4f71d4843cc3aa57da215dd9b7628398", "sha256": "f3fb9dd790cbea0a524ddb0d8a9c31d324f0c5124826be4ac20f1e6125e5430c" }, "downloads": -1, "filename": "tardis-client-0.1.0.tar.gz", "has_sig": false, "md5_digest": "4f71d4843cc3aa57da215dd9b7628398", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 12483, "upload_time": "2019-08-22T12:53:50", "url": "https://files.pythonhosted.org/packages/d9/a4/10347634807196310a086bb53bd0faacc0f3a1b2a67972d5ed2bb9a41620/tardis-client-0.1.0.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "9ee8edfa7d30885f614a73b688001e0e", "sha256": "d78c5417c66e2e9b1cbbc7cb3eb7d8f876216456a70af9e321717cc9efb492d1" }, "downloads": -1, "filename": "tardis_client-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "9ee8edfa7d30885f614a73b688001e0e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7", "size": 15740, "upload_time": "2019-08-23T09:11:21", "url": "https://files.pythonhosted.org/packages/b8/93/9425ec963bf44aafe263f038cd681044be292823cf57bf616cbb941afcbf/tardis_client-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a006d4fc778b7bdd126390b0b1b2d667", "sha256": "e5ce5a81f49f5275b4884f6dc0d29e1b41d3ce98d71633dc2f9bafecce578283" }, "downloads": -1, "filename": "tardis-client-1.0.0.tar.gz", "has_sig": false, "md5_digest": "a006d4fc778b7bdd126390b0b1b2d667", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 16003, "upload_time": "2019-08-23T09:11:20", "url": "https://files.pythonhosted.org/packages/06/62/fd519aae25a70f895fc25b1c22569b902abcf8335487099b07a00ec273f1/tardis-client-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "e5485aaf77ba71636051ed1c3ab52a8f", "sha256": "1e06d535b4a8fa8913d3fcab6b69ae34e8521e68eeb6a7d2665ca42a1c915c49" }, "downloads": -1, "filename": "tardis_client-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e5485aaf77ba71636051ed1c3ab52a8f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7", "size": 15798, "upload_time": "2019-08-23T18:12:15", "url": "https://files.pythonhosted.org/packages/e6/c8/789d89690cdee4566e1448fecd697d7d34d5e8cdcf54128e24740d4f6d47/tardis_client-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "622719bd1e6557d2750d58acd2f4d646", "sha256": "f7e1eff9432f810e509b90f67d359dd3cce7ad8561b5d7a56b572e270fdcb21b" }, "downloads": -1, "filename": "tardis-client-1.1.0.tar.gz", "has_sig": false, "md5_digest": "622719bd1e6557d2750d58acd2f4d646", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 16056, "upload_time": "2019-08-23T18:12:13", "url": "https://files.pythonhosted.org/packages/79/c9/d89fb51650ce26f376e4f6070a89faa328baaed84aded35201e954ca1727/tardis-client-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "0220ced51866a2327433cd96039b0a84", "sha256": "4ca4ffa28dabb9781c46b0c3f943f18a17a6d825affbdeae02c7814f3fdb2be1" }, "downloads": -1, "filename": "tardis_client-1.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "0220ced51866a2327433cd96039b0a84", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7", "size": 18843, "upload_time": "2019-08-27T11:59:35", "url": "https://files.pythonhosted.org/packages/26/05/dc142fa67186f3cea50a905bf0b0aba5c9ca1782ea14b3a4f2c57209f002/tardis_client-1.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "52309597623c9a92613f79675e00386c", "sha256": "586320173d9b4cd490f7e1170038d5b59a28345e9d00a2f9264f90dae0eb9d1a" }, "downloads": -1, "filename": "tardis-client-1.2.0.tar.gz", "has_sig": false, "md5_digest": "52309597623c9a92613f79675e00386c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 18146, "upload_time": "2019-08-27T11:59:33", "url": "https://files.pythonhosted.org/packages/d0/9c/97373192d7bf445eb2a857cb6782eb1ece87e67f9160b36af0b168a974bd/tardis-client-1.2.0.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "79a25e438cb4ef5f214dc004ea7398af", "sha256": "78d5d1fffa023eabe30f51e80bee85d75ad59b0392d65aa578fdc92e79bd31a7" }, "downloads": -1, "filename": "tardis_client-1.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "79a25e438cb4ef5f214dc004ea7398af", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7", "size": 18996, "upload_time": "2019-09-16T12:15:02", "url": "https://files.pythonhosted.org/packages/67/29/e5469eb0ae6d86062598d386f6fc0fa75c396e6fd394407e7498332ebb32/tardis_client-1.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3b18ae3995f80ed52b1a213fdf69b276", "sha256": "c1ecd95245c454d22e06dc0068fdd9217c208deccb18e3bb7c230aa4c03d2c6d" }, "downloads": -1, "filename": "tardis-client-1.2.1.tar.gz", "has_sig": false, "md5_digest": "3b18ae3995f80ed52b1a213fdf69b276", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 18321, "upload_time": "2019-09-16T12:15:00", "url": "https://files.pythonhosted.org/packages/8b/fe/e73bdd6c45b596a180b7b18d8099b4e19288cc98edfba8ccb74cbb946e17/tardis-client-1.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "79a25e438cb4ef5f214dc004ea7398af", "sha256": "78d5d1fffa023eabe30f51e80bee85d75ad59b0392d65aa578fdc92e79bd31a7" }, "downloads": -1, "filename": "tardis_client-1.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "79a25e438cb4ef5f214dc004ea7398af", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7", "size": 18996, "upload_time": "2019-09-16T12:15:02", "url": "https://files.pythonhosted.org/packages/67/29/e5469eb0ae6d86062598d386f6fc0fa75c396e6fd394407e7498332ebb32/tardis_client-1.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3b18ae3995f80ed52b1a213fdf69b276", "sha256": "c1ecd95245c454d22e06dc0068fdd9217c208deccb18e3bb7c230aa4c03d2c6d" }, "downloads": -1, "filename": "tardis-client-1.2.1.tar.gz", "has_sig": false, "md5_digest": "3b18ae3995f80ed52b1a213fdf69b276", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 18321, "upload_time": "2019-09-16T12:15:00", "url": "https://files.pythonhosted.org/packages/8b/fe/e73bdd6c45b596a180b7b18d8099b4e19288cc98edfba8ccb74cbb946e17/tardis-client-1.2.1.tar.gz" } ] }