Skip to content

Commit

Permalink
docs: add performance test section into README
Browse files Browse the repository at this point in the history
Add performance test section to README:
- Include test dataset details
- Add test environment specifications
- Document performance results
- Maintain consistent formatting with Chinese version
  • Loading branch information
Xuan Ronaldo committed Dec 21, 2024
1 parent 6b16d63 commit 32ed41a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,31 @@ PositionBT 是一个专注于基于仓位数据进行策略回测的 Python 库
- 丰富的可视化选项:支持自定义图表类型,可实现策略绩效曲线、回撤分析、持仓分布等多维度分析展示。
- 开放的接口设计:便于用户扩展和集成自己的分析工具,打造个性化的回测分析流程。

## 回测速度
## 性能测试

以 data 目录下的比特币(BTC)收盘价数据集为例。该数据集包含从 2017 年 8 月 17 日至 2024 年 12 月 11 日的 15 分钟级别数据,共计 256,058 条记录。在 M4 芯片的 Mac Mini 上运行简单的"满仓买入并持有"策略,回测计算仅需 0.13 秒,生成交互式 HTML 报告约需 0.896 秒,平均每 10 万行数据的回测耗时仅为 0.051 秒,展现了优异的性能表现。
为了展示 PositionBT 的性能表现,我们使用了一个真实的大规模数据集进行测试:

### 测试数据集

* 文件:data/btc_ohlcv_1m.parquet
* 时间范围:2017年8月17日 至 2024年12月22日
* 数据类型:1分钟K线数据
* 数据量:2,682,218条记录

### 测试环境

* 硬件:Mac Mini (M4芯片)
* 内存:16 GB
* 硬盘:256 GB

### 性能结果

* 回测耗时:0.14 秒
* 数据处理速度:19,158,700 条/秒

这个测试结果表明,PositionBT 能够高效处理大规模的历史数据,为策略验证提供快速的反馈。即使面对数百万级别的数据量,其性能表现依然保持稳定。

> 注:测试结果可能会因硬件配置和数据特征而有所差异。
## 安装

Expand Down
26 changes: 24 additions & 2 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,31 @@ PositionBT is a Python library focused on position-based strategy backtesting. T
- Rich visualization options: supports custom chart types, enabling multi-dimensional analysis displays such as strategy performance curves, drawdown analysis, and position distribution.
- Open interface design: facilitates user extension and integration of their own analysis tools to create personalized backtesting analysis workflows.

## Backtesting Speed
## Performance Test

Taking the Bitcoin (BTC) closing price dataset in the `data` directory as an example. This dataset contains 15-minute level data from August 17, 2017, to December 11, 2024, with a total of 256,058 records. Running a simple "buy and hold" strategy on an M4 chip Mac Mini, the backtest calculation takes only 0.13 seconds, generating an interactive HTML report takes about 0.896 seconds, and the average backtesting time per 100,000 rows of data is just 0.051 seconds, demonstrating excellent performance.
To demonstrate the performance of PositionBT, we conducted tests using a real-world large-scale dataset:

### Test Dataset

* File: data/btc_ohlcv_1m.parquet
* Time Range: August 17, 2017 to December 22, 2024
* Data Type: 1-minute candlestick data
* Data Size: 2,682,218 records

### Test Environment

* Hardware: Mac Mini (M4 chip)
* Memory: 16 GB
* Storage: 256 GB

### Performance Results

* Backtest Duration: 0.14 seconds
* Data Processing Speed: 19,158,700 records/second

These test results demonstrate that PositionBT can efficiently process large-scale historical data, providing rapid feedback for strategy validation. Even when handling millions of data points, its performance remains stable.

> Note: Test results may vary depending on hardware configuration and data characteristics.
## Installation

Expand Down

0 comments on commit 32ed41a

Please sign in to comment.