Get Stock Information (Tcl program by Luis F. Guzman)

Get Stock Information (gesi): Tcl program by Luis F. Guzmán.

This was my first Tcl program, but it has proven to be quite useful. It extracts information about stocks from , and it prints it to the standard output. The user can specify the information required through command options. Below are the synopsis and the options supported by gesi:

    SYNOPSIS: gesi ?-s? ?-l? ?-d? ?-t? ?-c? ?-o? ?-h? ?-g? ?-v? symbol ?symbol...?
            s = stock symbol
            l = last price
            d = last price date
            t = last price time
            c = change since yesterday
            o = open
            h = high for today
            g = low for today
            v = volume
The order in which the options are provided is also important. For example:
    $ gesi -s -p -v -t -d rhat
will result in:
    $ gesi -d -t -s -p -v rhat
will result in:

Also, gesi is case independent. The stock symbols can be typed with either upper or lower case. If more than one stock symbol is entered, gesi will print a stock record per line. The order in which the symbols are typed also counts. These features and the default options are illustrated below.

    $ gesi RHAT MSFT GE
    $ gesi -s -p GE RHAT MSFT

I haven't written a man page for gesi yet, but if an invalid option is typed or if gesi is typed without arguments, the synopsis and options are typed to the standard output. This page should also be useful.

Finally, I want to mention that my inspiration for writing this program was a five line similar example in a book by Brian W. Kernighan and Rob Pike: The Practice of Programming . It is a good book.

View the Tcl code.
Download gesi (gz) or gesi (zip).

Go to Author's home page Luis F. Guzmán
Mar. 27, 2004 1:26 pm US/Eastern