DEV Community

Cover image for Steem price with Python
codesharedot
codesharedot

Posted on

Steem price with Python

Steem is a blockchain-based rewards platform for publishers to monetize content and grow community.

The website steemit rewards its users in steem coin for writing content. This feature isn't available in dev.to yet, but perhaps in the future you'll earn crypto currency with posting.

Price changes

Like any currency or asset, the value fluctuates over time. Is it increasing or decreasing? let's find out with Python

The data is available on coinmarketcap,

#!/usr/bin/python3
r  = requests.get("https://coinmarketcap.com/currencies/steem/historical-data/?start=20140101&end={0}".format(enddate))
data = r.text

This link points to an HTML table, not an API call. That's why we need beautifulsoup to parse the data.

#!/usr/bin/python3
soup = BeautifulSoup(data, "html.parser")
table = soup.find('table', attrs={ "class" : "table"})

You can iterate over the table like this:

#!/usr/bin/python3
for row in table.find_all('tr'):
    tag = row.findAll('td')
    for val in tag:
        value = val.text

I add the data to an array and plot it with Python, see source code

This shows it's better to trade steem coin immediately for something else, as its price is decreasing.

Related links:

Top comments (0)