Saturday, June 20, 2009

VGA Pixelclock in Verilog

I've been teaching myself Verilog and just recently got VGA working. More info and full source soon.

Thursday, August 14, 2008

Four line program for historical dividend and split data

I spent some time reverse engineering how the charts in Google Finance work. I was mostly interested in the historical dividend and stock split information. I finally found it, it's stored as a JavaScript variable in the page. I wrote a 4 line Python program which will pull the page from Google, find the variable and import it as a list of dictionaries.

import urllib2, re
url = "http://finance.google.com/finance?q=GE"
eventReg = re.compile("_chartConfigObject\.corpActionsArray = eval\('\((.*)\)'\);")
eventData = eval(eventReg.search(urllib2.urlopen(url).read()).group(1))

Monday, August 11, 2008

Small update to div-data

There was a bug in the div-update application having to do with the growth calculations. I had just hard coded the division of the sum of dividends regardless of whether or not their was dividend data for the entire period. Instead if there isn't data for the entire time period I respond with "--" for those columns.

Tuesday, August 5, 2008

I'm back and brought financial goodies.

So I'm back after a rather long unplanned hiatus. In the intervening time I've moved, hosted several sets of out-of-towners, began a career change and blew the disc between vertebrates S1 and L5. Blowing my disc was the big one, I've been out of work and flat on my ass for over three weeks. The meds they give you have really intense side effects, namely mania and psychosis. The mania manifested itself as an obsession with CD rates and dividend producing equities.

While doing my research I stumbled upon a blog post which provides a tutorial on using Google Docs as an investment calculator. This inspired me to attempt to create my own spreadsheet to help me do research on prospective investments. I was quickly disappointed by Google Docs' GoogleFinance function, it was just way too limiting. Primarily I wanted to be able to get things like dividend yield and historical dividend growth. Yahoo provides historical dividend data exportable as a CSV but I couldn't figure out how to import it into Google Docs and aggregate the data cleanly. Frustrated but not defeated I cranked out a little web app yesterday which does exactly that and deployed it to Google AppEngine.

The URL has one parameter, "t" which is the ticker symbol for the equity that you are interested in. It returns 5 columns of CSV formatted data: the cash value of the last dividend payment, the date of the last payment, the dividend frequency, the average dividend growth for the previous 5 years, the average dividend growth for the previous 10 years. If the stock doesn't produce a dividend then the first three fields have a value of "--" and the last two will have a value of 0.0. In order to use this app in conjunction with GoogleDocs use the formula below replacing A2 with the cell that contains your ticker value.

If you do use this application and have suggestions, bug reports or feature requests please contact me. In addition to me providing you with better data it will help me learn what other people think is important when doing research.

Example Formula:

=importData("http://dividend-data.appspot.com/?t=" & $A2)
URL Example:
http://dividend-data.appspot.com/?t=IBM
Source can be found here.

Monday, June 9, 2008

ISight Screen Saver

A while ago I wrote a screen saver for OSX as a learning exercise. I wanted to learn how to access the camera built into my Macbook Pro and get my feet wet with OSX. I was going to integrate face recognition using the OpenCV or MPT libraries but never got around to it. I'm posting it now because some of the guys at work saw it and wanted a copy. I added the source to my SVN repository and made a binary available via the download site. The screen saver is really as minimalistic as it gets. It uses the new QTKit API for accessing the camera and sets the capture view to the frame size of the inherited ScreenSaverVeiw class. The QTKit API came out around the time of Leopard's release and is much simpler and has better performance then the old streamgrabber API which had been around since the OS 9 days. To install the binary just download the zip file, unzip and double click. It will automatically install itself and become available as a screen saver in the system preferences.