Optional self-contained HTML export for saved reports
The problem
The CLI's "Save report?" step writes a Markdown tree (1_analysts/, 2_research/, ... plus complete_report.md). That works in an editor, but it is hard to read or share with people who don't have a Markdown viewer: the complete report is a long single file with no navigation, the final rating is buried in the text, and sending it means sending a folder or a raw .md file.
I often want to hand a run's result to someone else, or reread it later on a phone.
Proposed change
Add an optional HTML file next to complete_report.md, written by write_report_tree() in tradingagents/reporting.py (e.g. complete_report.html, behind a CLI prompt/flag or a config key such as "export_html", default off).
The page would be one self-contained file (inline CSS, no JS, no external requests) with:
- A header showing ticker, analysis date, the rating from parse_rating() as a colour-coded label, and the price target and time horizon when the Portfolio Manager provides them
- A contents list linking to each section (sticky sidebar on desktop, stacked on mobile)
- The same sections the Markdown export already contains, in the same order, skipping analysts that were not selected
- Light and dark mode via prefers-color-scheme, readable at phone width
- The existing research-only / not-financial-advice note
Alternatives considered
- LLM output is escaped before rendering so raw HTML in a report cannot inject markup
- Markdown to HTML needs a converter. Options: add the small
markdownpackage as a dependency, make it an optional extra (pip install ".[html]"), or fall back toblocks when it is not installed. Happy to follow whichever you prefer. - System font stack only, so the file works offline
I have a working prototype built on the saved full_states_log JSON (screenshot attached) and can open a PR adapting it to reporting.py if this is welcome.
--- Alternatives considered ---
- Rendering complete_report.md with a Markdown viewer: works for the author, but not for sharing with non-technical readers.
- A standalone script that reads full_states_log_*.json after the run: this is what I use now; it works, but it duplicates the section logic in reporting.py and breaks if state keys change.
- PDF export: heavier dependencies (headless browser or a PDF library) for little gain over HTML, which any browser can already print.
Source: TauricResearch/TradingAgents