From c711e9ce8e6121071ff9d4f60128e15657048308 Mon Sep 17 00:00:00 2001 From: porcelaincode Date: Sun, 8 Feb 2026 06:04:43 +0530 Subject: [PATCH] feat: add new backtest functions --- Cargo.toml | 4 +-- README.md | 29 +++++++++--------- pyproject.toml | 6 ++-- python/raptorbt/__init__.py | 8 ++++- .../__pycache__/__init__.cpython-311.pyc | Bin 1381 -> 1483 bytes .../raptorbt/_raptorbt.cpython-311-darwin.so | Bin 739280 -> 739280 bytes 6 files changed, 27 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b6a6924..9633fdc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "raptorbt" -version = "0.2.1" +version = "0.2.2" edition = "2021" description = "High-performance Rust backtesting engine with Python bindings. Drop-in VectorBT replacement with up insanely faster performance at fractional memory footprint." authors = ["Alphabench "] license = "MIT" repository = "https://github.com/alphabench/raptorbt" -homepage = "https://github.com/alphabench/raptorbt" +homepage = "https://www.alphabench.in/raptorbt" readme = "README.md" keywords = ["backtesting", "trading", "quantitative-finance", "rust", "python"] categories = ["finance", "simulation"] diff --git a/README.md b/README.md index 1e944c5..0fda813 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ # RaptorBT -[![PyPI version](https://img.shields.io/pypi/v/raptorbt.svg)](https://pypi.org/project/raptorbt/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![PyPI version](https://img.shields.io/pypi/v/raptorbt.svg)](https://pypi.org/project/raptorbt/) [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/) -[![Rust](https://img.shields.io/badge/rust-1.70+-orange.svg)](https://www.rust-lang.org/) +[![Rust](https://img.shields.io/badge/rust-1.70+-red.svg)](https://www.rust-lang.org/) +[![PyPI Downloads](https://static.pepy.tech/personalized-badge/raptorbt?period=total&units=INTERNATIONAL_SYSTEM&left_color=GRAY&right_color=ORANGE&left_text=downloads)](https://pepy.tech/projects/raptorbt) **Blazing-fast backtesting for the modern quant.** @@ -573,18 +574,18 @@ print(f"Max Drawdown: {result.metrics.max_drawdown_pct}%") ### Metric Mapping -| VectorBT Key | RaptorBT Attribute | -| ---------------------- | ------------------------------ | -| `Total Return [%]` | `metrics.total_return_pct` | -| `Sharpe Ratio` | `metrics.sharpe_ratio` | -| `Sortino Ratio` | `metrics.sortino_ratio` | -| `Max Drawdown [%]` | `metrics.max_drawdown_pct` | -| `Win Rate [%]` | `metrics.win_rate_pct` | -| `Profit Factor` | `metrics.profit_factor` | -| `SQN` | `metrics.sqn` | -| `Omega Ratio` | `metrics.omega_ratio` | -| `Total Trades` | `metrics.total_trades` | -| `Expectancy` | `metrics.expectancy` | +| VectorBT Key | RaptorBT Attribute | +| ------------------ | -------------------------- | +| `Total Return [%]` | `metrics.total_return_pct` | +| `Sharpe Ratio` | `metrics.sharpe_ratio` | +| `Sortino Ratio` | `metrics.sortino_ratio` | +| `Max Drawdown [%]` | `metrics.max_drawdown_pct` | +| `Win Rate [%]` | `metrics.win_rate_pct` | +| `Profit Factor` | `metrics.profit_factor` | +| `SQN` | `metrics.sqn` | +| `Omega Ratio` | `metrics.omega_ratio` | +| `Total Trades` | `metrics.total_trades` | +| `Expectancy` | `metrics.expectancy` | --- diff --git a/pyproject.toml b/pyproject.toml index bb66548..5765668 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "raptorbt" -version = "0.2.1" +version = "0.2.2" description = "High-performance Rust backtesting engine with Python bindings. Drop-in VectorBT replacement with up insanely faster performance at fractional memory footprint." readme = "README.md" requires-python = ">=3.10" @@ -39,9 +39,9 @@ classifiers = [ ] [project.urls] -Homepage = "https://github.com/alphabench/raptorbt" +Homepage = "https://www.alphabench.in/raptorbt" Repository = "https://github.com/alphabench/raptorbt" -Documentation = "https://github.com/alphabench/raptorbt#readme" +Documentation = "https://www.alphabench.in/raptorbt" "Bug Tracker" = "https://github.com/alphabench/raptorbt/issues" [tool.maturin] diff --git a/python/raptorbt/__init__.py b/python/raptorbt/__init__.py index 74c9f49..5507a7c 100644 --- a/python/raptorbt/__init__.py +++ b/python/raptorbt/__init__.py @@ -24,6 +24,7 @@ from raptorbt._raptorbt import ( run_options_backtest, run_pairs_backtest, run_multi_backtest, + run_spread_backtest, # Indicator functions sma, ema, @@ -35,9 +36,11 @@ from raptorbt._raptorbt import ( adx, vwap, supertrend, + rolling_min, + rolling_max, ) -__version__ = "0.2.1" +__version__ = "0.2.2" __all__ = [ # Config classes @@ -54,6 +57,7 @@ __all__ = [ "run_options_backtest", "run_pairs_backtest", "run_multi_backtest", + "run_spread_backtest", # Indicator functions "sma", "ema", @@ -65,4 +69,6 @@ __all__ = [ "adx", "vwap", "supertrend", + "rolling_min", + "rolling_max", ] diff --git a/python/raptorbt/__pycache__/__init__.cpython-311.pyc b/python/raptorbt/__pycache__/__init__.cpython-311.pyc index c0db6a61e2d823c2f808ad7980a8cccf3a18cd7c..a5696f11e6db1e750c5f950ac42048fd6ba2107a 100644 GIT binary patch delta 479 zcmaFLb())ZIWI340}zB=Z_oTXkynzjZlZd!RIYfGc&8E+|S(OqqO}DO}|icTs*$PG(+ud~RkQ5+|{uiq$~R zNYBtuQ)aRaa~n^Q1kl1FNf045c|WrvW60!(%o^-TiOJcic`1{HSPbfwfRcgGJas8JRvX(2}U9vH66IcP7Gjb`1Pt4cs4CWVu16L5T)-5G+yv G1|0w)QF0#u delta 388 zcmX@j{gjJ$IWI340}%B6sm-jM$ScWMG*La7kC7pTIZ8a8A%$rXW0b_kC9RB%qLa0l zj!$M|_T{Q#HPAECGxXDxoLtV_HkpS-jxlVqHj4&lnW=tZX<}Z9>EtLDgL-+Osf<8e zEC?h&Ff%eTeqiEcWck1VBE+N^nLaSklBlP#`GkyD1^do|fnThF`vZ#&`8}tMs~h+2@~+@Mb+!2gTl)((Mj&PaVrC#_0b*7l28pu+ zF$WNHZhyhX)#1*_J-yJ6OI*^4k%2*tfq{Y9kON3EFi3()28RFJ7y5CneWdVh#SCth zr=MOkxjjC3!ddy6DffFeR<^VyS9za*Os!!$wmr{~J3&N&`JZ9r!_L*A@+Z2|r6-&^ c_JDs*x&2MQC$bmh<$lBn0CTQLx&QzG