docs: add chart diagnostics and dashboard training
This commit is contained in:
229
docs/02-runbooks/dashboard_training.md
Normal file
229
docs/02-runbooks/dashboard_training.md
Normal file
@@ -0,0 +1,229 @@
|
||||
# Dashboard Training
|
||||
**Created:** 2026-08-16
|
||||
**Scope:** Standalone read-only browser dashboard under `tools/dashboard/`
|
||||
|
||||
## What This Is
|
||||
|
||||
The dashboard is a separate browser UI. It is not a NinjaTrader chart overlay and it does not draw on the NT8 chart.
|
||||
|
||||
It reads existing files from disk:
|
||||
|
||||
- `session_*.log`
|
||||
- `trades_*.jsonl`
|
||||
- `provenance_*.json`
|
||||
- `settings_*.txt`
|
||||
|
||||
Default log directory:
|
||||
|
||||
```text
|
||||
C:\Users\billy\Documents\NinjaTrader 8\log\nt8-sdk
|
||||
```
|
||||
|
||||
## Safety Model
|
||||
|
||||
- Read-only UI.
|
||||
- No order controls.
|
||||
- No pause, flatten, kill switch, or broker actions.
|
||||
- No NinjaTrader assembly references.
|
||||
- No writes to NinjaTrader directories.
|
||||
- Live server binds only to `127.0.0.1`.
|
||||
- Only `GET`, `HEAD`, and `OPTIONS` are allowed.
|
||||
- Local runtime state is written to `tools/dashboard/dashboard_state.json` when the live server is used.
|
||||
|
||||
## Launch Modes
|
||||
|
||||
### Live Mode
|
||||
|
||||
Use this when you want the browser to update from the newest NT8 log files while NT8 is running.
|
||||
|
||||
From `C:\dev\nt8-sdk`:
|
||||
|
||||
```powershell
|
||||
Copy-Item .\tools\dashboard\config.example.json .\tools\dashboard\config.json
|
||||
python .\tools\dashboard\server.py --config .\tools\dashboard\config.json
|
||||
```
|
||||
|
||||
Open:
|
||||
|
||||
```text
|
||||
http://127.0.0.1:8765/
|
||||
```
|
||||
|
||||
The browser polls `/api/state` automatically.
|
||||
|
||||
### Static Localhost Mode
|
||||
|
||||
Use this when you want to view the dashboard UI without running the live parser server.
|
||||
|
||||
```powershell
|
||||
python -m http.server 8765 --bind 127.0.0.1 --directory tools/dashboard
|
||||
```
|
||||
|
||||
Open:
|
||||
|
||||
```text
|
||||
http://127.0.0.1:8765/
|
||||
```
|
||||
|
||||
Then load a generated `triage.json` manually.
|
||||
|
||||
### Direct File Mode
|
||||
|
||||
Use this for the simplest offline viewing path.
|
||||
|
||||
```powershell
|
||||
Start-Process .\tools\dashboard\index.html
|
||||
```
|
||||
|
||||
Then load a generated `triage.json` manually.
|
||||
|
||||
## Generating Offline Input
|
||||
|
||||
From `C:\dev\nt8-sdk`:
|
||||
|
||||
```powershell
|
||||
python tools\logtriage\logtriage.py --json | Out-File -Encoding utf8 triage.json
|
||||
```
|
||||
|
||||
Then open the dashboard and select `triage.json`.
|
||||
|
||||
PowerShell 5.1 writes UTF-16LE by default when using `>`. Use `Out-File -Encoding utf8` so the browser can read the JSON.
|
||||
|
||||
## Main Views
|
||||
|
||||
### Gate Progress
|
||||
|
||||
Shows the current gate evidence summary:
|
||||
|
||||
- Trades banked toward the 20-trade target.
|
||||
- Elapsed session days.
|
||||
- Traded-session streak.
|
||||
- Diagnostic count.
|
||||
|
||||
Use this to answer: "Are we accumulating a valid gate run?"
|
||||
|
||||
### Daily Timeline
|
||||
|
||||
Shows one row per session/day.
|
||||
|
||||
Typical classifications:
|
||||
|
||||
- Traded day: session has signal/order/fill evidence.
|
||||
- Silent day: session start exists but no `SIGNAL`, `SUBMIT`, or `FILL` lines.
|
||||
- Config violation: settings or session data violates gate expectations.
|
||||
- Parallel instance: more than one account, bar type, or config state appears on the same day.
|
||||
|
||||
Use this to answer: "Which days are valid evidence, and which days are contaminated?"
|
||||
|
||||
### Trade Detail
|
||||
|
||||
Shows per-trade records parsed from `trades_*.jsonl`.
|
||||
|
||||
Important columns include:
|
||||
|
||||
- Timestamp.
|
||||
- Side.
|
||||
- Quantity.
|
||||
- Grade.
|
||||
- Score.
|
||||
- Runner mode.
|
||||
- Session tag.
|
||||
- Scaler and runner PnL if available.
|
||||
|
||||
Use this to answer: "What did the strategy actually trade, and how did the runner/scaler perform?"
|
||||
|
||||
### Provenance Health
|
||||
|
||||
Shows whether trade records contain useful provenance or sentinel/default values.
|
||||
|
||||
Watch for fields like:
|
||||
|
||||
- `confluence_grade=Unknown`
|
||||
- `confluence_score=0.0`
|
||||
- `risk_mode=Unknown`
|
||||
|
||||
Use this to answer: "Can these trade records be trusted as gate evidence?"
|
||||
|
||||
### Config Integrity
|
||||
|
||||
Shows `ConfigHash` and `CodeVersion` over time.
|
||||
|
||||
Use this to answer: "Did the strategy config or deployed code change during the run?"
|
||||
|
||||
## Live Notifications
|
||||
|
||||
Notifications are optional and use Apprise.
|
||||
|
||||
Install support:
|
||||
|
||||
```powershell
|
||||
python -m pip install -r .\tools\dashboard\requirements.txt
|
||||
```
|
||||
|
||||
Edit local `tools/dashboard/config.json` and set:
|
||||
|
||||
```json
|
||||
"notifications": {
|
||||
"enabled": true,
|
||||
"targets": [
|
||||
"discord://webhook_id/webhook_token",
|
||||
"ntfy://ntfy.sh/your-topic"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Do not commit `tools/dashboard/config.json`; it is local operator configuration.
|
||||
|
||||
Notification events:
|
||||
|
||||
- `SUBMIT`
|
||||
- `FILL`
|
||||
- `BREAKEVEN`
|
||||
- `CONNECTION LOST`
|
||||
- `CONNECTION RESTORED`
|
||||
- `PNL_UPDATE` crossing configured daily PnL milestones
|
||||
|
||||
## How This Relates To The Chart Overlay
|
||||
|
||||
The chart overlay answers: "What is the strategy drawing on this chart right now?"
|
||||
|
||||
The dashboard answers: "What did the logs and trade records say across sessions?"
|
||||
|
||||
Use them together:
|
||||
|
||||
1. Use the chart diagnostics for immediate visual state such as ORB lines or breakout arrows.
|
||||
2. Use the dashboard for readable session history, trades, config drift, provenance health, and gate evidence.
|
||||
3. Use raw session logs for the authoritative audit record.
|
||||
|
||||
## GAP-034 Cross-Check Use
|
||||
|
||||
During the GAP-034 diagnostic session, keep the NT8 Output window open and compare it to session-file lines that start with:
|
||||
|
||||
```text
|
||||
REJECT: reason=
|
||||
REJECT SUMMARY: reason=
|
||||
```
|
||||
|
||||
The dashboard can help locate the newest session log and highlight silent days, but the required cross-check is Output window text versus the session file log.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If the dashboard page opens but shows no live data:
|
||||
|
||||
- Confirm `python .\tools\dashboard\server.py --config .\tools\dashboard\config.json` is running.
|
||||
- Confirm the URL is `http://127.0.0.1:8765/`.
|
||||
- Confirm `log_dir` in `config.json` points to `C:\Users\billy\Documents\NinjaTrader 8\log\nt8-sdk`.
|
||||
- Confirm NT8 has produced `session_*.log`, `trades_*.jsonl`, or `settings_*.txt` files.
|
||||
|
||||
If notifications do not fire:
|
||||
|
||||
- Confirm Apprise is installed.
|
||||
- Confirm `notifications.enabled=true`.
|
||||
- Confirm the target URL is correct.
|
||||
- Watch the server console for notification errors.
|
||||
|
||||
If the dashboard seems stale:
|
||||
|
||||
- Refresh the browser.
|
||||
- Restart `server.py`.
|
||||
- Delete `tools/dashboard/dashboard_state.json` only if you intentionally want notification dedup state reset. The server avoids replaying already-existing historical notifications on restart.
|
||||
Reference in New Issue
Block a user