Using Coinmarketcap python API to get Steem and SBD price

in #steemit6 years ago (edited)

coinmarketcap is an APACHE licensed library written in Python providing an easy to use wrapper around the coinmarketcap.com API. This library has been tested with Python 2.7.x and Python 3.6.x and uses.

To install the library:

$ pip install coinmarketcap

To get the steem/SBD price

from coinmarketcap import Market
coinmarketcap = Market()
Steem_market_price_USD= float(coinmarketcap.ticker('steem', convert='USD')[0]['price_usd'])
SBD_market_price_USD= float(coinmarketcap.ticker('steem-dollars', convert='USD')[0]['price_usd'])
print('Steem_market_price_USD',Steem_market_price_USD)
print('SBD_market_price_USD',SBD_market_price_USD)
Sort:  

I up-voted, but it is not working

First, names of variables can't start with big letter, did you even try your code?
Second, if I correct the name, I get error (I'm trying this 8 days later)

The coinmarketcap loads, you get an object, but lines bellow, parsing cause error.

Next time I will try your code first, before I give you upvote.

Hi, @veleje, thanks for your reply.
If you can show me the error information you got and you are still interested to get the code work, I really like to help you.

Coin Marketplace

STEEM 0.17
TRX 0.13
JST 0.027
BTC 58309.71
ETH 2617.30
USDT 1.00
SBD 2.42