coinmarketcap- python class for the api on coinmarketcap |
git clone git://git.acid.vegas/coinmarketcap.git |
Log | Files | Refs | Archive | README | LICENSE |
README.md (2238B)
1 # coinmarketcap 2 > A Python class for the API on [CoinMarketCap](https://coinmarketcap.com) 3 4 ## Requirements 5 * [Python](https://www.python.org/downloads/) 6 7 ## API Documentation 8 - [CoinMarketCap API Documentation](https://coinmarketcap.com/api/documentation/v1/) 9 10 ## Information 11 In order to use the CoinMarketCap API, you will need an API key which you can sign up for one [here](https://pro.coinmarketcap.com/signup/). 12 13 Data from the API will be cached for 5 minutes at a time (that is how long it takes CoinMarketCap to refresh their data) this way you will not get rate limited. 14 15 The class has only 2 main functions, one for global data and one for ticker data. 16 17 ## Example 18 ```python 19 from coinmarketcap import CoinMarketCap 20 21 CMC = CoinMarketCap('API_KEY_HERE') 22 23 global_data = CMC._global() # Global data example 24 print('Cryptocurrencies : ' + str(global_data['cryptocurrencies'])) 25 print('Exchanges : ' + str(global_data['exchanges'])) 26 print('BTC Dominance : ' + str(global_data['btc_dominance'])) 27 print('ETH Dominance : ' + str(global_data['eth_dominance'])) 28 print('Market Cap : ' + str(global_data['market_cap'])) 29 print('Volume : ' + str(global_data['volume'])) 30 31 ticker_data = CMC._ticker() # Ticker data example 32 for item in ticker_data: 33 print('ID : ' + item) 34 print('Name : ' + ticker_data[item]['name']) 35 print('Symbol : ' + ticker_data[item]['symbol']) 36 print('Slug : ' + ticker_data[item]['slug']) 37 print('Rank : ' + str(ticker_data[item]['rank'])) 38 print('Price : ' + str(ticker_data[item]['price'])) 39 print('1h Percent : ' + str(ticker_data[item]['percent']['1h'])) 40 print('24h Percent : ' + str(ticker_data[item]['percent']['24h'])) 41 print('7d Percent : ' + str(ticker_data[item]['percent']['7d'])) 42 print('Volume : ' + str(ticker_data[item]['volume'])) 43 print('Market Cap : ' + str(ticker_data[item]['market_cap'])) 44 input('') # Press enter to continue... 45 ``` 46 47 ___ 48 49 ###### Mirrors 50 [acid.vegas](https://git.acid.vegas/coinmarketcap) • [GitHub](https://github.com/acidvegas/coinmarketcap) • [GitLab](https://gitlab.com/acidvegas/coinmarketcap) • [SuperNETs](https://git.supernets.org/acidvegas/coinmarketcap)