US and international stocks, commodities, and bonds can be tracked, including market-wide and industry indexes Trade data is polled every 30 seconds during the trading day. The ticker goes from dark red ( > 4% drop from open), to green (within 0.2% of open), to blue ( > 4% increase from open). First, I'll answer a few questions, then I'll show you how to make your own!
Step 1: FAQ
Every 90 seconds, the Tannenbaum Ticker grabs the most recent quote from Google for the symbol you want to track. The page is parsed and the '% change' value is used to adjust the color of the ornament. US quotes are real-time, International quotes are delayed 20 minutes.
A Propeller Platform USB runs everything, parsing the page and changing the color of the light. It uses an E-Net module to connect to the Internet. If there's a data connection problem, that also gets reported by turning the ornament purple.
Why not just use my phone / computer / TV to get quotes?
If you're already checking quotes several times a day, this ticker may be a cool visualization, but you're probably already set.
Personally, I'm a 'set it and forget it' investor — I check stock quotes maybe once a week. The Tannenbaum Ticker is handy because brings updated quotes to me, without having to even think about it. It's also passive, so it's easy to ignore.
What about tracking something else?
For sure! For this project, we're parsing a web page for a stock quote, but we could parse a page to grab news, sports, weather, or whatever else. I'll give you a few ideas when I go over the code. Speaking of which, the whole project is open source and you can grab the sourcecode right here.
Let's start by getting all the parts together!
Step 2: Parts and Materials
PartsYou'll need a few parts to build your Tannenbaum Ticker;
1 - A Christmas Ornament, an RGB LED, 47 ohm resistor, and hookup wire
I'm using a clear plastic ornament I got at Michaels for $2 or $3. You can use a glass ornament, but when the LED lights up, any chips or scrapes on the inside coating of the ornament will show through and it won't look as nice. The tape will diffuse the LED to make it look more even when it lights up.
The LED is common anode, you can grab one for $1.60 here. The 47 ohm resistor limits the current flow so the LED lasts a long time.
2. Propeller Platform and E-Net Module
The Propeller Platform USB is available at adafruit. The E-Net Module is based on the ENC28J60 chip, you can get it here.
ToolsAssembly took me about thirty minutes, and takes a little soldering. If you've never soldered before, there are a bunch of great instructables to guide you, like this one. You'll need a few tools:
- Soldering Iron and solder. Leaded solder is easier to work with, and a 15-40 watt iron is just fine.
- Dikes. Diagonal cutters are used to trim the excess leads from components after soldering them down. I use a pair I got from Ikea for two bucks.
- Glue Gun. We'll use hot glue to hold the LED in the ornament.
Step 3: Preparing the Ornament
Then, I used a dremel to put a small hole through the plastic;
Step 4: Connecting the LED
Solder pin 4 (the anode) to your 47 ohm resistor, then solder it to V33 on your E-Net module;
The wire connected to pin 3 (the longest pin), should connect to P25 on your E-Net module, Pin 2 goes to P27 on the E-Net module, and Pin 1 goes to P23.
Insert the LED partway into the ornament and squirt in some hot glue. Hold the LED in place until the glue cools down. Be sure that the leads on the LED aren't touching each other - just fold them 90 degrees apart in the hole;
Drop the E-Net module on top of the Propeller Platform USB, and you're ready to start loading up the software!
Step 5: Stock Picking
This is the webpage that contains our stock quote. Change the line:
uri byte "/ig/api?stock=DJIA",0
uri byte "/ig/api?stock=yourticker",0
For example, the ticker for the Dow Jones Crude Oil Index is 'DJUBSCL', so change that line to;
uri byte "/ig/api?stock=DJUBSCL",0
Here are a few more tickers to get you started;
- NI225 Nikkei Index
- .IXIC Nasdaq Composite
- DJIA Dow Jones Industrial Average
- DJUBSLC DJ-UBS Cattle Index
- UKX FTSE 100
- CSCO (Cisco Systems)
- AAPL (Apple)
- MCD (McDonald's)
- 2802.T (Ajinomoto)
- 1178.T (Mitsui)
- 8729.T (Sony Financial)
- HSE uses the SIC + ".hk",
- LSE uses the ticker + ".L"
- SSE uses the SIC + ".ss"
IP settingsThe Tannenbaum Ticker doesn't support DHCP, so you'll need to configure it to work on your local network. Open up Page_Reader_004.spin, there are four settings you may need to change;
for ip_addr, you should be able to choose an unused IP address on your network. Subnet is usually 255.155.155.0 and gateway and dns are usually the address of your router. If you don't know those settings, you can just copy your computer's config. In Windows, open up the command prompt and type ipconfig /all . In Linux, you can use route -n .
Step 6: Next Steps
Tracking Other StuffThe Tannenbaum Ticker can be used to grab other data off the Internet! Just find a page with the data you want to use and point your project to it. In the same place we changed the stock ticker, we'll change it to the URL we want to grab data from;
to the page you want to track. Be sure to also update IP with the IP address of the server you want to connect to.
Not all web pages work well - you want to grab data from a page that is short (under 3 kb) and contains the data you want to track in an attribute. For example, if our data were in the page like this;
<serverload status="full" />
We could grab the value of the status attribute in our program with;
and every time our program runs
serv.serverrefresh, remotedata will get updated with the newest value of status.
That's it! I had a lot of fun putting this project together, let me know if you have any questions or comments!