1
mirror of git://git.acid.vegas/coinmarketcap.git synced 2024-11-13 02:56:37 +00:00
python class for the api on coinmarketcap https://coinmarketcap.com/api
Go to file
2023-08-19 21:02:43 -04:00
coinmarketcap.py Mirrors updated and code cleaned up 2023-08-19 21:02:43 -04:00
LICENSE Mirrors updated and code cleaned up 2023-08-19 21:02:43 -04:00
README.md Mirrors updated and code cleaned up 2023-08-19 21:02:43 -04:00

coinmarketcap

A Python class for the API on CoinMarketCap

Requirements

API Documentation

Information

In order to use the CoinMarketCap API, you will need an API key which you can sign up for one here.

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.

The class has only 2 main functions, one for global data and one for ticker data.

Example

from coinmarketcap import CoinMarketCap

CMC  = CoinMarketCap('API_KEY_HERE')

global_data = CMC._global() # Global data example
print('Cryptocurrencies : ' + str(global_data['cryptocurrencies']))
print('Exchanges        : ' + str(global_data['exchanges']))
print('BTC Dominance    : ' + str(global_data['btc_dominance']))
print('ETH Dominance    : ' + str(global_data['eth_dominance']))
print('Market Cap       : ' + str(global_data['market_cap']))
print('Volume           : ' + str(global_data['volume']))

ticker_data = CMC._ticker() # Ticker data example
for item in ticker_data:
    print('ID          : ' + item)
    print('Name        : ' + ticker_data[item]['name'])
    print('Symbol      : ' + ticker_data[item]['symbol'])
    print('Slug        : ' + ticker_data[item]['slug'])
    print('Rank        : ' + str(ticker_data[item]['rank']))
    print('Price       : ' + str(ticker_data[item]['price']))
    print('1h  Percent : ' + str(ticker_data[item]['percent']['1h']))
    print('24h Percent : ' + str(ticker_data[item]['percent']['24h']))
    print('7d  Percent : ' + str(ticker_data[item]['percent']['7d']))
    print('Volume      : ' + str(ticker_data[item]['volume']))
    print('Market Cap  : ' + str(ticker_data[item]['market_cap']))
    input('') # Press enter to continue...

Mirrors

acid.vegasGitHubGitLabSuperNETs