This is a simple stock ticker price change monitor of today's positive or negative change using green or red NeoPixel LEDs.
What does this do?
- Tracks a stock ticker symbol
- If price change is positive the LED lights are green
- If price change is negative the LED lights are red
- Brightness intensity level increases or decreases with amount of change
This project uses an Adafruit NeoPixel LED strip running on a Raspberry Pi 2 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, lights NeoPixel during normal stock market hours (M-F, 9:30 AM - 4PM)
- Uses ystockquote to get the specified ticker symbol, example: AAPL
- Lights up NeoPixel 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
- Adafruit Pi Cobbler Plus (optional)
- Breadboard (optional)
- Alligator clips (optional)
- Python 2.7.9
- Python module ystockquote
1. Plug Raspberry Pi into power and ethernet (or setup wireless).
2. Connect Pi Cobbler and Breadboard (optional).
3. Use Alligator clips or other wires to connect Adafruit NeoPixel stick: Ground to Ground on RPi, 5VDC to 5V on RPi, and DIN on NeoPixel Stick to GPIO pin 18 on RPi.
Software Instructions:1. Install latest Raspbian version on the RPi 2.
2. Run the following commands to install the required packages and libraries:
sudo apt-get update -y
sudo apt-get install build-essential python-dev python-pip git scons swig wget -y
sudo pip install ystockquote
git clone https://github.com/jgarff/rpi_ws281x.git
cd rpi_ws281x
scons
cd python
sudo python setup.py install
More detailed guide to setting up the Adafruit NeoPixel on a Raspberry Pi here: https://learn.adafruit.com/neopixels-on-raspberry-pi/software
3. Download my python script to the rpi_ws281x/python
directory:
wget https://raw.githubusercontent.com/swoodford/raspberrypi/master/stockmonitor-neopixel.py && chmod +x stockmonitor-neopixel.py
4. Run the script:
sudo python stockmonitor-neopixel.py
Comments
Please log in or sign up to comment.