You can check out a current demo at http://www.openvest.com/charts ... Or...Just jump straight to the source browser

BarChart is a simple program in two parts:

ovpyq

This component has little to do with producing a bar char or any kind of chart. It is a basic little program to cache stock prices into a local database, Postgres is the default flavor.

Features:

  • Caches all prices into a local database
  • Checks requests to see if they require:
    • updated prices since last the last update
    • more (older) prices because the current request goes back farther
    • checks for any holes (case where there are very old and very recent prices but a missing gap
  • Retrieves missing prices from yahoo and caches them.

This is not great code and the only reason it's still around is cause -- well it just runs. If you want an industrial grade local price plant, ask about updates.

Performs maintains a simple SQL based table of daily stock prices. The base program is not really usable as is (not efficiently any way). DatabaseConnectionPooling to cut down on database connect times and the use of response caching using something like BeakerCache would be more realistic. Actually using the BeakerCache with a memcached server makes this setup really scream.

barchart

Actually turns those prices into an svg stock chart. I originally created this program around 2003 thinking that SVG would take off. OK, so that take-off has been a little slow in coming. If you wish, you can just produce svg charts and use cacoon Batik to convert to png or jpeg files on the fly through your server software.

Again, this is not the best use of this code. Caching and using a templating language like Genshi or Mako might make a lot of sense. The best way to go is probably something like a Genshi template converted to a javascript function. That decreases load time, increases cache efficiency and offloads chart generation to all of the fat clients out there. That is something that will have to wait for some spare time since for my investment style, charting is eye candy and doesn't add to the investment decision making process. YMMV