Trailing stops: strategies can pass trailing_stop_pct to enter_long/enter_short. advance_trailing_stop in app/engine/portfolio.py ratchets the stop with the price (up for longs, down for shorts) and never loosens; the engine persists the ratcheted level and the backtester applies the same logic. Position gains a trailing_stop_pct column (additive migration). momentum exposes it as a param. Parameter sweeps: app/backtest/sweep.py runs a cartesian grid through the same backtester and ranks by return minus max drawdown. POST /api/sweep plus a dashboard Parameter sweep panel.
16 lines
380 B
Python
16 lines
380 B
Python
from __future__ import annotations
|
|
|
|
from app.backtest.backtester import Backtester
|
|
from app.backtest.metrics import compute_metrics, max_drawdown_pct, sharpe_ratio
|
|
from app.backtest.sweep import SweepRow, expand_grid, run_sweep
|
|
|
|
__all__ = [
|
|
"Backtester",
|
|
"SweepRow",
|
|
"compute_metrics",
|
|
"expand_grid",
|
|
"max_drawdown_pct",
|
|
"run_sweep",
|
|
"sharpe_ratio",
|
|
]
|