vidallia avatar

[Python]Average price of Steem for the last 30 Days.

vidallia

Published: 15 Jul 2017 › Updated: 15 Jul 2017[Python]Average price of Steem for the last 30 Days.

[Python]Average price of Steem for the last 30 Days.

A python script to take all of the daily "close" prices of steem for the last 30 days.

This little script was fun to hack together, i learned some new concepts dealing with APIs, the requests library, and working with some JSON files.  I'm pretty new to Python so don't be too harsh on me, but I would like some feedback!

Would you let me know in the comments , what kind of  information about steem you would find useful to have?

I'm thinking about comparing the data, displayed in a percentage for the price and average volume changed from 30 days back and 60 days back but, i'm not sure. I want YOUR opinion!

$1.82 is the average price

Now to the source code:

import requests; import time
import json
r = requests.get('https://min-api.cryptocompare.com/data/histoday?fsym=STEEM&tsym=USD&limit=30&aggregate=0&e=CCCAGG')
data1 = json.loads(r.text)
coin_price = []

for coin in data1.get('Data'):
 price = coin.get("close")
 coin_price.append(float(price))
 
total = sum(coin_price) / 30
 
print("Steem's average price over last 30 days: ${}".format(round(total,2)))

Leave [Python]Average price of Steem for the last 30 Days. to:

Written by

Technology, Blockchain, Computer Science. Those are some of my favorite things.

Read more #steem posts


Best Posts From vidallia

We have not curated any of vidallia's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From vidallia