Files
nt8-sdk/tools/logtriage/README.md

59 lines
2.1 KiB
Markdown

# logtriage
`logtriage` is a standalone Python CLI for triaging NT8 SDK runtime artifacts without referencing any NinjaTrader assembly or changing deployed NT8 output.
Python was chosen instead of a .NET console app because it keeps the tool fully outside `NT8-SDK.sln`, requires no solution or publish changes, and avoids any chance of being pulled into `NinjaTrader.Custom.dll` deployment.
## Inputs
The script reads these files from a directory:
- `session_*.log`
- `trades_*.jsonl`
- `provenance_*.json`
- `settings_*.txt`
Default input directory:
`%USERPROFILE%\Documents\NinjaTrader 8\log\nt8-sdk`
## Output
Text mode prints:
1. A per-day table with:
`Date | Account | Instrument | BarType | DaysToLoad | DailyBars | WarmupOK | Signals | Submits | Fills | NetPnL | KillSwitch | VerboseLog | ConfigHash(8) | TestMode`
2. A `DIAGNOSTICS` section flagging:
`SILENT DAY`, `PARALLEL INSTANCE`, `NO CONFIG CAPTURE`, `GATE CONFIG VIOLATION`, `CONFIG DRIFT`, and `PROVENANCE DEFECT`
`--json` emits machine-readable output for dashboard ingestion, including session rows, diagnostics, and per-trade records enriched with source file and line metadata.
## Usage
Run against the default NT8 SDK log directory:
```powershell
python tools/logtriage/logtriage.py
```
Run against a specific archive directory:
```powershell
python tools/logtriage/logtriage.py "C:\logs\nt8-sdk-archive"
```
Emit JSON for another tool or dashboard:
```powershell
python tools/logtriage/logtriage.py --json | Out-File -Encoding utf8 triage.json
```
## Notes
- The tool is read-only.
- It does not import or reference any NinjaTrader or NT8 SDK assembly.
- Session rows are built from `session_*.log` and enriched with nearest same-day `settings_*.txt` and `provenance_*.json` snapshots.
- JSON session rows include `config_hash`, `config_hash_8`, and `code_version` when present in settings or provenance artifacts.
- JSON output includes `trade_records` copied from `trades_*.jsonl` with added `date`, `path`, and `line` fields for dashboard traceability.
- Trade provenance defects are scanned directly from `trades_*.jsonl` rows.