{ "info": { "author": "Andreas Isnes Nilsen", "author_email": "andnil94@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "![Coverage](https://img.shields.io/badge/coverage-87%25-yellowgreen.svg)\n![Python](https://img.shields.io/badge/Python-3.7-brightgreen.svg)\n![Version](https://img.shields.io/badge/Version-0.4-brightgreen.svg)\n![License](https://img.shields.io/badge/License-MIT-green.svg)\n\n# CoinMarketCap\nA Python implementation of CoinMarketCap's V1 API.\n\nYou need an API key from CoinMarketCap in order to utilize this module, you can get a key from [here](https://coinmarketcap.com/api/). Due the low request rate, I recommend you to test your application in a sandbox environment. You need a different API key when using their sandbox environment, which you can get from [here](https://sandbox.coinmarketcap.com/).\n\n## Installing\n```terminal\npython3 -m pip install CoinMarketCapAPI\n```\n\n## Authentication\nIf no keys are provided during init, the module will look for a JSON file in `$HOME/.coinmarketcap.json`, with the following syntax.\n```json\n{\n \"sandbox\": \"API_KEY\",\n \"production\": \"API_KEY\"\n}\n```\n\nAlternatively, you can set your keys as OS environment variables. With .bashrc, add the following two lines.\n```terminal\nexport COINMARKETCAP_SANDBOX=\"API_KEY\"\nexport COINMARKETCAP_PRODUCTION=\"API_KEY\"\n```\n\n## Examples\nInit client with an API Key.\n```python\nfrom coinmarketcap import Client\n\nkey = \"API_KEY\"\nclient = Client(apikey=key)\n```request limit\n\nThe following example shows how you can access and send a request to each of CoinMarketCap's endpoint (cryptocurrency, exchange, global_metrics, tools). Notice plural and singular method endings. Plurals allow a list of `id`, `symbol` or `slug`, singular allows only a single value.\n\n```python\nfrom coinmarketcap import Client\nfrom datetime import datetime\n\n# Init sandbox client.\nclient = Client(sandbox=True)\n\n# fetch cryptocurrency info\nclient.cryptocurrency.info.symbols([\"BTC\", \"ETH\"])\nclient.cryptocurrency.info.ids(1)\n\n# fetch exchange info\nclient.exchange.info.slugs(\"binance\")\nclient.exchange.info.ids([1, 4])\n\n# fetch global market data\ntime = datetime.strptime(\"2018-12-21\", \"%Y-%m-%d\")\nclient.global_metrics.quotes.latest()\nclient.global_metrics.quotes.historical(time_start=time)\n\namount_1 = 100.4\namount_2 = \"901.23\"\nid = 4\n# convert price historic price\nclient.tools.price.convert_id(amount_1, id, time=time)\nclient.tools.price.convert_symbol(amount_2, \"BTC\", convert=[\"USD\", \"ETH\"])\n```\n\nDue to CoinMarketCap's credit and rate limit system, implementing a proper request throttler is complex. Anyway, I tried to apply three different levels of throttling. \"minute\", \"daily\", \"monthly\". Each level make sure you don't exceed the request limit of the given plan. The different levels have no perception of CoinMarketCap's credit system...\n\n```python \n\nfrom coinmarketcap import Client\n# By default throttling of requests are off.\n# Ignore the Client's keyword arguments \"throttle\", \"plan\", and \"block\" if\n# you don't want the client to throttle requests. \n\n# client_1 will not exceed the number of request each minute with the basic plan.\nclient_1 = Client(throttle=\"minute\", plan=\"basic\")\n\n# client_2 will not exceed the daily request limit.\nclient_2 = Client(throttle=\"daily\", block=True, plan=\"hobbyist\")\n\n# client_3 will never exceeded CoinMarketCap monthly request rate.\nclient_3 = Client(throttle=\"monthly\", block=False, plan=\"professional\")\n\n```\n\nEach request is cached, the expiration time of data can be adjusted with the keyword argument `expire`. Set `expire=0` if don't want any cached data.\n```python\nfrom coinmarketcap import Client\n# cached request will be removed after 1 second\nclient = Client(expire=1)\n\n# cacherd request will be removed after 1 h\nclient = Client(expire=3600)\n\n# To remove all data from the cache, use the method clear_cache\nclient.clear_cache()\n\n```\n\n## TODO\n* Enable Proper throttling of requests.\n* Testing of different python versions.\n\nThis is my first python module. So, I appreciate any feedback :)\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/ani071/coinmarketcap", "keywords": "CoinMarketCap,API", "license": "", "maintainer": "", "maintainer_email": "", "name": "CoinMarketCapAPI", "package_url": "https://pypi.org/project/CoinMarketCapAPI/", "platform": "", "project_url": "https://pypi.org/project/CoinMarketCapAPI/", "project_urls": { "Homepage": "https://github.com/ani071/coinmarketcap" }, "release_url": "https://pypi.org/project/CoinMarketCapAPI/0.5/", "requires_dist": [ "requests-cache", "requests", "ratelimit" ], "requires_python": "", "summary": "Module for fethcing data from CoinMarketCap's v1 API", "version": "0.5" }, "last_serial": 4904982, "releases": { "0.3": [ { "comment_text": "", "digests": { "md5": "9d34bbe19fc3c512e84a62c8e1baa119", "sha256": "955ceb417ec25ce278bb11c9b3c9d61a4956e78092031f76d1add67545fa0445" }, "downloads": -1, "filename": "CoinMarketCapAPI-0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "9d34bbe19fc3c512e84a62c8e1baa119", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17126, "upload_time": "2019-03-05T17:03:25", "url": "https://files.pythonhosted.org/packages/62/41/3d02a10becbe119a28fe5d6c1201b45ea809c656cd6477bcedc3f752806a/CoinMarketCapAPI-0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "265c00f1f61dff1f1f740548a5f72c6a", "sha256": "0365ec46553472fdbc95c26dbd6eaad514c4bb12399d42f1f285471734ea0b1b" }, "downloads": -1, "filename": "CoinMarketCapAPI-0.3.tar.gz", "has_sig": false, "md5_digest": "265c00f1f61dff1f1f740548a5f72c6a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11006, "upload_time": "2019-03-05T17:03:27", "url": "https://files.pythonhosted.org/packages/5a/a0/462ce4cc94efe634603918984dd9e6df5d1c1f7b90e3b1177d19bb78e7c0/CoinMarketCapAPI-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "c4ec6072becd0e142c4cd70070226a7c", "sha256": "864e63486fffde180d4b533d19e7d058e10fcbdf8857ad624b7d679ea866b53a" }, "downloads": -1, "filename": "CoinMarketCapAPI-0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "c4ec6072becd0e142c4cd70070226a7c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17126, "upload_time": "2019-03-05T17:05:02", "url": "https://files.pythonhosted.org/packages/dd/1b/0fb2d49c16c86bb8ea1b171366f650678d2c17c786cc5922449ae5cc82d7/CoinMarketCapAPI-0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6a30f9322c26c6458bf1ce0caa5b8036", "sha256": "078466a33ede0dbf59ca848dd508fff37221469cfae0bf81f8740e679a5099b8" }, "downloads": -1, "filename": "CoinMarketCapAPI-0.4.tar.gz", "has_sig": false, "md5_digest": "6a30f9322c26c6458bf1ce0caa5b8036", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11000, "upload_time": "2019-03-05T17:05:04", "url": "https://files.pythonhosted.org/packages/5e/7f/68bde5e3ef6d7f3449f91e0cc88ae1db79b31c7e8d7167979c593ed038d8/CoinMarketCapAPI-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "694ee4e0d626e77a3fe11fc1381bea4f", "sha256": "754af0534dcccb665f45af1e0733d32ffd2c33640b82b2593b5eb0db7539c5f3" }, "downloads": -1, "filename": "CoinMarketCapAPI-0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "694ee4e0d626e77a3fe11fc1381bea4f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17717, "upload_time": "2019-03-06T11:42:52", "url": "https://files.pythonhosted.org/packages/06/7a/2e48939954ddbb23bcaa88965a99067c2cbb3c851d12a6ca14468cdaf418/CoinMarketCapAPI-0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "778332ec67f1505f3a65987f6e38186b", "sha256": "dfb6db77683abda56e89fe8cc0126c5ca6c067f6f9cf5d4d99208b47463a0775" }, "downloads": -1, "filename": "CoinMarketCapAPI-0.5.tar.gz", "has_sig": false, "md5_digest": "778332ec67f1505f3a65987f6e38186b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11378, "upload_time": "2019-03-06T11:42:54", "url": "https://files.pythonhosted.org/packages/bb/a5/3d3fa508ebee7d3062705aa97405a929bc58b9a91067ffc099d34ca1974b/CoinMarketCapAPI-0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "694ee4e0d626e77a3fe11fc1381bea4f", "sha256": "754af0534dcccb665f45af1e0733d32ffd2c33640b82b2593b5eb0db7539c5f3" }, "downloads": -1, "filename": "CoinMarketCapAPI-0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "694ee4e0d626e77a3fe11fc1381bea4f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17717, "upload_time": "2019-03-06T11:42:52", "url": "https://files.pythonhosted.org/packages/06/7a/2e48939954ddbb23bcaa88965a99067c2cbb3c851d12a6ca14468cdaf418/CoinMarketCapAPI-0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "778332ec67f1505f3a65987f6e38186b", "sha256": "dfb6db77683abda56e89fe8cc0126c5ca6c067f6f9cf5d4d99208b47463a0775" }, "downloads": -1, "filename": "CoinMarketCapAPI-0.5.tar.gz", "has_sig": false, "md5_digest": "778332ec67f1505f3a65987f6e38186b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11378, "upload_time": "2019-03-06T11:42:54", "url": "https://files.pythonhosted.org/packages/bb/a5/3d3fa508ebee7d3062705aa97405a929bc58b9a91067ffc099d34ca1974b/CoinMarketCapAPI-0.5.tar.gz" } ] }