chore: prepare v1.1.0 release
Update version numbers across Rust, Python, and documentation files to 1.1.0. Enhance the .gitignore to include macOS dSYM files and plans directory. Introduce new dependencies in the Rust core library and update the README to reflect recent performance benchmarks and backtesting engine capabilities. Add new artifacts to the benchmarks manifest and improve documentation for the backtesting engine API.
This commit is contained in:
@@ -10,6 +10,11 @@ a Python technical analysis library.
|
||||
* - Area
|
||||
- Status
|
||||
- What it is
|
||||
* - Backtesting engine
|
||||
- Adjacent
|
||||
- Vectorized Rust backtester: OHLCV fill, stop-loss/TP, 23 performance
|
||||
metrics, trade extraction, parallel Monte Carlo, walk-forward analysis,
|
||||
and multi-asset portfolio simulation. See :ref:`backtesting-engine`.
|
||||
* - Derivatives analytics
|
||||
- Adjacent
|
||||
- Options pricing, Greeks, implied volatility helpers, futures basis,
|
||||
@@ -36,6 +41,74 @@ a Python technical analysis library.
|
||||
- Registry and plugin packaging model for custom indicators. See
|
||||
:doc:`plugins`.
|
||||
|
||||
.. _backtesting-engine:
|
||||
|
||||
Backtesting Engine
|
||||
------------------
|
||||
|
||||
``ferro_ta.analysis.backtest`` ships a production-grade backtesting engine
|
||||
backed entirely by Rust hot-path functions.
|
||||
|
||||
**Core API:**
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from ferro_ta.analysis.backtest import BacktestEngine, monte_carlo, walk_forward
|
||||
|
||||
result = (
|
||||
BacktestEngine()
|
||||
.with_commission(0.001)
|
||||
.with_slippage(5.0) # basis points
|
||||
.with_ohlcv(high=high, low=low, open_=open_)
|
||||
.with_stop_loss(0.02)
|
||||
.with_take_profit(0.04)
|
||||
.run(close, "sma_crossover")
|
||||
)
|
||||
|
||||
print(result.metrics["sharpe"]) # one of 23 metrics
|
||||
print(result.trades) # pandas DataFrame
|
||||
print(result.drawdown_series.min()) # max drawdown
|
||||
|
||||
mc = monte_carlo(result, n_sims=1000) # parallel bootstrap
|
||||
wf = walk_forward(close, "rsi", param_grid=[{"timeperiod": t} for t in [10,14,20]],
|
||||
train_bars=500, test_bars=100)
|
||||
|
||||
**Available Rust primitives** (``ferro_ta._ferro_ta``):
|
||||
|
||||
- ``backtest_core`` — close-only, vectorized, commission + slippage
|
||||
- ``backtest_ohlcv_core`` — fill at open, intrabar stop-loss / take-profit
|
||||
- ``compute_performance_metrics`` — 23 metrics in one pass (Sharpe, Sortino,
|
||||
Calmar, CAGR, Omega, Ulcer, win rate, profit factor, tail ratio, etc.)
|
||||
- ``extract_trades_ohlcv`` — 9 parallel arrays (entry/exit bar, MAE, MFE, …)
|
||||
- ``backtest_multi_asset_core`` — N-asset parallel backtest via Rayon
|
||||
- ``monte_carlo_bootstrap`` — parallel block bootstrap, returns (n_sims, n_bars)
|
||||
- ``walk_forward_indices`` — anchored/rolling fold index generator
|
||||
- ``kelly_fraction`` / ``half_kelly_fraction``
|
||||
|
||||
**Speed vs competitors** (100k bars, SMA crossover, Apple M-series):
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Library
|
||||
- Time
|
||||
- vs ferro-ta
|
||||
* - ferro-ta ``backtest_core``
|
||||
- 0.29 ms
|
||||
- —
|
||||
* - NumPy vectorized
|
||||
- 0.46 ms
|
||||
- 1.6× slower
|
||||
* - vectorbt
|
||||
- 2.9 ms
|
||||
- 10× slower
|
||||
* - backtesting.py
|
||||
- 320 ms
|
||||
- 1,100× slower
|
||||
* - backtrader
|
||||
- ~520 ms (10k bars)
|
||||
- >15,000× slower
|
||||
|
||||
How to read the project
|
||||
-----------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user