[Steempy v0.0.4] A Steem Price Bot written in Python

Steempy is now displaying the percentage changed whenever the price moves!

As promised, I updated Steempy in version 0.0.4 to be able to display the percentage changed between price changes along with the already implemented, amount changed which is displayed in bitcoin. This was a pretty implementation, that shouldn't have taken as long as it has but, hey. I'm a human, not a highly dedicated price bot like Steempy.

Steempy also got a few bugs squashed

Although, it was nothing major, I changed the way Steempy spits out his information to be a little easier on the eyes, and not so "cluttered." This makes looking at the price movements a breeze. Another, issue that I was having was how Steempy would start off with a really low value as a placeholder, which would, upon starting Steempy report a significant price increase. This was rectified by using a IF statement to check if Steempy's ```coin_price``` was empty, and if it was, it appends the current steem price into it, which always happens upon starting up Steempy. As always, if you ever notice a bug I missed, leave a comment!

New features in the future?

I plan to add some new information/data to Steempy's brain. That data will most likely be steem trading volume but, i'm not entirely sure what I want to have him do with that data. I'm trying to think of another use other than reiterating what i did with the steem price. Any suggestions would be great!

You're probably thinking  "Source C0d3 Pl0X"  well here you go

# Steempy v0.0.4.0 is a bot that monitors the CryptoCompare API  
# Bug fixes: issue with starting value in coin_price
# New for v0.0.4: Added percent of price change, formatted,
#  the way information is displayed, a bit cleaner than v0.0.3
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 = []
# Gets the percentage changed between two prices, returns ints
def PercentChange(previous,current):
 if previous == current or previous == 0 or current == 0:
     return 0
 else:
     return ((current-previous)/previous)*100

print("Steempy v0.0.4. Programmed by vidallia.")
print("Feel free modify the code to suit your needs.")

while True:
 print("Sleeping...")
 time.sleep(5)
 minutechart = requests.get(url).json()
 # list indexing from multiple nested lists/dicts
 a = minutechart['Data'][-1]['close']
 if len(coin_price) == 0: coin_price.append(a)
 coin_price.append(a)
 b = coin_price[0]
 if a > b:
     diff = Decimal(a) - Decimal(b)
     print("(+)Increase of: {:.7f}.\n\t+{:.4f}% Change. ".format(
     diff,PercentChange(b,a)))
     coin_price.pop(0)
     print("Current price: {}".format(coin_price))
 elif a < b:
     diff = Decimal(b) - Decimal(a)
     print("(-)Decrease of: {:.7f}.\n\t{:.4f}% Change.".format(
     diff,PercentChange(b,a)))
     coin_price.pop(0)
     print("Current price: {}".format(coin_price))
 else:
     coin_price.pop(0)
     print("Current Price: {} ".format(coin_price))


For more content, Upvote, ReSteem, and Follow!

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center