Hey guys, today I just wanted to share a neat piece of code that allows you to retrieve the price of Bitcoin, Steem and SBD on your Raspberry Pi. You could of course add any other cryptocurrency of your liking, but this code will display those 3 as they are my favorites.
I set up this Pi yesterday and gave it as a gift to my good friend and partner @albertogm, now he doesn't have to check coinmarketcap every 5 minutes!
If you want to create your own Crypto Price Board, all you have to do is get yourself a Sensehat for your Pi and copy this Python code:
from sense_hat import SenseHat
sense = SenseHat()
from urllib.request import urlopen
import json
import time
while True:
try:
url = urlopen('https://poloniex.com/public?command=returnTicker').read()
result = json.loads(url)
SBD = result['BTC_SBD']['last']
BTC = result['USDT_BTC']['last']
Steem = result['BTC_STEEM']['last']
SBD_USD = float(SBD) * float(BTC)
STEEMUSD = float(Steem) * float(BTC)
sense.show_message("BTC " + '{0:.0f}'.format(BTC), text_colour=[255, 215, 0])
sense.show_message("STEEM " + '{0:.2f}'.format(STEEMUSD), text_colour=[7, 24, 138])
sense.show_message("SBD " + '{0:.2f}'.format(SBD_USD), text_colour=[4, 112, 22])
time.sleep(3)
except:
sense.show_message("failed to retrieve feed")
time.sleep(3)
You should also add a cron job so that your script runs at starts, you can follow this guide that does just that: http://www.instructables.com/id/Raspberry-Pi-Launch-Python-script-on-startup/
Enjoy!
I did something similar recently. I need to fire it up again. I was trying to think of other things I could display.
It looks cool on the pi zero, it is also cheaper to deploy
That display was pretty cheap and there's a new version with more pixels. It's easy to program in Python. Here's my post about it.
I really need to learn even the simple coding as well , I’ll take a look . How’s the mining going ?
Python is the easiest language to learn in my opinion, is quite fun..
Still preparing the container, will post about it soon..
I hope things are well on your end!
I’ll look forward to it . My brothers still creating more trying to find a place to put them. Has them in different houses right now and sometimes it’s too much load and heat
Great stuff. I need somethink like that, since I also watch coinmarketcap a lot lately.
That is what it means to be a passionate guy :)) I just wonder, is this really practical, since you will have to watch every letter one by one in a row, or is it more interesting because it just keep you focused?
hehe you just have to wait a bit..
Interesting.
I am sure that there are many code examples to get information from websites - in this case, from poloniex.com. But, thanks for sharing.
I am interested in automation and possibly to facilitate or automate trading, but, this is a good tidbit. Thank you!
Thanks for sharing i will done upvote..A very good post
great one post..
carry on...
Thanks for sharing i will done upvote..A very good post @ chitty
nice post
I have been interested in Pi but didn't know what to use it for, but this is brilliant!!
Wow great way of mining
Awesome work thanks for sharing the code here this is very useful : )
excellent post...thanks for sharing a blog........
how ingenious my friend
thanks for great post
thats so cool!!
Great work!
i will always support you man..
Que bueno! quiero el mismo en casa ;)
Thanks for sharing this information ,,, good luck my dear friend @chitty 👍👍😉