Once in while I get interrested in things that I wasn’t interrested for a long time. This time it are shares – again after the “big” stock market crash in 2001/2002 ;-).
Nowadays I wouldn’t invest in stocks as easily as I had done it 6 years ago. I’d watch them very carefully, eventually jump in at a certain stop buy course and jump out at a predefined stop loss course – always taking the risk of loosing some money, so this would be money that I eventually even don’t need at the moment.
Somewhen I started out with a virtual depot on maxblue. I added some stocks I would like to watch and eventually buy and started to watch them. Now, you don’t have always time to watch real time intraday quotes when you have work to do – and after a while I thought… Hey, it would be cool to have an application doing that for you!
Why not? This application is supposed to do several simple things:
- manages a kind of virtual depot, where you can add/remove and watch stocks
- every a certain amount of time fetches real time quotes for the stocks
- displays those quotes over the time in a chart and as text, highlighted in neat, appropriate colors
- saves the quotes in a kind of storage for later retrieval and eventually analysis
- The most important thing: it alerts you when a quote for a particular stock is reached that you want to be alert on
Simple and clear defined requirements, aren’t it ;-)? And an ideal task for a bad-weather-weekend hack in Tcl. And actually, I did it on a weekend… Well almost, let’s summarize the amount of work that I spent up to 16h, two days full time.
This is done with around 700 lines of Tcl code – just want to mention that. It runs in the background and fetches actual stock quotes from yahoo every minute (they offer a service where you can download CSV files with a set of stocks). Then the quote is displayed in the appropriate chart and the labels on the canvas are updated. Along with this, the new quote is saved in a metakit database named stocky.mk in your ::env(HOME) directory. You can set alert quotes (stop loss and stop buy) for every stock according to your taste via a right click contextmenu, and specify whether you want to be alerted. If so, every 5 minutes a dialog pops up.
It is possible to set whether you want to be alerted again after 5 minutes or not. The alert dialog is brought to front automatically, so you cannot miss it.
I don’t think that this application get’s extended very much – not now at least. It could be that there are one or two bugs that I missed, they get fixed of course. You are encouraged to drop me a mail on any issue you find.
I state explicitely, that you should use the tool only at your own risk. I provide absolutely no warranty for anything that happens to you, your real stock depot or anything else.
Stocky is wrapped as a starkit, you need Tclkick to execute it. The starkit should work on both, linux and windows. The stocky source is provided under the same licence as Tcl. It can be obtained by unwrapping the starkit.
Download stocky from the tloona sourceforge project.