Skip to content

EquiFlex Pro — AI/ML-powered long-short equity & options trading bot with Greek-based risk management. Supports multi-strategy alpha, real-time data, deep learning, multi-broker execution, auto-hedging, backtesting, and institutional-grade risk controls.

License

Notifications You must be signed in to change notification settings

bhanukaranwal/EquiFlex-Pro

Repository files navigation

EquiFlex Pro - Advanced Long-Short Equity and Options Trading Bot

Python 3.9+ License: MIT Build Status Coverage

EquiFlex Pro is a next-generation, institutional-grade long-short equity and options trading system that leverages advanced Greek-based strategies, AI/ML techniques, and comprehensive risk management.

🌟 Key Features

Multi-Asset Trading Strategies

  • Equity Long-Short: Multi-factor models with momentum, value, quality, and volatility factors
  • Greek-Based Options: Delta hedging, gamma scalping, theta harvesting, vega management
  • Complex Spreads: Iron condors, butterflies, straddles, and calendar spreads
  • AI/ML Enhanced: Deep learning models for signal generation and market forecasting

Advanced Risk Management

  • Real-Time Greeks Monitoring: Portfolio-level delta, gamma, theta, vega, rho tracking
  • VaR and Stress Testing: Monte Carlo simulations and scenario analysis
  • Dynamic Hedging: Automated position adjustments based on Greek exposures
  • Regulatory Compliance: Built-in trade surveillance and reporting

Institutional-Grade Infrastructure

  • Microservices Architecture: Scalable, cloud-native design
  • Multi-Broker Support: Interactive Brokers, Alpaca, and others
  • Real-Time Data: High-frequency market data ingestion and processing
  • Production Ready: Comprehensive logging, monitoring, and alerting

🚀 Quick Start

Prerequisites

  • Python 3.9+
  • PostgreSQL 12+
  • Redis 6+
  • Docker & Docker Compose (recommended)

Installation

# Clone the repository
git clone https://github.com/bhanukaranwal/EquiFlexPro.git
cd EquiFlexPro

# Run setup script
chmod +x scripts/setup.sh
./scripts/setup.sh

# Configure environment
cp .env.example .env
# Edit .env with your API keys and configuration

# Start services
docker-compose up -d

# Access the dashboard
open http://localhost:8000

Manual Installation

# Create virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt
pip install -e .

# Setup database
python scripts/init_database.py

# Start trading engine
python -m src.core.engine

# Start API server (in another terminal)
python -m src.api.app

📊 Dashboard Preview

The web dashboard provides real-time monitoring of:

  • Portfolio performance and Greek exposures
  • Strategy status and performance metrics
  • Risk metrics and limit monitoring
  • Live order book and trade execution
  • Market data and options chains

🏗️ Architecture

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Web Dashboard │    │   REST API      │    │  Trading Engine │
│   (React/JS)    │◄──►│   (FastAPI)     │◄──►│   (AsyncIO)     │
└─────────────────┘    └─────────────────┘    └─────────────────┘
                                │                       │
                       ┌─────────────────┐    ┌─────────────────┐
                       │   Data Layer    │    │  Strategy Layer │
                       │   (PostgreSQL)  │    │   (Modular)     │
                       └─────────────────┘    └─────────────────┘
                                │                       │
                       ┌─────────────────┐    ┌─────────────────┐
                       │   Risk Manager  │    │  Execution Layer│
                       │   (Real-time)   │    │   (Multi-Broker)│
                       └─────────────────┘    └─────────────────┘

🧠 Machine Learning Models

Signal Generation

  • LSTM Networks: Price and volatility forecasting
  • Random Forest: Factor-based equity signals
  • Gradient Boosting: Multi-timeframe momentum detection
  • Reinforcement Learning: Dynamic portfolio optimization

Risk Models

  • VaR Calculation: Historical simulation and Monte Carlo
  • Correlation Models: Dynamic correlation tracking
  • Regime Detection: Market state identification
  • Stress Testing: Scenario-based risk assessment

📈 Trading Strategies

Equity Strategies

# Example: Multi-Factor Long-Short
strategy = EquityLongShortStrategy({
    'allocation': 0.4,
    'factors': ['momentum', 'value', 'quality'],
    'rebalance_frequency': 'daily',
    'long_short_ratio': 1.0
})

Options Strategies

# Example: Delta-Neutral Strategy
strategy = DeltaNeutralStrategy({
    'target_delta': 0.0,
    'delta_tolerance': 5.0,
    'rehedge_threshold': 10.0,
    'underlying_universe': ['SPY', 'QQQ']
})

🔧 Configuration

Strategy Configuration

strategies:
  equity_long_short:
    enabled: true
    allocation: 0.4
    parameters:
      lookback_period: 252
      factors: [momentum, value, quality]
  
  delta_neutral:
    enabled: true
    allocation: 0.2
    parameters:
      target_delta: 0.0
      delta_tolerance: 5.0

Risk Limits

risk:
  max_drawdown: 0.15
  max_position_size: 0.05
  greek_limits:
    max_delta: 100
    max_gamma: 50
    max_theta: -200
    max_vega: 500

🧪 Testing

# Run all tests
pytest

# Run specific test categories
pytest tests/test_greeks.py -v
pytest tests/test_strategies.py -v
pytest tests/test_risk.py -v

# Run with coverage
pytest --cov=src tests/

# Run integration tests
pytest tests/integration/ -v

📦 Deployment

Docker Deployment

# Production deployment
./scripts/deploy.sh production

# Staging deployment  
./scripts/deploy.sh staging

Kubernetes Deployment

# Apply Kubernetes manifests
kubectl apply -f infrastructure/kubernetes/

# Check deployment status
kubectl get pods -n equiflex

📊 Monitoring

Metrics and Alerts

  • Prometheus: System and trading metrics
  • Grafana: Real-time dashboards and visualizations
  • ELK Stack: Centralized logging and analysis
  • Custom Alerts: Email/Slack notifications for critical events

Key Metrics Monitored

  • Portfolio performance and drawdown
  • Greek exposures and limits
  • Order execution quality
  • System latency and errors
  • Risk limit breaches

🔐 Security

  • Encrypted Communication: mTLS between services
  • Secret Management: Vault integration for API keys
  • Authentication: JWT-based API authentication
  • Audit Trail: Immutable trade and decision logging
  • Role-Based Access: Granular permission system

📚 Documentation

🤝 Contributing

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

Development Guidelines

  • Follow PEP 8 style guidelines
  • Add tests for new functionality
  • Update documentation for API changes
  • Use type hints throughout the codebase

📄 License

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

⚠️ Disclaimer

This software is for educational and research purposes only. Trading financial instruments involves substantial risk of loss. Past performance is not indicative of future results. The authors are not responsible for any financial losses incurred through the use of this software.

🔗 Links

📞 Support

For support, please:

  1. Check the documentation
  2. Search existing issues
  3. Create a new issue with detailed information
  4. Join our Discord community

Built with ❤️ by the EquiFlex Pro Team

Empowering traders with institutional-grade technology

About

EquiFlex Pro — AI/ML-powered long-short equity & options trading bot with Greek-based risk management. Supports multi-strategy alpha, real-time data, deep learning, multi-broker execution, auto-hedging, backtesting, and institutional-grade risk controls.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published