A Steem price watching bot written in Python!

4년 전

My bot is named Steempy, and "he" will monitor the steem price 6 times a minute and if the price changes he will print out the difference in the console.

Steempy is still in version 0.0.2 and has a few bugs, like the change in price not displaying in a "pretty" way but, the logic behind Steempy is correct. That bug is the only one I could find so far! So give it a test and let me know what you think!

If you have any experience with displaying floats/decimals in Python in a pretty way, please comment your suggestions bellow. I tried the decimal module but, it didn't seem to help a whole lot.

Now for the code: Steempy.py:

# Steempy: a bot that monitors a CryptoCompare API  v0.0.2
# Bugs: having trouble with like 19 & line 24 displaying the change
# correctly.  Example: displays 2.0E-7 as a change.

from decimal import Decimal
import requests
import time
url = "https://min-api.cryptocompare.com/data/histominute?fsym=STEEM&tsym=BTC&limit=1&aggregate=0&e=CCCAGG"
coin_price = [0.0000001]
while True:
	minutechart = requests.get(url).json()
	# list indexing from multiple nested lists/dicts
	a = minutechart['Data'][-1]['close']
	b = coin_price[0]
	if a > b:
		diff = Decimal(a) - Decimal(b)
		print("a higher difference of {} BTC since last price".format(
	elif a < b:
		diff = Decimal(b) - Decimal(a)
		print("a lower difference of {} BTC since last price".format(
		print("Current Price: {} ".format(coin_price))

For more posts like this, toss me a upvote, follow, and most importantly comment!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  trending

Nice, I'd really like to get into writing some scripts to interface with Steem (and steemit). I know a fair bit of JavaScript but my python is still lacking. I think I should just give it a try and learn by practice. Thanks for your post,


You're welcome, I've only been writing with python for about 1.5 months. It's actually not too hard to pick up. I really want to start working with the steem blockchain and steemits Python libraries. If your interested, I would check out this github: https://github.com/steemit/steem-python It has alot of the tools you'll need to work with steemit. I just haven't got around to working with it yet. When I do though, I'll be sure to upload some code of the projects that I put together! Thanks for the comment by the way. Engaging with my followers always keeps me motivated.