--------------------------------------------------- viewportfolio Version: 2.0 Release Date: 1 Nov 2000 CVS: $Id$ --------------------------------------------------- Table of Contents - Why? - Basic Usage - Command-line Arguments - Files Included - Miscellaneous --------------------------------------------------- WHY? [Apr 27 2000] Blame Dave Sifry at Linuxcare. He sent an email to an internal Linuxcare mailing list showing how you could get the prices on a series of stocks using a long line of perl code. I had done something similar some time back with python, and I figured I'd pass it along for those preferring python to perl. I did, but then that night I got to thinking... why not do more than just get the stock prices? Why not some other reports and some comparisons? I checked out freshmeat and linuxapps and didn't see that anyone else had really done this, and I was really in the mood to procrastinate on writing some articles I owe various Linux magazines, so I just started coding... after some late nights I figured it was in enough shape to share it. And so here it is... a little fun program to get various stock data and monitor the portfolio that you have - or dream you have! Enjoy... and if you're a python fan and feel like adding functionality, go for it! I won't ever claim to be a great programmer - I just write things to solve needs I have. In this case, to easily view my portfolio without going into various slow web interfaces... --------------------------------------------------- BASIC USAGE The program assumes a data file in the current directory called 'portfolio.dat' (unless changed by command-line options below) that has the following format: Ticker|Shares|InitialPrice The default delimiter is the pipe ('|') symbol, unless changed. To run the program using the provided sample 'portfolio.dat', type (assuming a Unix/Linux prompt without '.' in your path and assuming that 'portfolio.dat' is in your local directory): $ ./viewportfolio.py This will just generate a basic listing of the stocks in your portfolio, their current prices and values, and the overall value of your portfolio. To use several of the command line options at once, try: $ ./viewportfolio.py -c -d ',' -f portfolio2.dat This does a comparison check using a data file 'portfolio2.dat' which uses a comma as a separator. Note that this program relies entirely on Jonathan Corbet's "Quote.py" python module which can be found at ftp://ftp.eklektix.com/pub/Quote/ viewportfolio 2.0 has been tested with version 1.8 of Quote.py which should have been included with the source distribution of viewportfolio. Note that Jonathan has now included changes to the code which allow for quotes to be retrieved from uk.yahoo.com in addition to finance.yahoo.com. Thanks to contributions by William McVey, as of version 2.0 you can now have multiple entries for a single stock in your portfolio file. So if you buy some shares of a stock now, and then buy some more later, you can enter both. In the regular and long reports, the multiple entries will be summarized and one line in the report will show your current value. If you do a comparison report, comparisons will be made for *each* of the multiple entries for a single stock. --------------------------------------------------- COMMAND LINE ARGUMENTS viewportfolio can be run alone as 'viewportfolio.py', but it also has the following command-line options: -c - compares current stock values against initial prices -d symbol - use a different delimiter (i.e. -d ',' to use a comma) -f file - uses data file 'file' instead of 'portfolio.dat' -h - prints out help -l - prints a 'long' listing of more market data -v - verbose output '-h' can't be used with other options, and you can use either '-c' or '-l' but not both. The other options should play nicely together. I generally use '-c -v' or '-l -v'. Note that you can put some of the options together after a dash, such as "-cv" or "-lv" or "-cvf myport.dat" --------------------------------------------------- FILES INCLUDED With this program, there should be the following files: viewportfolio.py - the python program portfolio.dat - sample default data file portfolio2.dat - sample data file using a different delimiter LICENSE - yet another copy of the license BUGS - list of bugs TODO - list of things to do to the code ChangeLog - list of changes --------------------------------------------------- MISCELLANEOUS - For those who are curious, the initial prices set in the two sample data files were those of the listed stocks as of near the end of the day on April 24, 2000. The stocks chosen were purely some of the companies that are Linux-related. 100 shares of each seemed to be a fun value to start with. Microsoft was thrown in purely because it was going through wild gyrations on that particular week in April. And no, it does not represent my actual portfolio. - Python syntax highlighting in VIM truly rocks! - CVS rocks! (the software, not the pharmacy) --------------------------------------------------- Copyright (c) 2000 Dan York, dyork@Lodestar2.com http://www.Lodestar2.com/software/viewportfolio/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version. This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. http://www.gnu.org/copyleft/gpl.html ---------------------------------------------------