A console-based stock portfolio tracker built for the CodeAlpha Python Programming Internship.
Developed by: Fahad Ahmad Student ID: CA/DF1/191850
- Displays a list of available stocks and their (hardcoded) prices.
- Lets the user build a portfolio by entering stock symbols and quantities.
- Calculates the total investment value.
- Prints a clean summary table to the console.
- Optionally saves the report as a timestamped
.csvfile in areports/folder.
- Python 3.8+
- No external libraries required (uses only the standard library).
python stock_tracker.pyStock symbol (or 'done'): AAPL
Quantity of AAPL shares: 10
Added 10 share(s) of AAPL.
Stock symbol (or 'done'): TSLA
Quantity of TSLA shares: 5
Added 5 share(s) of TSLA.
Stock symbol (or 'done'): done
Portfolio Summary
==================================================
Symbol Qty Price Value
--------------------------------------------------
AAPL 10 $180.00 $1800.00
TSLA 5 $250.00 $1250.00
--------------------------------------------------
TOTAL INVESTMENT: $3,050.00
==================================================
Save this report to a CSV file? (y/n): y
Report saved to: reports/portfolio_report_20260712_103201.csv
Prices are defined in the STOCK_PRICES dictionary at the top of
stock_tracker.py. Add, remove, or update entries there to change the
available stocks.
Task2_Stock_Portfolio_Tracker/
├── stock_tracker.py # main script
├── README.md # this file
└── .gitignore
- Dictionaries (price lookup table)
- Input validation with a
whileloop - Basic arithmetic (price × quantity)
- File handling with the
csvmodule