Skip to content

About

A console-based Stock Portfolio Tracker developed in Python for the CodeAlpha Python Programming Internship. Calculates total investment value based on user-entered stock quantities and hardcoded prices, with CSV report export.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Task 2: Stock Portfolio Tracker

A console-based stock portfolio tracker built for the CodeAlpha Python Programming Internship.

Developed by: Fahad Ahmad Student ID: CA/DF1/191850

What it does

  • 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 .csv file in a reports/ folder.

Requirements

  • Python 3.8+
  • No external libraries required (uses only the standard library).

How to run

python stock_tracker.py

Example session

Stock 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

Editing stock prices

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.

Project structure

Task2_Stock_Portfolio_Tracker/
├── stock_tracker.py     # main script
├── README.md            # this file
└── .gitignore

Key concepts demonstrated

  • Dictionaries (price lookup table)
  • Input validation with a while loop
  • Basic arithmetic (price × quantity)
  • File handling with the csv module

About

A console-based Stock Portfolio Tracker developed in Python for the CodeAlpha Python Programming Internship. Calculates total investment value based on user-entered stock quantities and hardcoded prices, with CSV report export.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages