feat(tick): add run_tick_backtest — tick-native simulation engine, bump to 0.4.0

Adds a full tick-level backtest path that operates on raw tick arrays
(ltp, bid, ask, per-tick buy/sell qty deltas, oi) plus caller-computed
entry/exit signal bool arrays. Entry fills at ask+slippage; stop/target
checked against ltp on every tick; max-hold-seconds time exit; cooldown
between entries. Produces identical BacktestMetrics as run_single_backtest
via the new compute_backtest_metrics free fn.

5 Rust unit tests: target-hit, stop-hit, time-exit, multi-trade-with-cooldown,
empty-ticks edge case — all pass (138 total, 0 failed).

Co-Authored-By: porcelaincode <contact@alphabench.in>
This commit is contained in:
porcelaincode
2026-06-03 21:27:54 +05:30
parent 514c235f1c
commit fa6959bb99
8 changed files with 454 additions and 4 deletions
+3 -1
View File
@@ -26,6 +26,7 @@ from raptorbt._raptorbt import (
run_pairs_backtest,
run_multi_backtest,
run_spread_backtest,
run_tick_backtest,
# Batch backtest
PyBatchSpreadItem,
batch_spread_backtest,
@@ -46,7 +47,7 @@ from raptorbt._raptorbt import (
rolling_max,
)
__version__ = "0.3.4"
__version__ = "0.4.0"
__all__ = [
# Config classes
@@ -65,6 +66,7 @@ __all__ = [
"run_pairs_backtest",
"run_multi_backtest",
"run_spread_backtest",
"run_tick_backtest",
# Batch backtest
"PyBatchSpreadItem",
"batch_spread_backtest",