This is a very basic python script to track market stocks and manage a portfolio. It can be improved a lot and I am going to do add features myself, feel free to download it and modify it as you wish. Hope it can help!
Note: I use ystockquote module to track prices but there are two versions of it with different names for the functions. This script uses version 0.2.4, which is the one to be downloaded using pip. The changes to be made are trivial if you have another version, the function to get price should be replaced with the one in the module you have.
To test if you have the same module you can run
$ nosetests portfolio_tracker.py
It comes with two .txt files that you can use to see how it works, but you will be able to write your own file(s) with your own portfolio(s), delete the existing ones or modify.
To use, just launch the script using python.
$ python portfolio_tracker.py
You will enter a section where you can manage your files or create a new portfolio.