-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
help wantedExtra help is welcome from the community.Extra help is welcome from the community.performanceBenchmarks, profiling, and runtime optimization work.Benchmarks, profiling, and runtime optimization work.v0.4Release gate work required before shipping v0.4.Release gate work required before shipping v0.4.
Description
Goal
Provide a first-class backtest module to turn indicators/signals into decisioning results with standardized portfolio metrics.
Why
The library already has strong indicator + streaming + compatibility foundations. A built-in backtest path is the biggest adoption multiplier for strategy evaluation.
Implementation prompt
Implement backtest/ primitives that run deterministic historical simulations over OHLCV bars:
- Inputs: candles/returns + signals or strategy callback
- Position model: flat/long/short with configurable fees/slippage
- Execution model: close-to-close and next-bar execution options
- Output: equity curve, trades, and metrics object
Implement metric helpers:
- Sharpe
- Sortino
- Max Drawdown
- Profit Factor
- Win Rate
- Expectancy
Scope
- New public exports under root and
ta-crypto/backtest - Typed contracts for trades, equity curve, and summary metrics
- Deterministic results for same inputs/config
- Clear warmup handling and NA-safe calculations
Acceptance criteria
runBacktest(...)produces reproducible trade list + equity curve- Metric package returns stable values for known fixtures
- README includes one end-to-end example from signal -> report
- Unit tests cover fees/slippage, no-trade paths, and drawdown edge cases
Test plan
- Golden fixture for one known strategy path
- Regression tests for metrics with hand-checked expected values
- Cross-check one scenario against an external reference notebook/script
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedExtra help is welcome from the community.Extra help is welcome from the community.performanceBenchmarks, profiling, and runtime optimization work.Benchmarks, profiling, and runtime optimization work.v0.4Release gate work required before shipping v0.4.Release gate work required before shipping v0.4.