Skip to content

Live record of paper runs: NautilusTrader JSON log, decision stream, read-only manifest - #138

Merged
seathatflowsinourveins merged 4 commits into
mainfrom
claude/paper-live-manifest-20260923
Sep 23, 2026
Merged

seathatflowsinourveins merged 4 commits into
mainfrom
claude/paper-live-manifest-20260923

Conversation

@seathatflowsinourveins

Copy link
Copy Markdown
Collaborator

Why

A live view of a paper run's trading and decision-making. NautilusTrader 2.0.0rc5 has no live dashboard of its own: tearsheets take a BacktestEngine/BacktestResult, ReportProvider returns DataFrames, and Nautilus Cloud's dashboards are commercial and "coming soon". Its JSON file logger (FileWriterConfig(file_format="json")) is the upstream live record.

What

  • runner.py --live-dir DIR (optional; absent = unchanged): decisions and intents appended to DIR/events.jsonl as they happen; NautilusTrader JSON file log in DIR/nautilus/.
  • live_manifest.py: loopback page, /api/state, Prometheus /metrics. Reads the run dir, the ledger (sqlite3 mode=ro) and the STOP file only; redacts account identifiers; shows no balances.
  • observability/paper-trading-live/: OTel Collector file_log → Loki pipeline (bodies kept, ids redacted), Prometheus scrape job, Grafana dashboard paper-trading-live.

Checks

  • 8 new tests, including a native rc5 node in a fresh process writing SubmitOrder events to the JSON log.
  • Engine suites with an isolated HOME: 686 OK (1 skipped). validate.py passed. Guarded gitleaks: no leaks.
  • Host: otelcol-contrib validate passed on the merged collector config; promtool check config passed.

🤖 Generated with Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-23T18:54:31.788021Z 7db1414 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7db1414332

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@seathatflowsinourveins
seathatflowsinourveins force-pushed the claude/paper-live-manifest-20260923 branch from 7db1414 to fbda240 Compare September 23, 2026 18:55
…read-only manifest

- runner.py --live-dir DIR (optional; absent = unchanged): the controller's event list
  also appends each decision and intent to DIR/events.jsonl as it happens
  (LiveEventLog; a write failure is counted, never raised), and the node gets
  NautilusTrader's own JSON file logger in DIR/nautilus (native_adapter.logger_config:
  FileWriterConfig(file_format="json"), INFO and above; stdout stays ERROR).
- live_manifest.py: loopback page, /api/state and Prometheus /metrics from the run
  directory, the durable ledger opened sqlite3 mode=ro, and the STOP file. No broker
  access, no ledger writes; account ids and fingerprints redacted, no balances.
- observability/paper-trading-live: collector file_log receivers and a Loki pipeline
  that keeps bodies and redacts account identifiers, a 5 s Prometheus scrape, and a
  Grafana dashboard (uid paper-trading-live).

NautilusTrader 2.0.0rc5 has no live dashboard of its own (tearsheets are backtest-only,
ReportProvider returns DataFrames, Nautilus Cloud is commercial and not yet available);
its JSON file logger is the upstream live record used.

Tests: 8 new (event log lines and failure counting, manifest state/metrics/redaction,
read-only ledger, logger_config, and a native node in a fresh process writing
SubmitOrder events to the JSON log). Engine suites with an isolated HOME: 686 OK
(1 skipped). validate.py passed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ass LIVE_DIR through the trial wrapper (review)

- NautilusTrader rc5 logs every AccountState at INFO with balances and margins
  (confirmed in a native JSON log); live_manifest.redact and the collector pipeline now
  replace balances=[...] and margins=[...], with a regression test.
- Ledger intent status counts come from a GROUP BY over the whole ledger, not the 200
  rows shown; the dashboard panel says so.
- The request handler answers loopback Host names only and returns a 500 JSON error
  instead of an empty reply on a source error; limits parsing moved inside the guard.
- scheduled_trial.sh: optional LIVE_DIR is passed to runner.py as --live-dir.
- README: collector log times are read time (no timestamp parser).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… surface stream and ledger health (Codex review)

- runner --live-dir writes run.json (trial, its ledger, the kill switch it checks);
  live_manifest uses that binding for the ledger and STOP status, else the ledger with
  the latest write including its WAL.
- The default run directory is the one whose event stream or engine log changed last,
  not the directory mtime.
- Gauges: adaptive_paper_ledger_readable, adaptive_paper_bound_to_run,
  adaptive_paper_events_age_seconds; the page shows ledger binding and stream age.
- The run outcome records live_event_write_errors when --live-dir is used.
- Collector: records carry their source time (events: at epoch seconds; Nautilus:
  RFC 3339 ns) and a run attribute from the run directory; the file path is dropped.
  Checked with otelcol-contrib 0.161.0 on sample files.

Tests: 10 in the live-manifest module. Engine suites (isolated HOME): 688 OK (1 skipped).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@seathatflowsinourveins
seathatflowsinourveins force-pushed the claude/paper-live-manifest-20260923 branch from 9b75a17 to 2d43fc6 Compare September 23, 2026 19:27
@seathatflowsinourveins
seathatflowsinourveins merged commit 40828df into main Sep 23, 2026
22 checks passed
@seathatflowsinourveins
seathatflowsinourveins deleted the claude/paper-live-manifest-20260923 branch September 23, 2026 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant