Deprecated: Assigning the return value of new by reference is deprecated in /home/nicholas/public_html/ggnew/components/libraries/cmslib/spframework.php on line 101

Deprecated: Assigning the return value of new by reference is deprecated in /home/nicholas/public_html/ggnew/components/libraries/cmslib/spframework.php on line 644
Tannenbaum Ticker
Tannenbaum Ticker
All News -> Projects
Written by Nicholas McClanahan   
Monday, 19 December 2011 16:39
The Tannenbaum Ticker is a Christmas tree ornament that changes color based on how your stocks are doing


Here's a little demo;

 


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).  There's also a 'short mode' to track short positions.  First, I'll answer a few questions, then I'll show you how to make your own!

FAQ

How does it work?
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 realtime, 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 - you can grab the sourcecode right here.

Let's start by getting all the parts together.

Parts

You'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


You could also build this project on a breadboard, although it would be a bit unwieldy.  The E-Net Module is based on the ENC28J60 chip.

Tools

Assembly 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:
  1. Soldering Iron and solder. Leaded solder is easier to work with, and a 15-40 watt iron is just fine.
  2. 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.
  3. Glue Gun. We'll use hot glue to hold the LED in the ornament.

Preparing the Ornament

If you're using a clear plastic ornament, you'll need to stick something in the inside to diffuse the LED.  I found some opaque tape - I just cut it into 1" squares and stuck it all along both halves of the inside;


Then, I used a dremel to put a small hole through the plastic;


 

Connecting the LED

The LED has four leads, they're connected to each of the colors like this;



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!

Picking Stocks

It's time to decide what stocks to track!  Start by downloading the software and unzipping it to your desktop.  Open Stock_001.spin and scroll down to the bottom.  See the lines;



This is the webpage that contains our stock quote.  Change the line:
uri byte "/ig/api?stock=DJIA",0
to 
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
For US companies, just use the listed ticker;
  • CSCO (Cisco Systems)
  • AAPL (Apple)
  • MCD (McDonald's)
For TSE, use the SIC + ".T"
  • 2802.T (Ajinomoto)
  • 1178.T (Mitsui)
  • 8729.T (Sony Financial)
A few more exchanges; 
  • HSE uses the SIC + ".hk",
  • LSE uses the ticker + ".L"
  • SSE uses the SIC + ".ss"
One last thing to setup;

IP settings

The 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 .

Tracking Other Stuff

The 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;

serv.addattrib(string("serverload"),string("status"), @remotedata)

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!
 

Other Stuff

Get Our RSS Feed

Cool Project