Multi-strategy UI

Adds a "Strategies (multi)" panel: add/remove strategy rows (strategy, symbol,
timeframe, per-strategy params and weight), start all, stop all and kill all,
plus a per-strategy status table (allocation, equity, P&L, halted). Polls
/api/bot/status alongside the existing status. Includes component tests.
This commit is contained in:
matitos committed 2026-09-22 11:59:21 +00:00
1 parent 3229a0e2aa
commit ce2b11a803
6 files changed
+499 -1

No files matched your search

+11
View File
@@ -144,6 +144,15 @@ injects it on the handshake). If `API_TOKEN` is unset, `/api/ws` is as open as
the rest of `/api`, which is fine for a trusted/private deployment but is the
reason to set a token if the host is exposed.
## Multi-strategy
The **Strategies (multi)** panel runs several strategies at once, each with its
own capital slice. Set a **weight** per strategy; weights are normalised across
the run (`[1, 3]` gives 25% / 75%) and each strategy starts with
`starting_balance × allocation` as its own cash, so one strategy's losses cannot
drain another's. Risk limits apply per strategy, and **Kill all** flattens and
halts every one.
## Risk controls
The engine enforces limits on every tick and **halts + flattens** when one trips:
@@ -182,6 +191,8 @@ Bundled strategies: `sma_cross`, `ema_cross`, `macd_trend`,
| `GET` | `/api/status` | Bot status, equity, P&L |
| `GET` | `/api/strategies` | Available strategies + parameter specs |
| `POST` | `/api/bot/start` | Start a strategy |
| `POST` | `/api/bot/start-many` | Start several strategies with per-strategy allocations |
| `GET` | `/api/bot/status` | Per-strategy status for a multi-strategy run |
| `POST` | `/api/bot/stop` | Stop the bot |
| `POST` | `/api/bot/kill` | Kill switch: flatten + halt |
| `POST` | `/api/backtest` | Backtest a strategy on historical candles |