{ "info": { "author": "Alejandro Escontrela,James Hogan", "author_email": "alejandroescontrela@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# CoinMarketCap history scraper\n***\n\n## Contents\n* [Installation](#installation)\n* [Usage](#usahe)\n * [Command Line](#command-line)\n * [Usage](#command-line-usage)\n * [Examples](#command-line-examples)\n * [Module]()\n * [Sequential]\n\nObtain [CoinMarketCap](http://www.coinmarketcap.com) [USD price history](https://coinmarketcap.com/currencies/bitcoin/historical-data/) data for CoinMarketCap-listed cryptocurrencies in CSV format.\n\nUse this library as a command-line script to obtain historical cryptocurrency data on the fly, or import the library to obtain cryptocurrency data for your programs. \n\n\n## Installation\nDownload the zip file or navigate to the desired install directory and run:\n\n```shell\n$ git clone https://github.com/Alescontrela/coinmarketcap-history.git\n```\n\nTo install the required dependencies, navigate into the repo and run:\n\n```shell\n$ pip install -r requirements.txt\n```\n\n\n\n## Usage\n\n### Command Line\nAmong other things, this is useful for US tax reporting. If you want to know the cost basis for a trade (or for coins acquired through mining), the IRS requires you to denominate that cost basis in USD. In the case of token-for-token trades (e.g. purchasing ETH with BTC), that requires you know the USD:BTC exchange rate at the time of the trade.\n\nSurprisingly, as of October 2017, it's not easy to get this data in a machine-readable format anywhere online.\n\nRather than getting the exchange rate at the exact moment of your trade, which is generally not feasible, the IRS standard (at least for similar situations w/stock) is to use the average of a stock's high and low price for the day. CoinMarketCap doesn't provide this figure, but this tool calculates this number and includes it in the output.\n\n#### Command Line Usage\n\nIn the terminal, navigate into the repo directory and run:\n```shell\n$ python coinmarketcap.py \n```\nwhere:\n\n* `currency` is the (case-insensitive) name of the currency / token as displayed on CoinMarketCap, with dashes in place of spaces\n* `start_date` is the beginning of the range to fetch data for in `yyyy-mm-dd` format. For example, 2017-10-01 (for 2017 October 10th)\n* `end_year` is the end of the range to fetch data for in `yyyy-mm-dd` format. You may use a date in the future to obtain the latest data. Format is the same as in the start date.\n\nData for multiple cryptocurrencies can be obtained with:\n```shell\n$ python coinmarketcap.py \n```\n**Note:** currencies must be comma-separated, with no spaces in between.\n\nThe above information can also be found by running:\n```shell\n$ python coinmarketcap.py -h\n```\n\nWrite outputs to a file by running:\n\n```shell\n$ coinmarketcap.py > \n```\n\n#### Command Line Examples\nCollecting data for one cryptocurrency:\n```shell\n$ python coinmarketcap.py bitcoin 2017-01-01 2017-12-31\n```\n\nCollecting data for multiple cryptocurrencies:\n```shell\n$ python coinmarketcap.py bitcoin,ripple,ethereum 2017-01-01 2017-12-31\n```\n\nWriting output to a file:\n```shell\n$ python coinmarketcap.py bitcoin 2017-01-01 2017-12-31 > bitcoin_prices.csv\n```\n\nWriting output for multiple cryptocurrencies to a file:\n```shell\n$ python coinmarketcap.py bitcoin,ripple,ethereum 2017-01-01 2017-12-31 > bitcoin_ripple_ethereum_prices.csv\n```\n\n## Module\n\nYou can also use `coinmarketcap.py` as a module in other python modules to get back a pandas dataframe with a cryptocurrency's history.\n\nFirst, you may need to add the path to `coinmarketcap_usd_history.py` in your `sys.path` through a command like the following: \n\n```python\nsys.path.append()\n```\n\n(Alternatively, just move the `coinmarketcap_usd_history.py` file to the directory of the including module.)\n\nSecond, import the module:\n\n```import coinmarketcap_usd_history```\n\nFinally perform this to obtain the dataframe:\n\n```python\ndf = coinmarketcap_usd_history.main(['bitcoin','2017-01-01','2017-12-31','--dataframe'])\n```\n\nIf you just wish to have the CSV output returned as a string to another python module, simply omit the `'--dataframe'` parameter.\n\n\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/Alescontrela/coinmarketcap-history", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "cmctestingthree", "package_url": "https://pypi.org/project/cmctestingthree/", "platform": "", "project_url": "https://pypi.org/project/cmctestingthree/", "project_urls": { "Homepage": "https://github.com/Alescontrela/coinmarketcap-history" }, "release_url": "https://pypi.org/project/cmctestingthree/0.0.1/", "requires_dist": null, "requires_python": "", "summary": "Get the price history for CoinMarketCap-listed currencies", "version": "0.0.1" }, "last_serial": 4037095, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "2187b33c1320943550ada49ced1a87fc", "sha256": "69d8bd637a1c1e806486f81e20e485882d2c715037bca27ecb8d0793c8793146" }, "downloads": -1, "filename": "cmctestingthree-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "2187b33c1320943550ada49ced1a87fc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8351, "upload_time": "2018-07-06T17:12:34", "url": "https://files.pythonhosted.org/packages/cd/ab/824ab3a6f2ff71e98547328e147c749772a537b299de2feec3c87d474f4b/cmctestingthree-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7224fcfc82277c69ad2a8bd0b10132e9", "sha256": "6306d276501d4dc599e4a14414812abf805104cd6952df2beb3b9713e232f3ec" }, "downloads": -1, "filename": "cmctestingthree-0.0.1.tar.gz", "has_sig": false, "md5_digest": "7224fcfc82277c69ad2a8bd0b10132e9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7369, "upload_time": "2018-07-06T17:12:35", "url": "https://files.pythonhosted.org/packages/a7/bc/469b726e4ed36c8087c6b6bf6bab2530c8ac6a736b0dacfc57589e29041c/cmctestingthree-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2187b33c1320943550ada49ced1a87fc", "sha256": "69d8bd637a1c1e806486f81e20e485882d2c715037bca27ecb8d0793c8793146" }, "downloads": -1, "filename": "cmctestingthree-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "2187b33c1320943550ada49ced1a87fc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8351, "upload_time": "2018-07-06T17:12:34", "url": "https://files.pythonhosted.org/packages/cd/ab/824ab3a6f2ff71e98547328e147c749772a537b299de2feec3c87d474f4b/cmctestingthree-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7224fcfc82277c69ad2a8bd0b10132e9", "sha256": "6306d276501d4dc599e4a14414812abf805104cd6952df2beb3b9713e232f3ec" }, "downloads": -1, "filename": "cmctestingthree-0.0.1.tar.gz", "has_sig": false, "md5_digest": "7224fcfc82277c69ad2a8bd0b10132e9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7369, "upload_time": "2018-07-06T17:12:35", "url": "https://files.pythonhosted.org/packages/a7/bc/469b726e4ed36c8087c6b6bf6bab2530c8ac6a736b0dacfc57589e29041c/cmctestingthree-0.0.1.tar.gz" } ] }