mirror of
https://github.com/farcasclaudiu/TradingAgents.git
synced 2026-06-22 09:01:24 +03:00
refactor: standardize portfolio manager, five-tier rating scale, fix analyst status tracking
This commit is contained in:
@@ -23,7 +23,7 @@ class GraphSetup:
|
||||
bear_memory,
|
||||
trader_memory,
|
||||
invest_judge_memory,
|
||||
risk_manager_memory,
|
||||
portfolio_manager_memory,
|
||||
conditional_logic: ConditionalLogic,
|
||||
):
|
||||
"""Initialize with required components."""
|
||||
@@ -34,7 +34,7 @@ class GraphSetup:
|
||||
self.bear_memory = bear_memory
|
||||
self.trader_memory = trader_memory
|
||||
self.invest_judge_memory = invest_judge_memory
|
||||
self.risk_manager_memory = risk_manager_memory
|
||||
self.portfolio_manager_memory = portfolio_manager_memory
|
||||
self.conditional_logic = conditional_logic
|
||||
|
||||
def setup_graph(
|
||||
@@ -101,8 +101,8 @@ class GraphSetup:
|
||||
aggressive_analyst = create_aggressive_debator(self.quick_thinking_llm)
|
||||
neutral_analyst = create_neutral_debator(self.quick_thinking_llm)
|
||||
conservative_analyst = create_conservative_debator(self.quick_thinking_llm)
|
||||
risk_manager_node = create_risk_manager(
|
||||
self.deep_thinking_llm, self.risk_manager_memory
|
||||
portfolio_manager_node = create_portfolio_manager(
|
||||
self.deep_thinking_llm, self.portfolio_manager_memory
|
||||
)
|
||||
|
||||
# Create workflow
|
||||
@@ -124,7 +124,7 @@ class GraphSetup:
|
||||
workflow.add_node("Aggressive Analyst", aggressive_analyst)
|
||||
workflow.add_node("Neutral Analyst", neutral_analyst)
|
||||
workflow.add_node("Conservative Analyst", conservative_analyst)
|
||||
workflow.add_node("Risk Judge", risk_manager_node)
|
||||
workflow.add_node("Portfolio Manager", portfolio_manager_node)
|
||||
|
||||
# Define edges
|
||||
# Start with the first analyst
|
||||
@@ -176,7 +176,7 @@ class GraphSetup:
|
||||
self.conditional_logic.should_continue_risk_analysis,
|
||||
{
|
||||
"Conservative Analyst": "Conservative Analyst",
|
||||
"Risk Judge": "Risk Judge",
|
||||
"Portfolio Manager": "Portfolio Manager",
|
||||
},
|
||||
)
|
||||
workflow.add_conditional_edges(
|
||||
@@ -184,7 +184,7 @@ class GraphSetup:
|
||||
self.conditional_logic.should_continue_risk_analysis,
|
||||
{
|
||||
"Neutral Analyst": "Neutral Analyst",
|
||||
"Risk Judge": "Risk Judge",
|
||||
"Portfolio Manager": "Portfolio Manager",
|
||||
},
|
||||
)
|
||||
workflow.add_conditional_edges(
|
||||
@@ -192,11 +192,11 @@ class GraphSetup:
|
||||
self.conditional_logic.should_continue_risk_analysis,
|
||||
{
|
||||
"Aggressive Analyst": "Aggressive Analyst",
|
||||
"Risk Judge": "Risk Judge",
|
||||
"Portfolio Manager": "Portfolio Manager",
|
||||
},
|
||||
)
|
||||
|
||||
workflow.add_edge("Risk Judge", END)
|
||||
workflow.add_edge("Portfolio Manager", END)
|
||||
|
||||
# Compile and return
|
||||
return workflow.compile()
|
||||
|
||||
Reference in New Issue
Block a user