{"id":17486087,"url":"https://github.com/pydatablog/coinsta","last_synced_at":"2025-04-16T03:48:42.696Z","repository":{"id":43368088,"uuid":"138895331","full_name":"PyDataBlog/Coinsta","owner":"PyDataBlog","description":"A Python package for acquiring both historical and current data of cryptocurrencies","archived":false,"fork":false,"pushed_at":"2023-05-22T23:20:14.000Z","size":97,"stargazers_count":49,"open_issues_count":4,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T04:51:12.110Z","etag":null,"topics":["coinmarketcap","cryptocurrency","current-cryptocurreny-data","pandas","python","scraper"],"latest_commit_sha":null,"homepage":"https://medium.com/python-data/coinsta-a-python-package-for-cryptocurrency-data-67e5417182a7","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PyDataBlog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-27T14:47:25.000Z","updated_at":"2025-02-26T19:40:12.000Z","dependencies_parsed_at":"2024-11-01T13:03:22.290Z","dependency_job_id":"e2f37f2d-1c9a-4789-8bdf-2b5ffbb4add0","html_url":"https://github.com/PyDataBlog/Coinsta","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyDataBlog%2FCoinsta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyDataBlog%2FCoinsta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyDataBlog%2FCoinsta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyDataBlog%2FCoinsta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PyDataBlog","download_url":"https://codeload.github.com/PyDataBlog/Coinsta/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249192446,"owners_count":21227792,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coinmarketcap","cryptocurrency","current-cryptocurreny-data","pandas","python","scraper"],"created_at":"2024-10-19T02:09:33.802Z","updated_at":"2025-04-16T03:48:42.656Z","avatar_url":"https://github.com/PyDataBlog.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Coinsta\n\nA Python :snake: package for acquiring both historical and current data of crypto-currencies:moneybag:.\n_________________________________________________________________________________________________________\n\n**Author:** Bernard Brenyah\n\n## Project Status\n\n[![Latest Version](https://img.shields.io/pypi/v/coinsta.svg)](https://pypi.python.org/pypi/coinsta/)\n[![Build Status](https://www.travis-ci.org/PyDataBlog/Coinsta.svg?branch=master)](https://www.travis-ci.org/PyDataBlog/Coinsta)\n[![Issues](https://img.shields.io/github/issues/PyDataBlog/coinsta.svg)](https://github.com/PyDataBlog/Coinsta/issues)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/PyDataBlog/Coinsta/commits/master)\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FPyDataBlog%2FCoinsta.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FPyDataBlog%2FCoinsta?ref=badge_shield)\n[![License](https://img.shields.io/pypi/l/coinsta.svg?color=green)](https://pypi.python.org/pypi/coinsta/)\n[![Supported Python Version](https://img.shields.io/pypi/pyversions/coinsta.svg)](https://pypi.python.org/pypi/coinsta/)\n[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/PyDataBlog/Coinsta/master)\n\n## Table of Content\n\n1. [Motivation](#motivation)\n2. [Frameworks Used](#frameworks-used)\n3. [Installation](#installation)\n4. [Features](#features)\n5. [Pending Features](#pending-features)\n6. [How To Use](#how-to-use)\n7. [Release History](#release-history)\n8. [How To Contribute](#how-to-contribute)\n9. [Credits](#credits)\n10. [License](#license)\n\n_________________________________________________________________________________________________________\n\n### Motivation\n\nWhy `coinsta`?\nI spent the past couple of months on a graduate dissertation which required the use of both historical and current data on cryptocurrencies. After browsing the Python Packaging Index (PYPI), I was frustrated by the lack of a Python package that catered for such needs. As far as I know only [cyrptoCMD](https://github.com/guptarohit/cryptoCMD) came close to meeting my needs. The only drawback is the that package only delivers historical data. OK so \"*why not edit that project and make a pull request with your suggestions?*\"\n\nThat was the original plan until I realised that the scraping code could relatively be done quickly with the help of `pandas` package. If I went with the original plan I would have to rewrite the whole code and implementation ideas for `cryptoCMD` project. The only logical conclusion was starting a new project that I wish I had during my data collection process. A project inspired by scripts I generated for my dissertation project.\n\nAs a result, this project is the first Python project that supplies both historical and current data on cryptocurrency markets and assets in one coherent package.\n\n_________________________________________________________________________________________________________\n\n### Frameworks Used\n\nThis package leverages the power of the following packages:\n\n- `pandas`\n- `requests`\n- `lxml`\n- `beautifoulsoup`\n\n_________________________________________________________________________________________________________\n\n### Installation\n\nThe easiest way to install Coinsta is to use the default python package installer `pip`:\n\n```bash\npip install coinsta\n```\n\nand for the few brave ones who like bleeding edge technology, the latest source can be installed via with this command:\n\n```bash\npip install git+git://github.com/PyDataBlog/Coinsta.git\n```\n\n_________________________________________________________________________________________________________\n\n### Features\n\n- Current global information on cryptocurrency markets.\n- Current market information on the top 100 cryptocurrencies.\n- Current data on a specified cryptocurrency.\n- Historical data on all active cryptocurrencies.\n- Get historical snapshots of cryptocurrencies.\n\n### Pending Features\n\n- [X] Migrate the current class to the new CoinMarketCap API.\n- [X] Dropped support for Python 3.5.\n- [X] Added support for Python 3.8.\n- [X] Improve documentation and doc strings.\n- [X] Optimisation of code.\n- [X] Support for CoinMarketCap's historical snapshots.\n\n#### How To Use\n\n**Historical Data**\n\n```python\n# import the Historical class\nfrom coinsta.core import Historical\nfrom datetime import date\n\n# specify dates considered\nstart = date(2018, 3, 1)\nend = date(2018, 6,1)\n\n# get data\ncoin_spec = Historical('btc', start=start, end=end)\nbtc_data = coin_spec.get_data()\nprint(btc_data.head())\n\n\n#by default the end date is set to use the \"today's\" date\n# of the user unless otherwise specified like above\n\n```\n\n**Alternative Constructors for Historical data from dates in the form of strings (YYYY-MM-DD) or (YYYY/MM/DD):**\n\n```python\nfrom coinsta.core import Historical\n\n# default alternative method for \"-\" formatted date strings\nalt_spec = Historical.from_strings('btc', '2018-3-1','2018-6-1', hyphen=True)\n\nalt_btc = alt_spec.get_data()\nprint(alt_btc.head())\n\n# another alternative method for \"/\" formated date strings\nother_spec = Historical.from_strings('btc', '2018/3/1','2018/6/1', hyphen=False)\n\nanother_btc = other_spec.get_data()\nprint(another_btc.head())\n\n```\n\nThe `get_data()` method and the `from_strings` method from the Historical class returns a `pandas` DataFrame object with sorted in an ascending order indexed the dates specified by the user:\n\n```shell\n    Open     High      Low    Close      Volume    Market_cap\nDate\n```\n\nSo what was the top cryptocurrency (in terms of market capitalisation) on date XYZ?\nLuckily, CoinMarketCap delivers periodic snapshots of the this type of rankings. The `HistoricalSnapshot` class taps into data to supply users with such information.\n\nThe Historical Snapshot feature returns a Pandas DataFrame object with the following self describing columns:\n\n```python\nIndex(['Rank', 'Name', 'Symbol', 'Market Cap', 'Price', 'Circulating Supply',\n       'Volume (24h)', '% 1h', '% 24h', '% 7d'],\n      dtype='object')\n```\n\n**Historical Snapshots:**\n\n```python\nfrom coinsta.core import HistoricalSnapshot\nfrom datetime import date\n\nsnap_date = date(2018, 7, 29)\n\njuly_2018 = HistoricalSnapshot(snap_date)\njuly_2018_snapshot = july_2018.get_snapshot()\n\nprint(july_2018_snapshot.info())\n```\n\n**Current Data:**\n\n```python\n# import the Current class and instantiate the current class object with specifications\nfrom coinsta.core import Current\ncur = Current(api_key='YOUR-API-KEY-HERE', currency='eur')  # Default is usd\n\n# get current market information on a specified crypto\nbtc_current = cur.get_current('btc')\nprint(btc_current)\n\n# get the top 100 cryptos (in terms of market cap)\ncurrent_100 = cur.top_100(limit=100)  # Default limit is 100 but can be increased as a user wishes\nprint(current_100.head())\n\n# get global overview of crypto markets\nglo_info = cur.global_info()\nprint(glo_info)\n\n\n```\n\nThe `get_current()` method from the current class returns a `pandas` DataFrame object with one column representing the following named rows of information on the cryptocurrency specified:\n\n```python\ndict_keys(['name', 'symbol', 'rank', 'circulating_supply',\n 'total_supply', 'max_supply', 'price', 'volume_24h',\n  'percent_change_1h', 'percent_change_24h', 'percent_change_7d',\n   'market_cap', 'last_updated'])\n```\n\nThe `top_100` method in the current class returns a `pandas` DataFrame object of the top 100 cryptocurrencies in terms of market capitalization. The following are the columns returned:\n\n```python\n['id', 'name', 'symbol', 'slug', 'num_market_pairs', 'date_added',\n 'tags', 'max_supply', 'circulating_supply', 'total_supply', 'platform',\n 'cmc_rank', 'last_updated', '*currency*.price', '*currency*.volume_24h',\n '*currency*.percent_change_1h', '*currency*.percent_change_24h', '*currency*.percent_change_7d',\n  '*currency*.market_cap', '*currency*.last_updated']\n```\n\nFinally, the `global_info()` method in Current class returns a dictionary with the following keys as an overview of cryptocurrency markets as a whole\n\n```python\ndict_keys(['active_cryptos', 'active_exchanges', 'btc_dominance',\n 'eth_dominance', 'total_market_cap', 'total_volume_24h',\n 'total_volume_24h_reported', 'altcoin_volume_24h',\n 'altcoin_volume_24h_reported', 'altcoin_market_cap', 'last_updated'])\n```\n\n_________________________________________________________________________________________________________\n\n#### Release History\n- 0.1.8 - Relaxed checks on specified tickers since upstream only shows top 100 cryptos.\n- 0.1.7 - Trimmed code dependencies.\n- 0.1.6 - Fix compliance with upstream changes, added support for Python 3.8 and dropped support for Python 3.5.\n- 0.1.5 - Updated historical snapshot to suit the new upstream changes from CoinMarketCap\n- 0.1.4 - Re-wrote the Current classes to use the new CoinMarketCap API\n- 0.1.3  - Added Historical Snapshot feature\n- 0.1.2  - Added support for Python 3.5 and 3.7\n- 0.1.1  - Added license info and improved documentation\n- 0.1.0  - Initial Public Release\n\n#### How to Contribute\n\nThis project welcomes contributions from anyone interested in this project. Guidelines for contribution is being drafted but for now a pull request with explanation of the contributions will suffice.\n\n_________________________________________________________________________________________________________\n\n#### Credits\n\nShoutout to [CoinMarketCap](https://coinmarketcap.com/) :heart: for the access to their API as well as allowing projects such as this plug into the datawarehouse.\n\n_________________________________________________________________________________________________________\n\n#### License\n\nLicense: [BSD-3](https://github.com/PyDataBlog/Coinsta/blob/master/LICENSE)\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FPyDataBlog%2FCoinsta.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FPyDataBlog%2FCoinsta?ref=badge_large)\n\n_________________________________________________________________________________________________________\n\n[Back to top](#table-of-content)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpydatablog%2Fcoinsta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpydatablog%2Fcoinsta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpydatablog%2Fcoinsta/lists"}