8000 GitHub - guilhermegranchopro/Prometheus: Quantitative Finance Research
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

guilhermegranchopro/Prometheus

Repository files navigation

πŸ”₯ Prometheus

Prometheus Logo

Python Version License Alpaca API Streamlit TensorFlow Pandas NumPy Scikit-learn Matplotlib Plotly Altair Joblib FuzzyWuzzy Ruff SciPy npm Python-Dotenv Polygon API Client Python-Levenshtein

πŸš€ Overview

Prometheus is an algorithmic trading research platform that integrates with the Alpaca Markets API for trading strategies. This project combines data analysis, machine learning models, and market data analysis to support trading research and development.

Key Accomplishments

  • Published Academic Research: Successfully published "The Financial Torque Hypothesis: Predicting Short-Term Stock Price Movements Using LSTM Neural Networks" on SSRN, achieving over 87% accuracy in stock price movement predictions
  • Comprehensive Data Infrastructure: Built extensive market data collection system supporting multiple feeds (IEX, SIP) with both regular trading hours and extended session data
  • Interactive Research Platform: Developed a full-featured Streamlit web application for data visualization, model analysis, and research insights
  • Multi-Strategy Framework: Implemented research notebooks for different trading approaches (Simons quantitative strategy, Sun Tzu tactical analysis)
  • Machine Learning Integration: Successfully integrated TensorFlow-based LSTM neural networks with real market data for predictive modeling
  • Open Source Contribution: Created a complete research platform with proper documentation, dependency management, and academic citations

Future Roadmap

  • Next.js Frontend Migration: Transition from the current Streamlit-based frontend to a modern Next.js web application for enhanced performance, better user experience, and improved scalability
  • Advanced Portfolio Management Research: Currently developing the second academic publication "Integrating The Financial Torque Hypothesis into Advanced Algorithmic Portfolio Management" which will detail practical implementation strategies and portfolio optimization techniques
  • Enhanced Machine Learning Models: Expand the current LSTM framework to include additional deep learning architectures and ensemble methods
  • Real-time Trading Integration: Develop production-ready trading execution capabilities with advanced risk management systems
  • API Development: Create comprehensive REST APIs for third-party integrations and mobile applications

πŸͺΆ Academic Publications

This project is supported by rigorous academic research published in peer-reviewed venues:

Published Research

The Financial Torque Hypothesis: Predicting Short-Term Stock Price Movements Using LSTM Neural Networks

Authors: Guilherme Grancho Duarte Fernandes, Vasco V. R. Serpa Pereira

Abstract: This paper introduces the Financial Torque Hypothesis, which asserts that Volume-Weighted Average Price and Trade Count are critical indicators for predicting stock price movements. By incorporating these features into a Long Short-Term Memory Neural Network, our model achieved over 87% accuracy in predicting stock-price increases over a three-hour horizon, based on 21 months of previously unseen test data. We also perform a comprehensive comparative analysis of model performance using two datasets: one that spans the entire trading sessionβ€”pre-market, regular-market and after-hoursβ€”and one confined to regular-market hours. Our results reveal that models trained on full-session data consistently outperform those built on regular-hours-only data, delivering a 15% improvement in predictive accuracy.

Citation:

Fernandes, Guilherme Grancho Duarte and Pereira, Vasco, The Financial Torque Hypothesis: 
Predicting Short-Term Stock Price Movements Using LSTM Neural Networks (June 20, 2025). 
Available at SSRN: https://ssrn.com/abstract=5288444

Upcoming Research

Integrating The Financial Torque Hypothesis into Advanced Algorithmic Portfolio Management

Authors: Guilherme Grancho Duarte Fernandes, Vasco V. R. Serpa Pereira

Status: Set to be published in the coming months

This upcoming publication will detail the practical implementation of the Financial Torque Hypothesis within the Prometheus trading platform and its integration into advanced portfolio management strategies.

πŸ–₯️ Interactive Frontend Dashboard

The project includes a Streamlit-based web application that provides:

  • Portfolio Monitoring: Tracking of positions and performance metrics
  • Strategy Visualization: Charts displaying strategy performance
  • Risk Management Interface: Tools for monitoring and adjusting risk parameters
  • Market Data Analysis: Data visualization and analysis tools
  • Academic Research Integration: Access to research findings and model insights

Launching the Frontend

Ensure Streamlit is installed (pip install streamlit).

streamlit run frontend/my-streamlit-app/Home.py

The frontend application is located in the frontend/my-streamlit-app/ directory and serves as the primary user interface for interacting with the Prometheus trading platform.

✨ Features

  • Market Data Integration

    • Integration with Alpaca Markets API
    • Data collection with rate limit management
    • Support for multiple timeframes and market data types (IEX, SIP)
  • Trading Research Models

    • Machine learning model integration with TensorFlow
    • Custom trading strategies research (Simons, Sun Tzu)
    • Research-based approach with separate modules for different strategies
    • Structured model management and evaluation (see Models/ directory)
  • Data Analysis & Visualization

    • Market data analysis using pandas and numpy
    • Data visualization with matplotlib and plotly
    • Performance metrics and reporting
    • Historical data analysis and storage for various sources (see Data/ directory)
  • Risk Management Research

    • Position sizing algorithms research
    • Stop-loss and take-profit mechanisms research
    • Portfolio diversification strategies research
    • Risk assessment tools research
  • Live Trading Research

    • Jupyter notebook for live trading research and monitoring (see Live_Trading/ directory)

πŸš€ Usage

  1. Launching the Frontend Dashboard

    Ensure Streamlit is installed (pip install streamlit).

    streamlit run frontend/my-streamlit-app/Home.py
  2. Data Collection and Analysis

    (Refer to notebooks within Data/ subdirectories or specific strategy research)

    # Example: Initialize API connection (ensure credentials are set)
    import alpaca_trade_api as tradeapi
    
    api = tradeapi.REST(
        key_id='YOUR_API_KEY',          # Preferably set via environment variables
        secret_key='YOUR_SECRET_KEY',  # Preferably set via environment variables
        base_url='https://paper-api.alpaca.markets'
    )
    
    # Example: Fetch market data
    # data = api.get_bars('AAPL', '1D', '2024-01-01', '2024-04-15').df # Original example
    # For more detailed data handling, see notebooks in Data/ or strategy research folders.
  3. Runni 8000 ng Trading Strategies

    # Note: The strategy modules referenced below are research notebooks
    # and not standalone importable modules. Refer to the actual notebook files:
    # - Simons/backend/Simons.ipynb 
    # - Sun_Tzu/backend/Ronin_SunTzu.ipynb
    
    # For actual strategy implementation, see the notebook files directly
  4. Live Trading

    Open and run cells in Live_Trading/Live_Trading.ipynb after appropriate setup and risk assessment.

πŸ“ˆ Performance

The platform supports research into multiple trading strategies:

  • Simons Strategy: Quantitative trading research approach (see Simons/backend/Simons.ipynb)
  • Sun Tzu Strategy: Tactical market analysis research (see Sun_Tzu/backend/Ronin_SunTzu.ipynb)

Performance metrics can be analyzed through the provided research notebooks.

πŸ› οΈ Installation

  1. Clone the repository:

    git clone [YOUR_REPOSITORY_URL]
    cd Prometheus
  2. Create and activate a virtual environment:

    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  3. Install required dependencies:

    pip install -r requirements.txt
  4. Set up your Alpaca API credentials:

    • Create an account at Alpaca Markets
    • Generate your API keys
    • Configure your credentials in the appropriate configuration files (e.g., within Simons/Settings/ or as environment variables)

πŸ“Š Project Structure

Prometheus/
β”œβ”€β”€ Assets/                     # Project assets (e.g., logo)
β”‚   └── Images/
β”œβ”€β”€ Data/                       # Processed and raw market data
β”‚   β”œβ”€β”€ IEX/                    # Data from IEX feed
β”‚   β”œβ”€β”€ Regular Hours/          # Data filtered for regular trading hours
β”‚   └── SIP/                    # Data from SIP feed
β”œβ”€β”€ frontend/                   # Streamlit frontend application
β”‚   └── my-streamlit-app/
β”‚       └── Home.py             # Main Streamlit app file
β”œβ”€β”€ Live_Trading/               # Notebooks and scripts for live trading
β”‚   └── Live_Trading.ipynb
β”œβ”€β”€ Models/                     # Trained models, evaluation, and related notebooks
β”‚   β”œβ”€β”€ IEX/
β”‚   β”œβ”€β”€ Regular Hours/
β”‚   β”œβ”€β”€ SIP/
β”‚   └── Table.ipynb
β”œβ”€β”€ Simons/                     # Simons trading strategy research
β”‚   β”œβ”€β”€ backend/                # Research notebooks for Simons strategy
β”‚   β”œβ”€β”€ Images/                 # Images related to Simons strategy
β”‚   β”œβ”€β”€ Paper/                  # Research paper published on SSRN 
β”‚   β”œβ”€β”€ Report/                 # Reports and results for Simons
β”‚   └── Settings/               # Configuration for Simons strategy
β”œβ”€β”€ Sun_Tzu/                    # Sun Tzu trading strategy research
β”‚   β”œβ”€β”€ backend/                # Research notebooks for Sun Tzu strategy
β”‚   └── research/               # Research for Sun Tzu strategy
β”œβ”€β”€ .venv/                      # Python virtual environment
β”œβ”€β”€ .git/                       # Git version control files
β”œβ”€β”€ .gitignore                  # Specifies intentionally untracked files that Git should ignore
β”œβ”€β”€ CITATION.cff                # Citation file for the project
β”œβ”€β”€ LICENSE                     # Project license (MIT)
β”œβ”€β”€ pyproject.toml              # Project build configuration (PEP 518)
β”œβ”€β”€ README.md                   # This file
β”œβ”€β”€ requirements.txt            # Project dependencies
└── uv.lock                     # Lock file for uv package manager

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Alpaca Markets for providing the trading API
  • Contributors and maintainers
  • The open-source community

πŸ“§ Contact

Guilherme Grancho - guilhermegrancho@tecnico.ulisboa.pt / guilherme.fernandes25@imperial.ac.uk

  • Department of Earth Science and Engineering, Imperial College London
  • Department of Physics, Instituto Superior TΓ©cnico, Lisbon

Vasco Pereira - vasco.serpa.pereira@tecnico.ulisboa.pt

  • Department of Computer Science and Engineering, Instituto Superior TΓ©cnico, Lisbon
0