Stock Profit

Today I found that both Fannie Mae and Freddie Mac took a severe beating on the stock market. This was not a one day event either. Their stock values have been declining during the past year. This week has been especially brutal. Investors are worried the government is going to bail out both companies and make the stock worthless, passing the cost on to the United States taxpayers. This scenario may very well play out. But I decided to take a position in both companies today.

There was a lot of trading and volatility in both of these stocks today. So I found myself checking the stock price every hour or so. Then I had to take into account my purchase price for both stocks to compute my profit for these stocks. These computations got old really quickly. Why shouldn’t I write a computer program to do this for me automatically? Now that I think about it, I did once write a program like this to calculate my profits (eventually losses) from purchasing Movie Gallery stock. Here is a screen shot of that program.


I now recall that I got tired of looking up the current trading price of Movie Gallery stock. So I added in a feature whereby the program automatically visited Yahoo Finance and pulled the latest price for me. The problem with this program is that is was hard coded for Movie Gallery stock. And it only supported profit computation for one stock at a time. What I really need to a portfolio profit calculator program. It will allow you to input the stocks you have purchased, along with the purchase prices. It will then grab the recent stock price and compute your overall profit.

Yes I know that brokerage web sites already do this for you. But I do not want to log into those sites and enter my credentials on any computer other than my locked down home computer. However I still would like a daily update of my profitability. Thus I need a flexible program to be written. Maybe I can carve out some time to do this soon. With the wild price swings of Fannie Mae and Freddie Mac, I am going to need this program pronto.

As a final note, I remember in the really old days I coded up a really simple version of such a program. I have since lost the source code for that program. It was called ka-ching, because every time you ran it, it would make a ka-ching money sound if it computed a profit. Isn’t that funny? Conversely this program would make a toilet flushing sound if it computed a loss for your stocks. In my current work environment, I am going to have to pass on the sound effects.