Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
a567587
Revert "Merge dev to main: Login fix for default admin password"
CryptoGnome Oct 12, 2025
e1013f4
feat(auth): skip password requirement for default "admin" password
CryptoGnome Oct 12, 2025
4ed3f50
feat: add TradingView charts with liquidation database management
birdbathd Nov 18, 2025
bb0a7b6
feat: add infinite historical data loading to chart
birdbathd Nov 18, 2025
0046305
fix: remove duplicate prependHistoricalKlines function
birdbathd Nov 18, 2025
f0b82f3
fix: resolve chart initialization issues with historical data loading
birdbathd Nov 18, 2025
b6299c0
fix: preserve chart view position after user interaction
birdbathd Nov 18, 2025
5c6973e
fix: Add WebSocket keepalive and inactivity monitoring to Hunter
birdbathd Nov 18, 2025
e6aa8c7
feat: Add TP/SL toggle and reorganize chart controls
birdbathd Nov 19, 2025
3a21847
Merge branch 'dev' into feature/tradingview-charts
birdbathd Nov 19, 2025
8d9aad1
fix: prevent duplicate liquidations from accumulated event listeners
birdbathd Nov 19, 2025
57ebca2
feat: add configurable auto-refresh interval for chart (5s to 5min op…
birdbathd Nov 19, 2025
c09577f
perf: optimize auto-refresh to fetch only latest 2 candles instead of…
birdbathd Nov 19, 2025
3aeb2a5
Add volume histogram to TradingView chart with toggle
birdbathd Nov 19, 2025
0164ead
Fix ReferenceError and reduce WebSocket console spam
birdbathd Nov 19, 2025
42657ff
Add debug logging to track Hunter event listener accumulation
birdbathd Nov 19, 2025
de4a230
Revert "Add volume histogram to TradingView chart with toggle"
birdbathd Nov 19, 2025
56556b4
Reduce WebSocket broadcast spam and add eventTime logging
birdbathd Nov 19, 2025
bcc201c
fix: prevent duplicate liquidations with database UNIQUE constraint
birdbathd Nov 20, 2025
87ea43c
chore: restore tranche implementation and docs accidentally deleted b…
birdbathd Nov 20, 2025
6bb2ce2
docs: merge back with dev - restore tranche documentation
birdbathd Nov 20, 2025
2159acc
fix: prevent duplicate liquidation events from inflating threshold co…
birdbathd Nov 21, 2025
0303219
refactor: improve WebSocket reconnection logic to prevent reconnectio…
birdbathd Nov 21, 2025
703fe2f
feat: enable tranche management UI configuration
birdbathd Nov 23, 2025
f045004
feat: enable tranche management system (untested)
birdbathd Nov 23, 2025
c527762
feat: implement protective orders system
birdbathd Nov 23, 2025
2d97d31
Add timestamps to logs UI and initialize ProtectiveOrderService
birdbathd Nov 23, 2025
6882f5b
Remove per-symbol protective order config and fix duplicate service s…
birdbathd Nov 23, 2025
218f606
Fix ProtectiveOrderService initialization check in API
birdbathd Nov 23, 2025
0e07ed4
feat: Transform trailing stop to trailing TP with break-even protecti…
birdbathd Nov 23, 2025
f3a080d
Mobile responsive improvements and performance optimizations
birdbathd Nov 23, 2025
ec6fa3b
Fix desktop layout spacing for better space utilization
birdbathd Nov 23, 2025
673f3b0
Consolidate Recent Orders header into single row
birdbathd Nov 23, 2025
e213fec
chore: add .db-shm files to gitignore
birdbathd Nov 23, 2025
7346ba7
feat: mobile responsiveness and UX improvements
birdbathd Nov 24, 2025
3d6cf0f
fix: trailing take profit activation and minimum profit logic
birdbathd Nov 24, 2025
8dba823
feat: Complete paper trading system with live PnL updates and bot ini…
birdbathd Nov 24, 2025
1d6d9c0
feat: complete paper trading with live PnL and bot initialization fixes
birdbathd Nov 24, 2025
fe4a2e5
feat: complete paper trading with live PnL and bot initialization fixes
birdbathd Nov 24, 2025
c1d60ef
Fix PM2 logs for multi-instance setups
birdbathd Nov 24, 2025
6fd4670
Merge remote-tracking branch 'origin/fix/ui-ux-mobile-optimization' i…
birdbathd Nov 24, 2025
a5c8501
Fix build: resolve linting errors and add build ignore flags
birdbathd Nov 24, 2025
c9e5c99
Fix React Hooks rules violations and build errors
birdbathd Nov 24, 2025
8516d11
Fix auth redirect to use actual host instead of hardcoded localhost
birdbathd Nov 24, 2025
343cf5c
fix: onboarding state now persists server-side instead of localStorage
birdbathd Nov 25, 2025
ca55908
CRITICAL FIX: onboarding config preservation and setup escape
birdbathd Nov 25, 2025
1a3a8ac
fix: comprehensive authentication, security, and onboarding improvements
birdbathd Nov 25, 2025
8bf9d57
chore: remove unused imports and variables per Copilot review
birdbathd Nov 25, 2025
433fc0c
feat: Add historical VWAP line and magnet mode toggle to chart
birdbathd Nov 25, 2025
4f21639
Merge branch 'feature/tradingview-charts' into feature/backtester
birdbathd Nov 25, 2025
2f7bd88
fix: Match VWAP timeframe to chart timeframe to prevent skinny candles
birdbathd Nov 25, 2025
9a10459
fix: Match VWAP timeframe to chart timeframe to prevent skinny candles
birdbathd Nov 25, 2025
c8da385
Fix: Restore desktop layout by adjusting PullToRefresh wrapper position
birdbathd Nov 25, 2025
7741e7e
Merge feature/backtester: Add mobile gestures and fix desktop layout
birdbathd Nov 25, 2025
ea4c12d
feat: Add NumberInput component and position sizing foundation
birdbathd Nov 25, 2025
a97e2e5
refactor: Reorganize position sizing UI for better flow
birdbathd Nov 25, 2025
92cf3c6
feat: Implement dynamic position sizing with auto-update
birdbathd Nov 25, 2025
1c8fbe1
fix: Show saved threshold time window and cooldown values correctly
birdbathd Nov 25, 2025
df4bc78
fix: Show 'Idle' instead of 'Disconnected' on non-dashboard pages
birdbathd Nov 25, 2025
0e8bdac
Merge feature/tradingview-charts: VWAP historical line, magnet mode, …
birdbathd Nov 25, 2025
25cb6d5
fix: Store ALL liquidations in database, not just configured symbols
birdbathd Nov 26, 2025
517431e
feat: Add liquidation discovery page with symbol analysis
birdbathd Nov 26, 2025
353e2cc
fix: Remove shortTradeSize/longTradeSize from config when separate si…
Nov 27, 2025
4d0eb3b
fix: Default discovery to 30d, prevent background tab queue buildup
birdbathd Nov 27, 2025
4ff426f
feat: Add trade quality scoring system with VWAP regime detection, FT…
birdbathd Nov 30, 2025
f7b84f5
Merge feature/liquidation-discovery: Discovery page, database liquida…
birdbathd Nov 30, 2025
affbf7f
Merge feature/protective-orders: Trailing TP with break-even protection
birdbathd Nov 30, 2025
2b41043
Merge feature/paper-trading-improvements: Paper trading PnL and mobil…
birdbathd Nov 30, 2025
503137d
Trade quality scoring: passive mode support, database persistence, UI…
birdbathd Nov 30, 2025
5a316dc
feat(discovery): Restore whale indicators and sentiment analysis from…
birdbathd Nov 30, 2025
b06db2f
fix: TradeQualityPanel now shows VWAP blocks distinctly from quality …
birdbathd Nov 30, 2025
c384eaa
fix: Trade quality service now uses VWAP streamer for spike detection
birdbathd Nov 30, 2025
79f5b23
fix: Trade quality now tracks ALL liquidations and loads historical data
birdbathd Dec 1, 2025
a54c182
feat: Add tooltips to Trade Quality Panel and improve Overview layout
birdbathd Dec 1, 2025
e20e869
fix: Minor syntax fixes in TradeQualityPanel
birdbathd Dec 1, 2025
b9c5c3c
fix: spike detection velocity threshold and real-time price stream
birdbathd Dec 1, 2025
e0e6a8c
feat: add signal price display and MAE/MFE tracking
birdbathd Dec 2, 2025
ec884a4
Replace NextAuth with simple JWT auth, fix WebSocket host auto-detection
birdbathd Dec 4, 2025
b32f1d0
Remove NextAuth, use custom JWT auth
birdbathd Dec 5, 2025
90a7f66
Fix trade quality multiplier in passive mode, remove exchange min fal…
birdbathd Dec 5, 2025
884d854
Add market depth feature to Discovery, fix ws bundling
birdbathd Dec 6, 2025
f8fd5d0
Fix secure cookie only when actually using HTTPS
birdbathd Dec 6, 2025
00b19ed
Add logging for invalid prices from book ticker and liquidation events
birdbathd Dec 7, 2025
73f22a4
Fix stale data on tab visibility and improve error handling
birdbathd Dec 9, 2025
7afb865
SECURITY: Upgrade Next.js to 15.5.7 (CVE-2025-66478)
birdbathd Dec 9, 2025
a4a3e2a
Cleanup and improve defaults
birdbathd Dec 10, 2025
0e95707
Fix bot startup without API keys
birdbathd Dec 10, 2025
a93f4cc
Fix onboarding trade sizes - use USDT margin values
birdbathd Dec 10, 2025
e7ee9f4
Remove accidental doc
birdbathd Dec 10, 2025
6ab65d8
Fix threshold toggle visibility and reduce startup noise
birdbathd Dec 10, 2025
ba58e9a
Remove deprecated @types/uuid and @types/sqlite3 stub packages
birdbathd Dec 10, 2025
1ea8746
Fix FTA Exit Service log spam - add throttling and config toggle
birdbathd Dec 10, 2025
6df5034
Update PR description with FTA fix
birdbathd Dec 10, 2025
eb622e0
Remove ecosystem.config.js from tracking (contains secrets)
birdbathd Dec 10, 2025
37788fd
Fix maxOpenPositions to allow adding to existing positions
birdbathd Dec 11, 2025
72360b1
feat: cascade protection, account health monitor, reduce position, si…
birdbathd Feb 9, 2026
a0d0b84
feat: tranche system wiring + trade size multiplier
birdbathd Feb 18, 2026
592214a
feat: dashboard UI improvements + trade size multiplier controls
birdbathd Feb 18, 2026
1f3d82f
fix: account health DCA guardrails + cascade detector improvements
birdbathd Feb 18, 2026
c9d56c2
feat: analysis and backtest scripts
birdbathd Feb 18, 2026
1f7fa0b
docs: update CLAUDE.md and session notes
birdbathd Feb 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ next-env.d.ts
data/*.db
data/*.db-journal
data/*.db-wal
data/*.db-shm

# user configuration
config.user*
Expand All @@ -54,3 +55,11 @@ data/optimizer-jobs.json
# claude code local settings and agents
.claude/settings.local.json
.claude/agents/

# local development files (not for commit)
[WEB]
ecosystem.config.js
scripts/aster-notifier.cjs
*.swp
.*.swp
core
103 changes: 103 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,20 @@ npm run test:tranche:all # Run all tranche tests
- **pnlService.ts**: Real-time P&L tracking and session metrics
- **thresholdMonitor.ts**: 60-second rolling volume threshold tracking
- **trancheManager.ts**: Multi-tranche position tracking and lifecycle management
- **tradeQualityService.ts**: Trade quality scoring (spike/volume/regime analysis, 0-3 score)
- **cascadeDetector.ts**: Cascade protection — detects rapid consecutive entries and can LOG_ONLY, REDUCE, or BLOCK
- **accountHealthMonitor.ts**: Account health monitoring — tracks drawdown %, pauses trading, emergency close-all

### Key UI Components

- **TradeQualityPanel.tsx**: Signal feed showing trade opportunities with S/V/R quality scores, TAKEN/SKIPPED filters, expandable details with info tooltips
- **ReducePositionModal.tsx**: Partial position close modal (25/50/75/100% presets + custom %)
- **PositionTable.tsx**: Position table with Scale Out, Add, Reduce, and Close actions

### API Endpoints

- **`/api/positions/[symbol]/[side]/reduce`**: POST — partial position close at market (accepts `{ percent }`)
- **`/api/cascade/status`**: GET — cascade protection status

### API Layer (`src/lib/api/`)

Expand Down Expand Up @@ -688,3 +702,92 @@ The custom process manager (`scripts/process-manager.js`) handles:
9. **Paper Mode**: Always recommend starting in paper mode when testing new features or strategies.

10. **Documentation**: Refer to `docs/STRATEGY.md` for trading strategy details and `docs/aster-finance-futures-api.md` for API documentation.

## Recent Session Changelog (Feb 2026)

### Safety & Risk Management
- **Cascade Protection** (`cascadeDetector.ts`): Detects rapid consecutive entries into the same symbol. Three modes: `LOG_ONLY` (monitor), `REDUCE` (enter with reduced size via `reducedPositionMultiplier`), `BLOCK` (prevent entry). Changed default to LOG_ONLY after analysis showed cascades spread over days/weeks, not minutes.
- **Account Health Monitor** (`accountHealthMonitor.ts`): Tracks account drawdown %. Can pause new entries at configurable drawdown threshold, resume when recovered, and emergency close-all at critical levels. Broadcasts `account_health_update` events to dashboard.
- **Dashboard visuals**: Orange pulsing badge for active drawdown, mode-aware cascade badge (DETECTED/REDUCED/PAUSED).
- **Config UI**: Added cascade `mode` dropdown (LOG_ONLY/REDUCE/BLOCK), `reducedPositionMultiplier` input, and full Account Health config card with 5 fields.

### Position Management
- **Reduce Position** (end-to-end): New `ReducePositionModal` with 25%/50%/75%/100% preset buttons + custom %. API endpoint at `/api/positions/[symbol]/[side]/reduce` places MARKET reduce-only orders. Handles HEDGE mode, precision formatting, paper mode. Wired into `PositionTable` (orange ✂ Reduce button in both mobile & desktop).

### Trade Quality Analysis
- **Signal Feed redesign** (`TradeQualityPanel.tsx`): Complete rewrite from 778→340 lines. Removed: 3-tab layout, SVG circular gauges, VWAP cross dot indicator, mini bar charts. Added: collapsed-by-default compact feed, click-to-expand signal details, ALL/TAKEN/SKIPPED filters, 50 signal history.
- **Spike detection fix** (`tradeQualityService.ts`): Fixed `detectSpike()` which always showed 0s or 119s. Was measuring from oldest price in 2-min window; now scans backward to find where the rapid move actually started, giving meaningful durations like "0.5% in 8s".
- **Metric info tooltips**: Added (i) icons with detailed explanations to all metrics (Move, Spike, Vol, VWAP) and the S/V/R score triplet. Each tooltip explains what the metric measures, scoring thresholds, and what good/bad values look like.

### Local Trade History Database (Feb 13, 2026)
- **`src/lib/db/tradeHistoryDb.ts`** (NEW): Local SQLite DB (`data/trade_history.db`) persisting all trades/orders for deep history. Three tables: `trade_history` (order fills, UPSERT by symbol+orderId+updateTime), `income_history` (PnL/commission/funding), `sync_metadata` (backfill progress tracking). WAL mode, indexed on symbol/time/status/orderId.
- **Real-time persistence**: `positionManager.ts` `handleOrderUpdate()` now calls `tradeHistoryDb.upsertTrade()` for every ORDER_TRADE_UPDATE WebSocket event (non-blocking try/catch).
- **Startup backfill**: `scripts/backfill-trades.ts` runs on bot startup (background, non-blocking via `bot/index.ts` `startTradeHistoryBackfill()`). Fetches allOrders + userTrades + income from exchange API going back 30 days. Uses `sync_metadata` to avoid refetching. First run imported 1,873 orders, 546 trades, 1,871 income records in 36.8s.
- **API endpoints**: `/api/trades/history` (GET — query with symbol/status/time filters, `format=orders|markers|raw`), `/api/trades/stats` (GET — aggregate PnL/commission/funding stats + sync status).
- **Enhanced `/api/orders/all`**: Now merges local DB history with exchange API data. Falls back to local DB if exchange API fails. Adds deeper history orders not in the API response.
- **TradingView chart**: `TradingViewChart.tsx` order overlay now fetches from `/api/trades/history?format=orders` for 90-day deep history (was limited to ~50 from exchange API), merges with real-time orderStore updates.
- **Recent Orders pagination**: `RecentOrdersTable.tsx` changed from infinite-expand to proper pagination. Shows first 15 rows, "Show More" expands to 50-per-page with prev/next page controls and a collapse button.

### Trade Quality Scoring Reference (S/V/R)
Each trade opportunity scores 0-3 based on three criteria:
- **S**pike (0/1): Was there a fast price move into the level? Scores 1 if velocity >0.1%/s OR total move ≥0.5%
- **V**olume (0/1): Is liquidation volume decreasing? Scores 1 if recent/older volume ratio ≤1.1×
- **R**egime (0/1): Is the market choppy? Scores 1 if ≥3 VWAP crosses/hour (range-bound = good for reversals)
- **3/3 STRONG** → 1.5× position size | **2/3 NORMAL** → 1× | **1/3 WEAK** → 0.5× | **0/3 SKIP** → blocked

## Active Discussion: Account Health Settings & Global Risk Mode (Feb 13)

### Account Health Monitor — NOT YET CONFIGURED (using defaults)
The health monitor exists in code but `config.user.json` has no `accountHealth` section.
Current defaults: 25% drawdown pause, 20% unrealized loss pause, 15% resume, 60s checks, no emergency close-all.

**Recommended settings based on trade data analysis:**
- `maxDrawdownPercent: 5` (~$18) — normal daily P&L is $1–5, so $18 drawdown = many days of profit gone
- `maxUnrealizedLossPercent: 3` (~$11) — with $1 trades at 8x, unrealized > $11 means multiple underwater positions
- `resumeAtDrawdownPercent: 3` — 2% hysteresis band
- `checkIntervalSeconds: 30` — faster detection, positions are small
- `closeAllAtDrawdownPercent: 10` (~$36) — month of profit, hard safety limit

### Trade Performance Data (30 days: Jan 14 – Feb 13, 2026)
- **Account balance**: ~$360
- **All trades**: $1 trade size, 8–10x leverage, no SL/TP configured
- **Symbols**: ETHUSDT, ASTERUSDT, HYPEUSDT, ZECUSDT, SOLUSDT, FARTCOINUSDT
- **maxOpenPositions**: 3, **useTradeQualityScoring**: false, **cascadeProtection**: LOG_ONLY
- **Normal performance** (excluding Jan 30-31): 97W/0L, 16 consecutive green days, +$259 cumulative
- **Catastrophic event** (Jan 30-31): -$1,441 in 2 days (400% of account). Caused by enormous positions ($1,900–$2,000 notional vs normal $1 trades) — likely manual positions or extreme DCA. All closed simultaneously on Jan 31 at 18:43:59.
- **Post-recovery** (Feb 1–13): Back to $1 trades, 100% win rate, +$9.15 in 13 days, slowly recovering.
- **Per-symbol**: ZECUSDT best (+$54, 12W/0L), HYPEUSDT (+$43, 20W/1L), SOLUSDT worst (-$820, 3 losses each >$200)
- **Worst individual trades**: SOLUSDT -$603 (notional $1,928), ETHUSDT -$441 (notional $1,249)

### Global Risk Mode — DESIGN DISCUSSION (not yet implemented)
Concept: A single risk profile selector that scales all symbol configs uniformly.

**Proposed presets:**
| Mode | Size Multiplier | Max Positions | Description |
|---|---|---|---|
| Conservative | 0.5x | 2 | Choppy/uncertain market |
| Normal | 1.0x | 3 | Business as usual |
| Aggressive | 2.0x | 4 | Trending/high confidence |
| Max | 3.0x | 5 | Very high confidence |

**What it would affect:**
- Trade size: multiply all symbol `tradeSize` by mode multiplier
- Max open positions: per mode preset
- Entry thresholds: aggressive = lower liq volume needed to trigger trade
- Health monitor thresholds: scale proportionally with trade size (but NOT closeAll)
- SL/TP widths: possibly wider SL in aggressive mode

**Design options discussed:**
- **Option A** (recommended): Named presets with hardcoded multipliers — simple to flip
- **Option B**: Named presets + customizable overrides per field
- **Option C**: Single `globalMultiplier` slider, everything scales from one number

**Key principle**: Risk mode is a MULTIPLIER on top of per-symbol config, not a replacement. ETHUSDT tradeSize=1 in Aggressive(2x) → actual $2.

**Open questions for user:**
1. Which levers matter most? (trade size? position count? thresholds?)
2. Named presets or a slider?
3. Should it change which symbols are traded, or just how much?

**Storage**: Would be a `riskMode` field in `global` config.
**UI**: Prominent selector at top of dashboard or config page, color-coded by risk level.
66 changes: 66 additions & 0 deletions CONVO
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Account Health Monitor — Recommended Settings
Your data tells a very clear story:

The good: 16 consecutive green days (Jan 14–29), +$259 cumulative profit, 97/107 wins on normal days. With $1 trade sizes you're extremely consistent.

The catastrophe: Jan 30–31 wiped $1,441 — that's 400% of your current balance. The losses came from positions with $1,900–$2,000 notional value (vs your normal $1 trade size). These were clearly manually opened or DCA'd positions that went massively underwater. The Jan 31 batch at 18:43:59 all closed simultaneously — looks like a manual close-all or a liquidation.

Recommended Health Monitor Settings
Given a ~$360 account running $1 trades:

Setting Recommendation Why
enabled true Obviously
maxDrawdownPercent 5% (~$18) Your normal daily P&L is $1–$5. A $18 drawdown from peak is 4–18 days of profit — something is very wrong at that point
maxUnrealizedLossPercent 3% (~$11) With $1 trades at 8x, max loss per position is ~$1. If unrealized loss hits $11, you have multiple underwater positions building up
resumeAtDrawdownPercent 3% Resume once recovered — gives 2% hysteresis band
checkIntervalSeconds 30 Faster detection. Your positions are small so API cost is worth it
closeAllAtDrawdownPercent 10% (~$36) Emergency nuclear option. 10% of $360 is $36 — that's a month of profit. If you're down that much, close everything
These are tight thresholds because your trade sizes are tiny. You should never be down 5% from $1 trades — if you are, something external happened (manual position, DCA spiral, etc).

Global Risk Mode — Design Discussion
Now for the risk-on/risk-off idea. Here's how I'd think about it:

The Concept
A single risk profile selector that acts as a multiplier/modifier across all symbols and behaviors. Something like:

Mode Trade Size Multiplier Max Positions Threshold Sensitivity SL Width Description
Conservative 0.5x 2 Tighter Tighter Low confidence / choppy market
Normal 1.0x 3 Default Default Business as usual
Aggressive 2.0x 4 Looser Wider High confidence / trending market
Max 3.0x 5 Loosest Widest You're very confident
Key Design Questions
1. What should it actually affect?

Trade size: Most obvious — multiply all symbol tradeSize by the mode's multiplier
Max open positions: More aggressive = allow more simultaneous positions
Entry thresholds: Aggressive = lower the liquidation volume needed to trigger a trade (take more signals)
Health monitor thresholds: Aggressive = widen the drawdown tolerance proportionally
SL/TP: Maybe wider SL in aggressive mode (give trades more room), tighter in conservative
2. How should it be stored?

Option A: A single riskMode string in global config ("conservative" | "normal" | "aggressive" | "max"), with the multipliers hardcoded. Clean and simple.

Option B: A riskMode string + customizable multiplier overrides. e.g., you pick "aggressive" but override the trade size multiplier to 1.5x instead of 2x. More flexible.

Option C: Just a single globalMultiplier number (0.5 to 3.0). Everything scales off that one number with sensible formulas. Simplest, but less granular.

3. How does it interact with per-symbol config?

The risk mode would be a multiplier on top of existing per-symbol settings, not a replacement. So if ETHUSDT has tradeSize: 1 and you're in Aggressive mode (2x), the actual trade size becomes $2. Your per-symbol config is the "base" and the risk mode scales it.

4. Should it affect the health monitor?

I think yes — in Aggressive mode, the health monitor thresholds should scale proportionally. If you're taking 2x trades, a 5% drawdown is expected to happen faster, so maybe the threshold becomes 8%. But closeAllAtDrawdownPercent should probably stay fixed (it's a hard safety limit).

5. UI: where does it live?

A prominent toggle/selector at the top of the dashboard or in the config page. Maybe even color-coded — green for conservative, yellow for normal, orange for aggressive, red for max. Something you can flip quickly.

My Recommendation
I'd go with Option A + light customization: a named risk mode with sensible presets, where the main lever is the trade size multiplier. Keep it dead simple to flip between modes. The multiplier values and position limits would be defined as presets but overridable in config.

What's your thinking? Specifically:

Which of those levers matter most to you? (trade size? position count? thresholds?)
Do you want it to feel like 3–4 named presets, or more like a slider?
Should it change anything about which symbols are traded, or just how much?
Loading
Loading