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.
This commit is contained in:
1 parent
b3821abd69
commit
e1ac514f30
36 files changed
+1476
-294
No files matched your search
@@ -23,15 +23,19 @@ from config.settings import get_settings
|
||||
from llm.client import build_llm
|
||||
|
||||
CRO_SYSTEM = (
|
||||
"You are the Chief Risk Officer of a small fund. Three analysts submitted tonight's picks. "
|
||||
"You are the Chief Risk Officer of a small fund. {n} analysts submitted tonight's picks. "
|
||||
"Your job is capital preservation and portfolio coherence — NOT stock picking. Judge each "
|
||||
"pick on: thesis quality vs the market regime, concentration/overlap across the three books, "
|
||||
"pick on: thesis quality vs the market regime, concentration/overlap across the books, "
|
||||
"crowding into one theme, position sizing sanity, and each analyst's recent track record. "
|
||||
"Each analyst has a declared risk style — judge every book against ITS OWN mandate: an "
|
||||
"intentionally aggressive book is not vetoed for being aggressive, only for breaking its "
|
||||
"own discipline (undefined risk, sloppy sizing, no catalyst). "
|
||||
"Be decisive and specific. Output ONLY the requested JSON object."
|
||||
)
|
||||
|
||||
CRO_PROMPT = (
|
||||
"{regime}\n\n"
|
||||
"ANALYST MANDATES (risk styles):\n{styles}\n\n"
|
||||
"ANALYST TRACK RECORDS:\n{records}\n\n"
|
||||
"TONIGHT'S SUBMITTED PICKS:\n{picks}\n\n"
|
||||
'Return a JSON object: {{"memo": "<a 150-250 word committee memo in plain prose: overall '
|
||||
@@ -82,15 +86,27 @@ def run_committee(
|
||||
return {}
|
||||
records_txt = "\n".join(f"[{k}]\n{v or '(no history yet)'}" for k, v in records.items())
|
||||
|
||||
# style-aware review: the CRO judges each book against its own declared mandate
|
||||
try:
|
||||
from config.agent_registry import load_personas
|
||||
|
||||
styles = {p.id: p.risk_style for p in load_personas(include_disabled=True)}
|
||||
except Exception:
|
||||
styles = {}
|
||||
styles_txt = "\n".join(
|
||||
f"- {o.persona_id}: {styles.get(o.persona_id, 'balanced')}" for o in outputs
|
||||
)
|
||||
|
||||
verdicts: dict = {}
|
||||
memo = ""
|
||||
try:
|
||||
resp = build_llm(max_tokens=4096).invoke(
|
||||
[
|
||||
SystemMessage(content=CRO_SYSTEM),
|
||||
SystemMessage(content=CRO_SYSTEM.format(n=len(outputs))),
|
||||
HumanMessage(
|
||||
content=CRO_PROMPT.format(
|
||||
regime=regime or "(regime unavailable)",
|
||||
styles=styles_txt or "(none declared)",
|
||||
records=records_txt,
|
||||
picks=picks_txt,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user