A simple Stock Portfolio Tracker built using Python as part of my Python Programming Internship at CodeAlpha.
This project allows users to enter stock names and the number of shares they own. The program uses a predefined dictionary containing stock prices and calculates the investment value for each stock and the total portfolio investment.
The total investment is also saved in a .txt file.
- Enter the number of stocks
- Enter stock names and quantities
- Uses a predefined stock-price dictionary
- Calculates individual investment values
- Calculates total investment value
- Handles unavailable stock names
- Saves the total investment to a text file
- Python
- Dictionary
forloopif-elsestatements- User input/output
- Basic arithmetic
- File handling
The program currently contains predefined prices for:
| Stock | Price |
|---|---|
| APPLE | $180 |
| TESLA | $250 |
| $140 | |
| MICROSOFT | $420 |
| AMAZON | $190 |
- Clone this repository.
- Open the project folder.
- Run the Python program:
python "stock portfolio tracker.py"- Enter the number of stocks.
- Enter the stock name and quantity.
- The program will calculate the investment value and total investment.
How many stocks do you want to enter? 2
Enter stock name: APPLE
Enter quantity: 5
AAPL Investment: 900
Enter stock name: TESLA
Enter quantity: 2
TSLA Investment: 500
Total Investment: 1400
The total investment is saved in:
portfolio.txt
Example:
Total Investment: 1400
CodeAlpha_Stock_Portfolio_Tracker/
│
├── stock portfolio tracker.py
├── portfolio.txt
├── stockportfoliotracker-screenshot.png
└── README.md
Through this project, I practiced:
- Python dictionaries
- Loops and conditional statements
- User input and output
- Arithmetic operations
- File handling
- Git and GitHub
This project was developed as part of my Python Programming Internship at CodeAlpha.
⭐ If you find this project useful, feel free to explore the repository.