Files
trading-agent/web/views/reports.py
T
Aryan Singh e1ac514f30 Add dynamic agent registry and options mandate
Introduces a dashboard-managed agent registry (`state/agents.json`) used by nightly research and market-open execution, including support for custom/disabled agents and per-agent time budgets. Expands personas to four agents (adds Maverick), shifts pick targets to include mandatory options, and updates prompts/finalization nudges to enforce option research without hard-failing runs.

Strengthens execution safety by adding option-specific guardrails (conviction floor, premium cap, reserved option slot through trade/day/buying-power caps), validates OCC option symbols in schemas, and normalizes invalid option direction cases. The dashboard was refactored into modular views, adds an Agents admin tab, and improves live portfolio visibility with Alpaca-first data and snapshot fallback.
2026-07-07 22:00:20 -05:00

34 lines
1.1 KiB
Python

"""Reports tab: nightly research notes, committee memo, and PDFs per trade date."""
from __future__ import annotations
import streamlit as st
from web.views.common import S
def render() -> None:
rdir = S.reports_dir
rdates = (
sorted((p.name for p in rdir.iterdir() if p.is_dir()), reverse=True)
if rdir.exists() else []
)
if not rdates:
st.info("No reports yet — generated during the nightly run (state/reports/).")
return
rdate = st.selectbox("Report date", rdates, key="rdate")
ddir = rdir / rdate
# daily.md first, then each agent
mds = sorted(ddir.glob("*.md"), key=lambda p: (p.name != "daily.md", p.name))
for md in mds:
st.markdown(md.read_text())
pdf = md.with_suffix(".pdf")
if pdf.exists():
st.download_button(
f"⬇ Download {pdf.name}", pdf.read_bytes(), file_name=pdf.name,
mime="application/pdf", key=f"dl_{md.stem}",
)
for png in sorted(ddir.glob(f"{md.stem}_*.png")):
st.image(str(png))
st.divider()