Installation
HftBacktest is available for both Python and Rust. Choose the installation method that matches your preferred development environment.Python Installation
Requirements
HftBacktest requires Python 3.11 or higher
numpy >= 2.0, < 2.3numba ~= 0.61polarsmatplotlibholoviews
Install via pip
Install the package
The simplest way to install HftBacktest is using pip:This will install the latest stable release from PyPI.
Install from Source
For the latest development version, you can install directly from the GitHub repository:Optional Dependencies
For additional data source support, install the optional dependencies:Rust Installation
Requirements
HftBacktest requires Rust 1.91.1 or higher
Add to Cargo.toml
Add HftBacktest as a dependency in yourCargo.toml:
Feature Flags
The Rust crate provides several optional features:| Feature | Description | Default |
|---|---|---|
backtest | Backtesting engine and data processing | ✓ |
live | Live trading bot support (Binance, Bybit) | ✓ |
s3 | AWS S3 data loading support | ✗ |
Build Your Project
After adding the dependency, build your project:Verify Installation
Create a simple test to verify the installation:Development Setup
For contributing or development purposes:Platform-Specific Notes
Linux
All features work out of the box on Linux. For optimal performance:macOS
Python and Rust installations work normally on macOS:Windows
Both Python and Rust are supported on Windows:For Rust on Windows, you may need to install the Microsoft C++ Build Tools.
ARM Architecture
For ARM platforms (including Apple Silicon):Next Steps
Now that you have HftBacktest installed, you’re ready to run your first backtest:Quick Start
Run your first backtest with a simple example
Data Preparation
Learn how to prepare market data for backtesting
Troubleshooting
Python: NumPy version conflicts
Python: NumPy version conflicts
HftBacktest requires NumPy 2.0+. If you have conflicts:
Python: Numba compilation errors
Python: Numba compilation errors
Ensure you have the correct Numba version:
Rust: Compilation takes too long
Rust: Compilation takes too long
The first build can take several minutes. Subsequent builds are faster. Use
cargo build --release -j 4 to limit parallel jobs if you have memory constraints.Rust: Missing OpenSSL
Rust: Missing OpenSSL
On Linux, install OpenSSL development libraries:
Getting Help
If you encounter issues:- Check the GitHub Issues
- Read the full documentation
- Ask questions in GitHub Discussions