A real-time portfolio management dashboard that displays stock data from yfinance with live updates, search functionality, and portfolio management features.
- Live Price Updates: Stock prices update every 30 seconds using yfinance
- Visual Indicators: Live data is marked with animated indicators
- Real-time Search: Search for stocks with live price data
- Portfolio Tracking: Real-time updates for holdings and performance
- Stock Search: Search for stocks by symbol or company name
- Live Data: Search results show current prices and daily changes
- Add to Portfolio: Click "Add" to purchase stocks and add to holdings
- Debounced Search: Search is optimized with 500ms debouncing
- Holdings Table: View current holdings with real-time prices
- Buy/Sell Modals: Interactive modals for buying and selling stocks
- Performance Tracking: Real-time gain/loss calculations
- Asset Allocation: Visual breakdown of portfolio composition
- Real-time Updates: Automatic refresh every 30 seconds
- Visual Feedback: CSS animations for live data indicators
- Search Optimization: Debounced search to reduce API calls
- Modal System: Interactive buy/sell modals with validation
- yfinance Integration: Real-time stock data fetching
- Search API: Stock symbol search with live price enrichment
- Real-time Endpoints: Dedicated endpoints for live data updates
- Error Handling: Robust error handling for API failures
frontend/scripts.js: Main JavaScript logic for real-time updatesfrontend/style.css: CSS for live data indicators and animationsbackend/app/routes/search.py: Stock search with yfinance integrationbackend/app/routes/holdings.py: Real-time holdings data endpointbackend/app/utils/yfinance_helper.py: yfinance data fetching utilities
- Search for Stocks: Type in the search box to find stocks
- View Live Data: Real-time prices are marked with animated indicators
- Add to Portfolio: Click "Add" button to purchase stocks
- Monitor Holdings: View your portfolio with live price updates
- Sell Stocks: Use the "Sell" button to sell holdings
- 30-second Updates: Automatic refresh of all stock data
- Visual Indicators: Green pulsing dots for live data
- Price Highlighting: Current prices are highlighted with live indicators
- Update Feedback: Visual feedback when data is being updated
GET /api/search?q=<query>: Search for stocks with live dataGET /api/holdings: Get current portfolio holdingsGET /api/holdings/realtime?symbols=<symbols>: Get real-time price dataPOST /api/stock/add: Add stocks to portfolioPOST /api/stock/sell: Sell stocks from portfolio
To get the project up and running on your local machine, follow these simple steps.
- Python 3.x
pipfor installing Python packages
-
Navigate to the backend directory:
cd backend -
Create and activate a virtual environment:
- On macOS and Linux:
python3 -m venv venv source venv/bin/activate - On Windows:
python -m venv venv .\venv\Scripts\activate
- On macOS and Linux:
-
Install the required packages:
pip install -r requirements.txt
-
Run the Flask application:
python app.py
The backend server will start on
http://localhost:5001.
-
Navigate to the frontend directory:
cd frontend -
Open
index.htmlin your web browser: You can do this by double-clicking the file or by right-clicking and selecting "Open with" your preferred browser.>