A simple yet powerful command-line Stock Portfolio Tracker built with Python that allows users to calculate their investment value using predefined stock prices and optionally generate a portfolio report.
The Stock Portfolio Tracker is a command-line application developed as part of the CodeAlpha Python Programming Internship.
The application enables users to:
- View available stock prices
- Add multiple stocks to their portfolio
- Calculate total investment value
- Generate a detailed investment report
- Save the report as a text file
This project demonstrates the practical implementation of Python dictionaries, loops, functions, conditional statements, file handling, and user input validation.
โ Interactive command-line interface
โ View available stocks and prices
โ Add multiple stocks to a portfolio
โ Automatic portfolio value calculation
โ Detailed investment summary
โ Optional report generation (.txt)
โ User-friendly menu system
โ Input validation and error handling
| Technology | Purpose |
|---|---|
| Python | Core Programming Language |
| Dictionary | Store stock prices |
| Functions | Modular programming |
| Loops | Menu navigation |
| Conditional Statements | Decision making |
| File Handling | Report generation |
| CLI | User interaction |
CodeAlpha_Stock_Portfolio_Tracker/
โ
โโโ portfolio_tracker.py
โโโ README.md
โโโ LICENSE
โโโ requirements.txt
โโโ .gitignore
โ
โโโ screenshots/
โ โโโ menu.png
โ โโโ stocks.png
โ โโโ report.png
โ โโโ save_report.png
โ
โโโ assets/
โโโ demo.gif
git clone https://github.com/samyakjainx/CodeAlpha_Stock_Portfolio_Tracker.gitcd CodeAlpha_Stock_Portfolio_Trackerpython portfolio_tracker.py===================================
STOCK PORTFOLIO TRACKER MENU
===================================
1. View Available Stocks & Prices
2. Calculate Total Investment
3. Exit Program
===================================
AAPL : $180
TSLA : $250
GOOG : $150
MSFT : $420
AMZN : $175
****************************************
YOUR INVESTMENT REPORT
****************************************
AAPL : 5 shares x $180 = $900
TSLA : 2 shares x $250 = $500
----------------------------------------
Total Portfolio Value : $1400
****************************************
screenshots/menu.png
screenshots/stocks.png
screenshots/report.png
screenshots/save_report.png
assets/demo.gif
This project helped in understanding:
-
Python dictionaries
-
Functions and modular programming
-
Loops and menu-driven applications
-
Conditional statements
-
File handling
-
User input validation
-
Basic financial calculations
-
Command-line application development
=== CODEALPHA STOCK PORTFOLIO REPORT ===
AAPL: 5 shares x $180 = $900
TSLA: 2 shares x $250 = $500
----------------------------------------
Total Portfolio Value: $1400
Some exciting features that can be added in future versions:
-
๐ก Live stock prices using APIs
-
๐ Portfolio performance charts
-
๐ CSV and Excel export support
-
๐พ Database integration
-
๐ Search and edit portfolio
-
๐ฅ๏ธ GUI version using Tkinter or PyQt
-
๐ Web version using Flask or Django
Contributions are welcome!
If you'd like to improve this project:
-
Fork the repository
-
Create a new branch
-
Make your changes
-
Commit your changes
-
Open a Pull Request
AI & ML Enthusiast | Python Developer | Open Source Learner
GitHub: https://github.com/samyakjainx/
LinkedIn: https://www.linkedin.com/in/samyakjain-ai/
This project is licensed under the MIT License.
Feel free to use, modify, and distribute this project for educational purposes.
If you found this project helpful, consider giving it a โญ Star on GitHub.
It motivates me to build and share more open-source projects.
Made with โค๏ธ using Python