feat(graph): accept the caller's portfolio as run input (#1304, #1166)

- PortfolioContext input, rendered once into state and read by the trader, risk and portfolio agents
- --portfolio JSON file on the CLI
- a run without it is never treated as a flat book
- the checkpoint signature keys on the portfolio
This commit is contained in:
Yijia-Xiao
2026-09-16 20:19:49 +00:00
parent dffff22951
commit 6436d1ff30
14 changed files with 391 additions and 21 deletions
@@ -1,6 +1,7 @@
from tradingagents.agents.utils.agent_utils import (
get_instrument_context_from_state,
get_language_instruction,
get_portfolio_context_from_state,
opponent_argument_or_opening,
)
@@ -23,6 +24,7 @@ def create_aggressive_debator(llm):
news_report = state["news_report"]
fundamentals_report = state["fundamentals_report"]
instrument_context = get_instrument_context_from_state(state)
portfolio_context = get_portfolio_context_from_state(state)
trader_decision = state["trader_investment_plan"]
@@ -33,6 +35,7 @@ def create_aggressive_debator(llm):
Your task is to create a compelling case for the trader's decision by questioning and critiquing the conservative and neutral stances to demonstrate why your high-reward perspective offers the best path forward. Incorporate insights from the following sources into your arguments:
{instrument_context}
{portfolio_context}
Market Research Report: {market_research_report}
Social Media Sentiment Report: {sentiment_report}
Latest World Affairs Report: {news_report}