All Projects → PyDataBlog → Coinsta

PyDataBlog / Coinsta

Licence: BSD-3-Clause license
A Python package for acquiring both historical and current data of cryptocurrencies

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Coinsta

Finance Go
📊 Financial markets data library implemented in go.
Stars: ✭ 392 (+734.04%)
Mutual labels:  scraper, pandas
Tianyancha
pip安装的天眼查爬虫API,指定的单个/多个企业工商信息一键保存为Excel/JSON格式。A Battery-included Scraper API of Tianyancha, the best Chinese business data and investigation platform.
Stars: ✭ 206 (+338.3%)
Mutual labels:  scraper, pandas
Instagram-Comments-Scraper
Instagram comment scraper using python and selenium. Save the comments into excel.
Stars: ✭ 73 (+55.32%)
Mutual labels:  scraper, pandas
spyndex
Awesome Spectral Indices in Python.
Stars: ✭ 56 (+19.15%)
Mutual labels:  pandas
Datacamp-Data-Scientist-with-Python-2019-and-2020
This is about learning data scientist with Python 2019 and some new updated courses in DataCamp. All the answers given written by myself
Stars: ✭ 27 (-42.55%)
Mutual labels:  pandas
gcf-packs
Library packs for google cloud functions
Stars: ✭ 48 (+2.13%)
Mutual labels:  pandas
imdb-scraper
🎬 An attempt at the most complete IMDb API
Stars: ✭ 24 (-48.94%)
Mutual labels:  scraper
Captcha-Tools
All-in-one Python (And now Go!) module to help solve captchas with Capmonster, 2captcha and Anticaptcha API's!
Stars: ✭ 23 (-51.06%)
Mutual labels:  scraper
pandas-msgpack
Pandas Msgpack
Stars: ✭ 22 (-53.19%)
Mutual labels:  pandas
AzurLaneWikiScrapers
A console application that can scrape the Azur Lane wiki and export the data to Json files
Stars: ✭ 12 (-74.47%)
Mutual labels:  scraper
tableau-scraping
Tableau scraper python library. R and Python scripts to scrape data from Tableau viz
Stars: ✭ 91 (+93.62%)
Mutual labels:  pandas
awesome-interface
AngularJS SPA interface for awesome lists. Awesome lists parsed using python.
Stars: ✭ 25 (-46.81%)
Mutual labels:  scraper
rich-uncle-pennybags-bot
A telegram bot for all of your crypto needs. Works over the bitfinex and coinmarketcap APIs
Stars: ✭ 15 (-68.09%)
Mutual labels:  coinmarketcap
newsemble
API for fetching data from news websites.
Stars: ✭ 42 (-10.64%)
Mutual labels:  scraper
cryptocheck
Check prices of cryptocurrencies via command line
Stars: ✭ 31 (-34.04%)
Mutual labels:  coinmarketcap
opensea-scraper
Scrapes nft floor prices and additional information from opensea. Used for https://nftfloorprice.info
Stars: ✭ 129 (+174.47%)
Mutual labels:  scraper
ipython-notebooks
A collection of Jupyter notebooks exploring different datasets.
Stars: ✭ 43 (-8.51%)
Mutual labels:  pandas
DadosAbertosBrasil
Pacote Python para acesso a dados abertos e APIs do governo brasileiro.
Stars: ✭ 28 (-40.43%)
Mutual labels:  pandas
astetik
Astetik takes away the pain from telling visual stories with data on Python
Stars: ✭ 15 (-68.09%)
Mutual labels:  pandas
ammobin-client
client for https://ammobin.ca
Stars: ✭ 18 (-61.7%)
Mutual labels:  scraper

Coinsta

A Python 🐍 package for acquiring both historical and current data of crypto-currencies💰.


Author: Bernard Brenyah

Project Status

Latest Version Build Status Issues Maintenance FOSSA Status License Supported Python Version Binder

Table of Content

  1. Motivation
  2. Frameworks Used
  3. Installation
  4. Features
  5. Pending Features
  6. How To Use
  7. Release History
  8. How To Contribute
  9. Credits
  10. License

Motivation

Why coinsta? I 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 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?"

That 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.

As 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.


Frameworks Used

This package leverages the power of the following packages:

  • pandas
  • requests
  • lxml
  • beautifoulsoup

Installation

The easiest way to install Coinsta is to use the default python package installer pip:

pip install coinsta

and for the few brave ones who like bleeding edge technology, the latest source can be installed via with this command:

pip install git+git://github.com/PyDataBlog/Coinsta.git

Features

  • Current global information on cryptocurrency markets.
  • Current market information on the top 100 cryptocurrencies.
  • Current data on a specified cryptocurrency.
  • Historical data on all active cryptocurrencies.
  • Get historical snapshots of cryptocurrencies.

Pending Features

  • Migrate the current class to the new CoinMarketCap API.
  • Dropped support for Python 3.5.
  • Added support for Python 3.8.
  • Improve documentation and doc strings.
  • Optimisation of code.
  • Support for CoinMarketCap's historical snapshots.

How To Use

Historical Data

# import the Historical class
from coinsta.core import Historical
from datetime import date

# specify dates considered
start = date(2018, 3, 1)
end = date(2018, 6,1)

# get data
coin_spec = Historical('btc', start=start, end=end)
btc_data = coin_spec.get_data()
print(btc_data.head())


#by default the end date is set to use the "today's" date
# of the user unless otherwise specified like above

Alternative Constructors for Historical data from dates in the form of strings (YYYY-MM-DD) or (YYYY/MM/DD):

from coinsta.core import Historical

# default alternative method for "-" formatted date strings
alt_spec = Historical.from_strings('btc', '2018-3-1','2018-6-1', hyphen=True)

alt_btc = alt_spec.get_data()
print(alt_btc.head())

# another alternative method for "/" formated date strings
other_spec = Historical.from_strings('btc', '2018/3/1','2018/6/1', hyphen=False)

another_btc = other_spec.get_data()
print(another_btc.head())

The 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:

    Open     High      Low    Close      Volume    Market_cap
Date

So what was the top cryptocurrency (in terms of market capitalisation) on date XYZ? Luckily, CoinMarketCap delivers periodic snapshots of the this type of rankings. The HistoricalSnapshot class taps into data to supply users with such information.

The Historical Snapshot feature returns a Pandas DataFrame object with the following self describing columns:

Index(['Rank', 'Name', 'Symbol', 'Market Cap', 'Price', 'Circulating Supply',
       'Volume (24h)', '% 1h', '% 24h', '% 7d'],
      dtype='object')

Historical Snapshots:

from coinsta.core import HistoricalSnapshot
from datetime import date

snap_date = date(2018, 7, 29)

july_2018 = HistoricalSnapshot(snap_date)
july_2018_snapshot = july_2018.get_snapshot()

print(july_2018_snapshot.info())

Current Data:

# import the Current class and instantiate the current class object with specifications
from coinsta.core import Current
cur = Current(api_key='YOUR-API-KEY-HERE', currency='eur')  # Default is usd

# get current market information on a specified crypto
btc_current = cur.get_current('btc')
print(btc_current)

# get the top 100 cryptos (in terms of market cap)
current_100 = cur.top_100(limit=100)  # Default limit is 100 but can be increased as a user wishes
print(current_100.head())

# get global overview of crypto markets
glo_info = cur.global_info()
print(glo_info)

The 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:

dict_keys(['name', 'symbol', 'rank', 'circulating_supply',
 'total_supply', 'max_supply', 'price', 'volume_24h',
  'percent_change_1h', 'percent_change_24h', 'percent_change_7d',
   'market_cap', 'last_updated'])

The 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:

['id', 'name', 'symbol', 'slug', 'num_market_pairs', 'date_added',
 'tags', 'max_supply', 'circulating_supply', 'total_supply', 'platform',
 'cmc_rank', 'last_updated', '*currency*.price', '*currency*.volume_24h',
 '*currency*.percent_change_1h', '*currency*.percent_change_24h', '*currency*.percent_change_7d',
  '*currency*.market_cap', '*currency*.last_updated']

Finally, the global_info() method in Current class returns a dictionary with the following keys as an overview of cryptocurrency markets as a whole

dict_keys(['active_cryptos', 'active_exchanges', 'btc_dominance',
 'eth_dominance', 'total_market_cap', 'total_volume_24h',
 'total_volume_24h_reported', 'altcoin_volume_24h',
 'altcoin_volume_24h_reported', 'altcoin_market_cap', 'last_updated'])

Release History

  • 0.1.8 - Relaxed checks on specified tickers since upstream only shows top 100 cryptos.
  • 0.1.7 - Trimmed code dependencies.
  • 0.1.6 - Fix compliance with upstream changes, added support for Python 3.8 and dropped support for Python 3.5.
  • 0.1.5 - Updated historical snapshot to suit the new upstream changes from CoinMarketCap
  • 0.1.4 - Re-wrote the Current classes to use the new CoinMarketCap API
  • 0.1.3 - Added Historical Snapshot feature
  • 0.1.2 - Added support for Python 3.5 and 3.7
  • 0.1.1 - Added license info and improved documentation
  • 0.1.0 - Initial Public Release

How to Contribute

This 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.


Credits

Shoutout to CoinMarketCap ❤️ for the access to their API as well as allowing projects such as this plug into the datawarehouse.


License

License: BSD-3

FOSSA Status


Back to top

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].