Python-based script for tracking portfolio prices or simulating portfolios. Whether you're monitoring your existing holdings or experimenting with portfolios, this script will be useful.
It helps users to allocate investment amounts equally or specify allocations manually. Share prices are displayed in ₹ (Indian Rupees), intended for Indian users. However, displaying prices in other currencies might be updated in future.
Features
Features
-
Create & Track Portfolios – Users can create a stock portfolio by:
Splitting an entered amount equally among selected companies.
Manually selecting share companies and specifying the number of shares.
-
Recent Price Updates – Fetches the recent share prices when the script runs.
-
Profit & Loss Calculation – Compares the initial and current prices to display profit/loss.
-
CSV Portfolio Storage – Saves portfolios in a CSV file with timestamps.
-
Re-execution Analysis – Load a previous portfolio anytime to see its performance.
-
Delete Portfolios – Remove saved portfolios if no longer needed.
Requirements • Python 3.7 or higher • Libraries: ◦ yfinance ◦ pandas ◦ numpy
Install the required libraries using pip:
pip install yfinance pandas numpy
Folder Structure • Configuration/ : Stores configuration file. • Log/ : Contains log files for program activity. • Portfolio_List/ : Contains files related to created portfolios.
Usage 1. Clone the Repository:
`git clone https://github.com/skylib11/Portfolio_Creator
cd Portfolio_Creator
2. Execute the Program: python3 portfolio_manager.py
3. Main Menu Options: Upon executing the program, you'll see the following menu options:
Main Menu:
- Create Portfolio
- Show Portfolio
- Delete Portfolio
- Exit
Option 1: Create Portfolio The script will ask "Do you want to split the investment amount equally or enter details manually?
- Split equally
- Enter manually Enter your choice (1/2):"
1. Split equally: The program will automatically distribute your total investment equally across the shares.
2. Enter manually: Specify the amount to invest in each stock.
You will be prompted to enter share market company symbols (e.g., RELIANCE.NS for Reliance Industries Limited, TCS.NS for Tata Consultancy Services Limited). Enter the symbols
After entering the share symbols and allocation, you will be prompted with:
Do you want to save this portfolio? (y/n):
- y: Saves the portfolio to a file.
- n: The data will not be saved.
Option 2: Show Portfolio Displays the existing portfolio. Then, you will be prompted with:
Do you want to view it with recent prices and profit calculations? (y/n):
- y: Displays the portfolio with real-time stock prices and calculates the profit/loss for each stock.
- n: Shows just the portfolio data without the current prices or profit/loss calculations.
Option 3: Delete Portfolio If you want to delete an existing portfolio, select this option. You will be shown a list of portfolios and prompted:
Enter your choice:
Option 4: Exit Exits the program.
Option 1: Create Portfolio - Split Equally
Option 1: Create Portfolio - Enter Manually
Option 2: Show Portfolio
Option 3 : Delete Portfolio , Option 4 : Exit
License
Copyright (c) 2025
Permission is hereby granted, free of charge, to any individual to use, copy, and distribute this software for personal and commercial purposes, subject to the following conditions:
- The software must not be resold, sublicensed, or used as part of a commercial product or service.
- The software must not be modified and redistributed.
- Attribution to the original creator must be included in any copies or distributions.
- The software is provided "as is," without warranty of any kind. The author is not responsible for any consequences arising from its use.
- Companies or organizations must obtain explicit permission before using, modifying, or using these scripts.
This project and scripts were generated with the assistance of ChatGPT.
Acknowledgments • Yahoo Finance for financial data. • Developers and contributors to the yfinance library.
README generated with ChatGPT (OpenAI).