AlphaQuant is an AI-powered personalized investment advisor that provides data-driven insights, predictions, and portfolio optimization using cutting-edge techniques in machine learning, Bayesian forecasting, and reinforcement learning.
- Data Pipeline: Collect, clean, and process market data from various sources
- Sentiment Analysis: Analyze news and social media for market sentiment
- Bayesian Forecasting: Generate probabilistic price forecasts with uncertainty quantification
- Machine Learning Predictions: Predict market movements using traditional ML and deep learning
- Portfolio Optimization: Optimize portfolios based on user preferences and risk tolerance
- Reinforcement Learning: Develop adaptive trading strategies using RL techniques
- REST API: Access all features through a well-documented FastAPI interface
- Streamlit Dashboard: Interactive web interface for visualizing insights and predictions
AlphaQuant/
├── src/
│ ├── data_pipeline/ # Market data acquisition and processing
│ ├── models/ # Price forecasting models
│ ├── reinforcement_learning/ # RL agents for portfolio management
│ ├── api/ # FastAPI application and endpoints
│ └── utils/ # Helper utilities
├── data/ # Data storage (cached and processed)
├── notebooks/ # Jupyter notebooks for exploration
├── tests/ # Unit and integration tests
├── output/ # Generated plots and results
├── app.py # Streamlit dashboard application
├── demo.py # Demo script showcasing functionality
└── requirements.txt # Project dependencies
- Python 3.8+
- Pip package manager
-
Clone the repository:
git clone https://github.com/yourusername/alphaquant.git cd alphaquant -
Create a virtual environment (optional but recommended):
python -m venv venv # On Windows: venv\Scripts\activate # On macOS/Linux: source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
- Copy the
.env.examplefile to create a new.envfile:cp .env.example .env
- Edit the
.envfile with your API keys:NEWS_API_KEY=your_news_api_key ALPHA_VANTAGE_API_KEY=your_alpha_vantage_key POLYGON_API_KEY=your_polygon_key - You'll need at minimum a News API key for the demo to work properly. Sign up at newsapi.org to get a free API key.
- Copy the
First, run the demo script to generate the necessary data files and visualizations:
python demo.pyThe demo will:
- Fetch and process data for selected stocks
- Generate market overview and sentiment analysis
- Create Bayesian forecasts with uncertainty estimates
- Train ML models for price prediction
- Generate stock recommendations
- Demonstrate a simplified reinforcement learning trading environment
Check the output/ directory for generated visualizations and CSV files.
After running the demo script, launch the interactive Streamlit dashboard:
streamlit run app.pyThe dashboard will be available at:
- Local URL: http://localhost:8501
- Network URL: http://your-ip-address:8501
The Streamlit dashboard provides:
- Market overview with sentiment analysis
- Interactive stock analysis tools
- Bayesian forecasting visualization
- Portfolio performance simulation
- Market map visualization
Start the API server:
cd src/api
uvicorn main:app --reloadThe API will be available at http://localhost:8000 with interactive documentation at http://localhost:8000/docs.
Example API endpoints:
GET /stock/{ticker}: Get historical stock data with technical indicatorsPOST /predict: Generate stock price predictionsPOST /recommend: Get investment recommendations for a stockPOST /portfolio/optimize: Optimize portfolio allocationGET /market/overview: Get current market conditions overview
pytest tests/-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Implement your changes and add tests
-
Run tests to ensure functionality
-
Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Open-source libraries that made this project possible
- Financial data providers for making market data accessible
- Academic research in finance, ML, and reinforcement learning that inspired this project