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
@@ -71,3 +71,41 @@ def test_run_manifest_minimal():
|
||||
)
|
||||
assert m.status == "running"
|
||||
assert m.agents == []
|
||||
|
||||
|
||||
def test_option_pick_rejects_fabricated_occ_symbol():
|
||||
import pytest as _pytest
|
||||
|
||||
from agents.schemas import Pick
|
||||
|
||||
bad = dict(
|
||||
ticker="JPM", conviction=0.8, thesis="t", requested_weight_pct=0.05,
|
||||
instrument="option", option_right="call",
|
||||
)
|
||||
# missing underlying root (a real LLM fabrication seen in testing)
|
||||
with _pytest.raises(Exception):
|
||||
Pick(**bad, contract_symbol="20270119C0035000")
|
||||
# 6-digit strike instead of 8 (another real fabrication)
|
||||
with _pytest.raises(Exception):
|
||||
Pick(**bad, contract_symbol="PFE260729C002500")
|
||||
# valid OCC symbol passes and is normalized to uppercase
|
||||
p = Pick(**bad, contract_symbol="jpm270115c00300000")
|
||||
assert p.contract_symbol == "JPM270115C00300000"
|
||||
|
||||
|
||||
def test_option_direction_normalization():
|
||||
import pytest as _pytest
|
||||
|
||||
from agents.schemas import Direction, Pick
|
||||
|
||||
base = dict(
|
||||
ticker="JNJ", conviction=0.7, thesis="bearish", requested_weight_pct=0.05,
|
||||
instrument="option", contract_symbol="JNJ260715P00155000",
|
||||
)
|
||||
# short + put -> normalized to a long put (same economic view, buy-to-open)
|
||||
p = Pick(**base, option_right="put", direction="short")
|
||||
assert p.direction == Direction.LONG
|
||||
# short + call has no long-only equivalent -> rejected
|
||||
with _pytest.raises(Exception):
|
||||
Pick(**{**base, "contract_symbol": "JNJ260715C00155000"},
|
||||
option_right="call", direction="short")
|
||||
Reference in new issue
Block a user