Back to projects
Project Description
Quantex - Quantitative Trading Library
Overview
Quantex is a lightweight, open-source Python library designed for building, backtesting, and deploying quantitative trading strategies. The library provides a clean, event-driven architecture that maintains code consistency between backtesting and live trading environments, making it an ideal foundation for systematic trading research and deployment.
Current Features
Core Architecture
- Event-driven design with shared codebase between backtesting and live trading
- Modular data source abstraction supporting CSV, Parquet, and custom data feeds
- Immutable data models using Python dataclasses for market data (Bar, Tick)
- Stateful portfolio management with automatic P&L tracking and position accounting
- Strategy base class with intuitive trading API (buy(), sell(), close_position())
Data Management
- Multiple data source formats: CSV and Parquet file support out-of-the-box
- Time-aligned processing: Automatic synchronization across multiple data sources
- Historical data access: Built-in lookback functionality for technical analysis
- Missing data handling: Robust handling of gaps in time series data
Backtesting Engine
- High-fidelity simulation with realistic execution modeling
- Performance metrics: Sharpe ratio, total returns, and extensible metrics framework
- Order execution simulation with configurable commission and slippage
- Portfolio tracking: Real-time NAV calculation and position monitoring
Trading Infrastructure
- Position management: Automatic tracking of long/short positions with average cost basis
- Order management: Support for market and limit orders with proper validation
- Risk controls: Cash availability checks and position sizing constraints
- Trade history: Complete audit trail of all orders and fills
Development & Testing
- Comprehensive test suite with >90% code coverage using pytest
- Type safety with full type annotations throughout the codebase
- Code quality tools: Black formatting, Ruff linting, and pre-commit hooks
- Documentation: Auto-generated API docs with MkDocs and comprehensive guides
Key Design Principles
- Python-first approach with modern language features (Python 3.13+)
- Immutable data structures for market data to prevent accidental modifications
- Dependency injection for data sources and execution simulators
- Plugin architecture for extending functionality without core modifications
Technologies Used
Core Dependencies
- Python 3.13+: Latest language features and performance improvements
- Pandas: Time series data manipulation and analysis
- FastParquet: High-performance Parquet file I/O
- NumPy: Numerical computing for performance-critical calculations
Development Stack
- Poetry: Modern dependency management and packaging
- pytest: Testing framework with parallel execution support
- Black + Ruff: Code formatting and linting
- pre-commit: Automated code quality checks
- MkDocs: Documentation generation with Material theme
CI/CD & Documentation
- GitHub Actions: Automated testing and documentation deployment
- GitHub Pages: Hosted documentation with auto-generated API reference
- pytest-xdist: Parallel test execution for faster development cycles