Coder Social home page Coder Social logo

acidvegas / coinmarketcap Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 6 KB

python class for the api on coinmarketcap

Home Page: https://coinmarketcap.com

License: ISC License

Python 100.00%
coinmarketcap cryptocurrency bitcoin crypto cryptocurrencies cryptocurrency-price-ticker cmc

coinmarketcap's Introduction

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

coinmarketcap's People

Contributors

acidvegas avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.