A comprehensive stock analysis and prediction platform featuring real-time market data, technical analysis, CAPM calculations, and ARIMA-based price forecasting.
- Calculate Beta and Expected Returns using Capital Asset Pricing Model
- Analyze stock risk vs market performance
- Interactive price performance charts
- Compare multiple stocks simultaneously
- Real-time stock data visualization
- Technical indicators and moving averages
- Volume analysis and trend identification
- Historical price charts with multiple timeframes
- 30-day price forecasting using ARIMA models
- Interactive prediction charts
- Model accuracy metrics (RMSE)
- Search by stock ticker or company name
- FastAPI: Modern, fast web framework for building APIs
- Streamlit: Interactive web app framework
- yFinance: Real-time financial data
- Pandas & NumPy: Data manipulation and analysis
- Plotly: Interactive visualizations
- Statsmodels: ARIMA time series modeling
- Scikit-learn: Machine learning utilities
- React 19: Modern UI framework
- Vite: Fast build tool and dev server
- Tailwind CSS: Utility-first CSS framework
- Recharts: React charting library
- Axios: HTTP client for API calls
- Lucide React: Beautiful icons
Stock-Analyzer/
βββ backend/
β βββ main.py # FastAPI application entry point
β βββ Home.py # Streamlit main page
β βββ pages/ # Streamlit pages
β β βββ 1_CAPM_Calculator.py
β β βββ 2_Stock_Analysis.py
β β βββ Stock_Prediction.py
β βββ routers/ # FastAPI route handlers
β β βββ capm.py
β β βββ stock_analysis.py
β β βββ stock_prediction.py
β βββ models/ # Pydantic models
β βββ requirements.txt
βββ frontend/
β βββ src/ # React source code
β βββ package.json
β βββ vite.config.js
βββ README.md
- Python 3.11+
- Node.js 18+
- npm or yarn
- Clone the repository
git clone <repository-url>
cd Stock-Analyzer- Set up Python environment
cd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies
pip install -r requirements.txt- Run FastAPI server
python3 -m uvicorn main:app --reload --host 0.0.0.0 --port 8000- Run Streamlit app (alternative interface)
streamlit run Home.py- Navigate to frontend directory
cd frontend- Install dependencies
npm install- Start development server
npm run dev- FastAPI Backend: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- Streamlit App: http://localhost:8501
- React Frontend: http://localhost:5173
POST /api/capm/calculate- Calculate CAPM for selected stocksGET /api/capm/available-stocks- Get list of available stocks
GET /api/analysis/{symbol}- Get technical analysis for a stockGET /api/analysis/{symbol}/indicators- Get technical indicators
POST /api/prediction/predict- Generate price predictionsGET /api/prediction/model-info- Get model information
Create a .env file in the backend directory:
# Optional: Add any API keys or configuration
YAHOO_FINANCE_API_KEY=your_key_hereThe FastAPI backend is configured to allow requests from:
- http://localhost:3000
- http://localhost:5173
- http://localhost:5174
- http://127.0.0.1:3000
- http://127.0.0.1:5173
cd backend
# Run with auto-reload
python3 -m uvicorn main:app --reload --host 0.0.0.0 --port 8000cd frontend
# Run with hot reload
npm run devcd frontend
npm run build- Select multiple stocks (e.g., TSLA, AAPL, MSFT)
- Choose analysis period (1-10 years)
- View calculated Beta values and expected returns
- Compare normalized price movements
- Search for a stock by name or symbol
- View 30-day price forecast
- Analyze model accuracy (RMSE)
- Compare predicted vs historical prices
- Enter stock symbol
- Select time period (1D to Max)
- View candlestick charts and indicators
- Analyze volume and price trends
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Yahoo Finance for providing free financial data
- Streamlit and FastAPI communities for excellent frameworks
- React and Vite teams for modern frontend tooling
For support, email [your-email@example.com] or create an issue in the repository.
Made with β€οΈ by [Your Name]