# Dashboard Hybrid Integration TODO

Goal: add a hybrid candidate-review lane to the XAUUSD 2026 dashboard without changing the integrity rules for confirmed manual replay trades.

## Current hybrid files

- `hybrid/CANDIDATE_SCHEMA.md` — canonical scanner/review schema.
- `hybrid/scripts/scan_candidates.py` — scaffold candidate scanner.
- `hybrid/data/ohlcv_M15.json` — required historical M15 scanner input when available.
- `hybrid/data/ohlcv_M5.json` — optional M5 refinement input when available.
- `hybrid/candidates/candidates.json` — scanner output.
- `hybrid/reviews/reviews.json` — manual replay labels for candidates.

## Integration plan

1. **Keep data sources separate**
   - Continue loading confirmed trades from `data/journal.json` / `data/backtest-data.json`.
   - Continue loading shadow entries from `data/shadow-trades.json`.
   - Add separate optional fetches for:
     - `hybrid/candidates/candidates.json`
     - `hybrid/reviews/reviews.json`
   - Do not merge unreviewed candidates into confirmed trade stats.

2. **Add dashboard sections**
   - Candidate summary cards:
     - total scanner candidates
     - unreviewed
     - accepted
     - rejected
     - shadow / needs more context
   - Candidate table:
     - timestamp, session, strategy, direction, score, status, liquidity swept, flags, notes
   - Review table:
     - candidate id, status, outcome, R, journal trade id, notes

3. **Join candidates to reviews client-side**
   - Key by `candidate.id` ↔ `review.candidate_id`.
   - If no review exists, show status as `unreviewed`.
   - If a review has `journal_trade_id`, link/display the confirmed journal trade separately.

4. **Preserve dashboard metric integrity**
   - Confirmed win rate, R, equity, and strategy stats must only use manually replayed confirmed trades.
   - Candidate counts may be displayed as research funnel metrics only.
   - Label the section clearly: `Hybrid Scanner Candidates — manual replay required`.

5. **Suggested UI labels**
   - Data-source badge: `hybrid candidates loaded` / `no hybrid candidates file`.
   - Warning copy: `Scanner candidates are not final backtest trades. Confirm in TradingView Bar Replay before journaling.`
   - Status chips: `unreviewed`, `accepted`, `rejected`, `shadow`, `needs more context`.

6. **Future review workflow**
   - Run `python3 hybrid/scripts/scan_candidates.py` after OHLCV data is prepared.
   - Open candidate in TradingView Bar Replay at `timestamp`.
   - Review W/D/H4 narrative → M30 daily structure → M15/M5 execution chronologically.
   - Write review label to `hybrid/reviews/reviews.json`.
   - Only if accepted as a real replay trade, append canonical trade to `data/journal.json` and `data/backtest-data.json`.
   - For missed/observed/paper-only outcomes, write canonical shadow entry to `data/shadow-trades.json` if appropriate.

## Validation commands

```bash
cd /home/aryy/.hermes/profiles/finance/backtests/xauusd_2026
python3 -m py_compile hybrid/scripts/scan_candidates.py
python3 hybrid/scripts/scan_candidates.py --allow-missing-m15
python3 -m json.tool hybrid/candidates/candidates.json >/dev/null
python3 -m json.tool hybrid/reviews/reviews.json >/dev/null
```

## Non-goals for this scaffold

- No full automated backtest engine.
- No final expectancy or win-rate claims from scanner candidates.
- No writes to old manual journal/backtest data from scanner code.
- No deletion or mutation of the paused manual replay cron job.
