AI-powered stock analytics dashboard built with FastAPI, JavaScript, and Chart.js. It provides technical analysis indicators, multi-panel financial charts, and short-term AI price forecasting in a modern trading-terminal style interface.
BroStock AI is a full-stack financial analytics dashboard that combines technical indicators and machine learning forecasting into an interactive web interface.
The system fetches real-time market data, calculates indicators such as RSI, MACD, and moving averages, and visualizes them through synchronized multi-panel charts.
- Live stock price fetching via Yahoo Finance (yfinance)
- Interactive dynamic price chart built with Chart.js
- 7-day and 21-day Moving Averages (MA7, MA21)
- Toggle controls for indicator visibility
- Adaptive chart rendering for cleaner trend visualization
- Integrated volume bars within the price chart
- Dual-axis scaling for accurate price/volume comparison
- Helps confirm price movement strength
- Dedicated momentum analysis panel
- Overbought (70) and Oversold (30) reference levels
- Backend-calculated rolling averages
- Defensive handling of NaN / infinite values
- EMA(12) and EMA(26) MACD calculation
- 9-period Signal line
- Histogram visualization
- Dynamic green/red momentum bars
- Separate synchronized chart panel
BroStock AI now includes an AI-powered forecasting module that predicts short-term price movement using linear regression trend modeling.
- Separate AI Forecast chart mode
- Historical price vs predicted future prices
- Forecast displayed as dashed projection line
Users can dynamically select forecast length:
- 7 Days
- 14 Days
- 30 Days
The chart automatically updates without reloading the page.
The backend trains a Linear Regression model on historical price data to estimate short-term price trajectory. While intentionally simple, it demonstrates the integration of machine learning workflows inside a real-time analytics dashboard.
- Technical Mode / AI Forecast Mode toggle
- Forecast horizon selection (7D / 14D / 30D)
- Indicator visibility toggles
- Responsive trading-terminal style interface
- Smooth chart transitions and redraws
Financial data can contain missing or unstable values.
The backend includes defensive engineering to ensure stable visualization.
- Safe float sanitization before JSON serialization
- NaN / infinite value handling
- Pandas multi-index normalization
- Stable backend-frontend data contracts
- Python
- FastAPI
- yfinance
- pandas
- NumPy
- scikit-learn (Linear Regression)
- HTML
- CSS (custom dark UI)
- JavaScript (ES Modules)
- Chart.js
User Input
→ JavaScript fetch request
→ FastAPI backend
→ Yahoo Finance data (yfinance)
→ Backend computes indicators (MA, RSI, MACD)
→ Linear Regression model generates forecast
→ Safe JSON serialization
→ Chart.js renders interactive dashboard
All financial calculations and forecasting are performed in the backend to ensure numerical stability and clean architecture.
Used to smooth price data and identify short-term vs medium-term trends.
Confirms strength behind price movement. High volume during breakouts often signals stronger conviction.
Momentum oscillator:
- Above 70 → Overbought
- Below 30 → Oversold
Trend-following momentum indicator:
- MACD crossing above signal → Bullish shift
- MACD crossing below signal → Bearish shift
- Histogram visualizes momentum acceleration
backend/ ├── main.py └── stock_analyzer.py
frontend/ ├── index.html ├── style.css └── js/ ├── app.js ├── charts.js ├── ui.js └── api.js
The application follows a clear separation of concerns:
- Backend handles data, indicators, and forecasting
- Frontend handles rendering and user interaction
Clone the repository: git clone https://github.com/RDC4321/BroStock-AI.git cd BroStock-AI
Install dependencies: pip install -r requirements.txt
Run the server: uvicorn main:app --reload
Open in browser: http://127.0.0.1:8000
Future improvements planned for BroStock AI:
- AI confidence interval bands
- Portfolio backtesting tool
- Candlestick chart mode
- Time-range selector (1W, 1M, 3M, 1Y)
- Crosshair synchronization across charts
- AI buy/sell signal engine
- News sentiment integration
- Public cloud deployment
This project demonstrates practical skills in:
- Full-stack system design
- Financial indicator implementation
- Machine learning integration
- API design & structured JSON contracts
- Defensive data engineering
- Chart.js multi-panel visualization
- Interactive UI state management It serves as both a learning project and a portfolio piece showcasing applied financial analytics and web engineering.
This project is for educational and portfolio purposes only. It does not provide financial advice or trading recommendations.
