Build your own stock ticker using a Raspberry Pi and Sense Hat.
Functions- Tracks a stock ticker symbol
- If price change is positive the Sense Hat LED displays a green up arrow and the stock price change
- If price change is negative the Sense Hat LED displays a red down arrow and the stock price change
- Brightness intensity level increases or decreases with amount of change
This project uses the Sense Hat running on a Raspberry Pi 3 to visualize the positive or negative price change of a stock ticker symbol by fetching stock quote data from Yahoo Finance once per second and using either red or green LED colors and a higher or lower LED brightness intensity level to indicate the amount of price change.
Features:- Checks day of week and time, displays on Sense Hat during normal stock market hours (M-F, 9:30 AM - 4PM)
- Uses ystockquote to get the specified ticker symbol, example: AAPL
- Lights up Sense Hat LEDs red/green + brightness intensity levels
- Basic error handling for when urllib returns a 404, Connection reset by peer, or N/A for ticket symbol data
- Shuts off the LEDs when the script exits or while the stock market is closed
- Python 2.7.9
- Python module ystockquote
- Plug Raspberry Pi into power and ethernet (or setup wireless)
- Connect Sense Hat to Raspberry Pi
- Install latest Raspbian version on the Raspberry Pi.
- Run the following commands to install the required packages and libraries:
sudo apt-get update -y
sudo apt-get install sense-hat python-dev python-pip wget -y
sudo pip install ystockquote
sudo reboot
Latest instructions to install the Sense Hat can be found here: https://pythonhosted.org/sense-hat/
- Download my python script:
wget https://raw.githubusercontent.com/swoodford/raspberrypi/master/stockticker-sensehat.py && chmod +x stockticker-sensehat.py
- Run the script:
python stockticker-sensehat.py
Photos:
Comments
Please log in or sign up to comment.