The Stock Portfolio Suggestion Engine is a Python-based application designed to help users allocate their investment funds effectively based on selected strategies. Users can input a dollar amount (minimum $5000 USD), choose investment strategies, and receive recommendations for stocks or ETFs. The engine tracks the performance of the portfolio and provides insights like current value and weekly trends.
-
Investment Strategies:
- Ethical Investing
- Growth Investing
- Index Investing
- Quality Investing
- Value Investing
-
Portfolio Suggestions:
- Assigns stocks or ETFs based on selected strategies.
- At least 3 stocks/ETFs mapped per strategy.
-
Dynamic Portfolio Updates:
- Real-time updates on the portfolio's value using live stock data via APIs.
-
Trend Analysis:
- Tracks the weekly trend (last 5 days) of portfolio value.
-
Interactive Interface:
- User-friendly UI for inputting details and visualizing results.
-
Additional Features:
- Custom strategy combinations.
- Visual charts for portfolio composition and trends.
- Python: Core language for the engine.
- APIs: Fetch live stock data (e.g., Yahoo Finance API, Alpha Vantage).
- Libraries:
- Requests: For fetching live data.
- FastAPI: for sending the api requests and process frontend requests.
-
Input:
- User inputs the dollar amount to invest (min. $5000 USD).
- User selects one or two investment strategies.
-
Portfolio Assignment:
- Based on selected strategies, the engine suggests stocks/ETFs.
- Allocates the investment amount proportionally across the suggestions.
-
Live Updates:
- Retrieves current stock prices via an API.
- Calculates the total portfolio value in real-time.
-
Weekly Trends:
- Tracks portfolio value for the past 5 days and displays a line chart.
- Stock/ETF Suggestions: List of assigned stocks/ETFs based on strategies.
- Allocation Breakdown: How the inputted amount is distributed among suggestions.
- Real-Time Portfolio Value: Total portfolio worth updated with live data.
- Weekly Trend Chart: Visualization of portfolio performance over the last 5 days.
- Python 3.9+
- Node.js 16+ and npm
- Polygon.io API Key
- Git
-
Clone the Repository
git clone https://github.com/yourusername/stock-portfolio-suggestion-engine.git cd stock-portfolio-suggestion-engine/backend
-
Create Virtual Environment
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install Python Dependencies
pip install fastapi uvicorn python-dotenv
-
Configure Environment Variables Create a
.env
file in the backend directory in the Backend/app/ directory:POLYGON_API_KEY=your_polygon_api_key_here
-
Run the FastAPI Server
uvicorn main:app --reload
-
Navigate to Frontend Directory
cd ../frontend
-
Install Node Dependencies
npm install
-
Install Additional Packages
npm install axios recharts react-router-dom @mui/material @emotion/react
-
Run the React Development Server
npm start
- Backend: VSCode with Python extension
- Frontend: VSCode with ES7+ React extension
- Postman for API testing
- Docker Desktop for containerization