A naive backtest framework for stock trading in Chinese market
Project description
Han_BackTest
Han_BackTest is a lightweight backtesting framework designed for the Chinese stock market. It allows users to quickly develop, test, and analyze quantitative investment strategies.
Features
- Efficient Data Management: Load and cache financial data seamlessly with
DataClass. - Flexible Factor Calculation: Create custom factors with
FactorClass. - Modular Strategy Design: Build strategies by extending the
StrategyClass. - Comprehensive Backtesting: Use
BackTestClassfor visualizing performance and comparing strategies.
Installation
Install via pip:
pip install Han-BackTest
Quick Start
Here’s how to get started with Han_BackTest in just a few steps:
from Han_BackTest.DataClass import DataClass
from Han_BackTest.BackTestClass import BackTestClass
from Strategies.ReversalStrategy import ReversalStrategy # Import your strategy
# Load data
data_paths = {"daily": "path/to/data.feather"}
data = DataClass(data_paths)
data.generate_cache()
# Define strategy
strategy = ReversalStrategy(name="Reversal", n=5)
# Run backtest
backtest = BackTestClass(
strategy=strategy,
data_class=data,
start_date=20200101,
end_date=20231231,
)
# Plot results
backtest.plot_nav()
Documentation
For detailed documentation and usage examples, please visit the online documentation.
Data Requirements
If you need sample data for testing, you can download it from this link.
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests :)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Han_BackTest-1.1.2.tar.gz.
File metadata
- Download URL: Han_BackTest-1.1.2.tar.gz
- Upload date:
- Size: 25.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
584a82dfb747dfbe4e9410f7aa6e8552574b9402d592a878e52f100a3ec7375d
|
|
| MD5 |
e04802e0609406dd3248c28deb3512a2
|
|
| BLAKE2b-256 |
00527db9e78edc1c6f78b2dcaec205f354199aac214c80cf07ead966fff31a1e
|
File details
Details for the file Han_BackTest-1.1.2-py3-none-any.whl.
File metadata
- Download URL: Han_BackTest-1.1.2-py3-none-any.whl
- Upload date:
- Size: 27.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb4cb0a1ed9e72035f894c680fcfe9635fd82f19d402beb33693d1992fcba703
|
|
| MD5 |
6d2bdbe8d9be3dda1a27a1c8ed6fc297
|
|
| BLAKE2b-256 |
ad890e7f970df12c115bddd40a49040951df06bd0a3ba22d188ce23fc0f67136
|