mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-09-27 15:02:39 +03:00
- the Research Manager's plan and the Portfolio Manager's decision live only in investment_plan and final_trade_decision; the debate states no longer copy them as judge_decision - the saved state log writes the Trader's plan as trader_investment_plan, its state key - the report tree, the final display and the live CLI read the decisions from those fields
73 lines
2.9 KiB
Python
73 lines
2.9 KiB
Python
from typing import Annotated
|
|
|
|
from langgraph.graph import MessagesState
|
|
from typing_extensions import TypedDict
|
|
|
|
|
|
# Researcher team state
|
|
class InvestDebateState(TypedDict):
|
|
bull_history: Annotated[
|
|
str, "Bullish Conversation history"
|
|
]
|
|
bear_history: Annotated[
|
|
str, "Bearish Conversation history"
|
|
]
|
|
history: Annotated[str, "Conversation history"]
|
|
current_response: Annotated[str, "Latest response"]
|
|
count: Annotated[int, "Length of the current conversation"]
|
|
|
|
|
|
# Risk management team state
|
|
class RiskDebateState(TypedDict):
|
|
aggressive_history: Annotated[
|
|
str, "Aggressive Agent's Conversation history"
|
|
]
|
|
conservative_history: Annotated[
|
|
str, "Conservative Agent's Conversation history"
|
|
]
|
|
neutral_history: Annotated[
|
|
str, "Neutral Agent's Conversation history"
|
|
]
|
|
history: Annotated[str, "Conversation history"]
|
|
latest_speaker: Annotated[str, "Analyst that spoke last"]
|
|
current_aggressive_response: Annotated[
|
|
str, "Latest response by the aggressive analyst"
|
|
]
|
|
current_conservative_response: Annotated[
|
|
str, "Latest response by the conservative analyst"
|
|
]
|
|
current_neutral_response: Annotated[
|
|
str, "Latest response by the neutral analyst"
|
|
]
|
|
count: Annotated[int, "Length of the current conversation"]
|
|
|
|
|
|
class AgentState(MessagesState):
|
|
company_of_interest: Annotated[str, "Company that we are interested in trading"]
|
|
asset_type: Annotated[str, "Asset type under analysis such as stock or crypto"]
|
|
instrument_context: Annotated[str, "Deterministic ticker identity resolved at run start"]
|
|
trade_date: Annotated[str, "The analysis date; data is served as of it"]
|
|
|
|
# research step
|
|
market_report: Annotated[str, "Report from the Market Analyst"]
|
|
sentiment_report: Annotated[str, "Report from the Sentiment Analyst"]
|
|
news_report: Annotated[str, "Report from the News Analyst on company and world news"]
|
|
fundamentals_report: Annotated[str, "Report from the Fundamentals Analyst"]
|
|
|
|
# researcher team discussion step
|
|
investment_debate_state: Annotated[
|
|
InvestDebateState, "Current state of the debate on if to invest or not"
|
|
]
|
|
investment_plan: Annotated[str, "Investment plan from the Research Manager"]
|
|
|
|
trader_investment_plan: Annotated[str, "Transaction proposal from the Trader"]
|
|
|
|
# risk management team discussion step
|
|
risk_debate_state: Annotated[
|
|
RiskDebateState, "Current state of the debate on evaluating risk"
|
|
]
|
|
final_trade_decision: Annotated[str, "Final decision from the Portfolio Manager"]
|
|
final_rating: Annotated[str, "The Portfolio Manager's 5-tier rating, or REVIEW when it has none"]
|
|
past_context: Annotated[str, "Memory log context injected at run start (same-ticker decisions + cross-ticker lessons)"]
|
|
portfolio_context: Annotated[str, "Caller-supplied holdings and cash, rendered at run start; empty when not provided"]
|