Add trailing stops and parameter sweeps #6

Merged
matitos merged 1 commits from feat/trailing-stops-sweep into main 2026-09-20 01:18:54 +02:00
Owner

Summary

  • Trailing stops: trailing_stop_pct on enter_long/enter_short; advance_trailing_stop ratchets the stop with price and never loosens. Shared by engine + backtester. Position gains trailing_stop_pct (additive migration). momentum exposes it.
  • Parameter sweeps: POST /api/sweep runs a cartesian grid through the backtester, ranked by return − max drawdown. New dashboard Parameter sweep panel.

Testing

  • Backend: 93 tests pass, ruff clean.
  • Frontend: build + tests pass.
  • Smoke-tested vs live BTC/USDT 5m: sweep ranked 6 combos; momentum with a trailing stop exited via the trail.
## Summary - **Trailing stops**: `trailing_stop_pct` on `enter_long`/`enter_short`; `advance_trailing_stop` ratchets the stop with price and never loosens. Shared by engine + backtester. `Position` gains `trailing_stop_pct` (additive migration). `momentum` exposes it. - **Parameter sweeps**: `POST /api/sweep` runs a cartesian grid through the backtester, ranked by return − max drawdown. New dashboard **Parameter sweep** panel. ## Testing - Backend: 93 tests pass, ruff clean. - Frontend: build + tests pass. - Smoke-tested vs live BTC/USDT 5m: sweep ranked 6 combos; momentum with a trailing stop exited via the trail.
matitos added 1 commit 2026-09-20 01:04:58 +02:00
Add trailing stops and parameter sweeps
CI/CD / backend (pull_request) Successful in 6m6s
CI/CD / frontend (pull_request) Successful in 5m17s
CI/CD / build (pull_request) Skipped
CI/CD / deploy (pull_request) Skipped
CI/CD / cleanup (pull_request) Skipped
9dc00eba95
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.
matitos merged commit 6df44520fa into main 2026-09-20 01:18:54 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: matitos/crypto_trading#6