From db39a677a31f7a59f4b75bf6cc5022c000b1adcf Mon Sep 17 00:00:00 2001 From: Faris Hasim Date: Thu, 25 Dec 2025 21:50:41 +0700 Subject: [PATCH] feat: update state & researcher prompts --- .python-version | 2 +- tradingagents/agents/researchers/bear_researcher.py | 6 +++--- tradingagents/agents/researchers/bull_researcher.py | 4 ++-- tradingagents/graph/propagation.py | 7 ++++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.python-version b/.python-version index 56bb6605..c8cfe395 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.12.7 +3.10 diff --git a/tradingagents/agents/researchers/bear_researcher.py b/tradingagents/agents/researchers/bear_researcher.py index 6634490a..cfaf06e9 100644 --- a/tradingagents/agents/researchers/bear_researcher.py +++ b/tradingagents/agents/researchers/bear_researcher.py @@ -22,11 +22,11 @@ def create_bear_researcher(llm, memory): for i, rec in enumerate(past_memories, 1): past_memory_str += rec["recommendation"] + "\n\n" - prompt = f"""You are a Bear Analyst making the case against investing in the stock. Your goal is to present a well-reasoned argument emphasizing risks, challenges, and negative indicators. Leverage the provided research and data to highlight potential downsides and counter bullish arguments effectively. + prompt = f"""You are a Bear Analyst making the case against investing in the crypto coin. Your goal is to present a well-reasoned argument emphasizing risks, challenges, and negative indicators. Leverage the provided research and data to highlight potential downsides and counter bullish arguments effectively. Key points to focus on: -- Risks and Challenges: Highlight factors like market saturation, financial instability, or macroeconomic threats that could hinder the stock's performance. +- Risks and Challenges: Highlight factors like market saturation, financial instability, or macroeconomic threats that could hinder the coin's performance. - Competitive Weaknesses: Emphasize vulnerabilities such as weaker market positioning, declining innovation, or threats from competitors. - Negative Indicators: Use evidence from financial data, market trends, or recent adverse news to support your position. - Bull Counterpoints: Critically analyze the bull argument with specific data and sound reasoning, exposing weaknesses or over-optimistic assumptions. @@ -41,7 +41,7 @@ Company fundamentals report: {fundamentals_report} Conversation history of the debate: {history} Last bull argument: {current_response} Reflections from similar situations and lessons learned: {past_memory_str} -Use this information to deliver a compelling bear argument, refute the bull's claims, and engage in a dynamic debate that demonstrates the risks and weaknesses of investing in the stock. You must also address reflections and learn from lessons and mistakes you made in the past. +Use this information to deliver a compelling bear argument, refute the bull's claims, and engage in a dynamic debate that demonstrates the risks and weaknesses of investing in the coin. You must also address reflections and learn from lessons and mistakes you made in the past. """ response = llm.invoke(prompt) diff --git a/tradingagents/agents/researchers/bull_researcher.py b/tradingagents/agents/researchers/bull_researcher.py index b03ef755..6bc07dff 100644 --- a/tradingagents/agents/researchers/bull_researcher.py +++ b/tradingagents/agents/researchers/bull_researcher.py @@ -22,10 +22,10 @@ def create_bull_researcher(llm, memory): for i, rec in enumerate(past_memories, 1): past_memory_str += rec["recommendation"] + "\n\n" - prompt = f"""You are a Bull Analyst advocating for investing in the stock. Your task is to build a strong, evidence-based case emphasizing growth potential, competitive advantages, and positive market indicators. Leverage the provided research and data to address concerns and counter bearish arguments effectively. + prompt = f"""You are a Bull Analyst advocating for investing in the crypto coin. Your task is to build a strong, evidence-based case emphasizing growth potential, competitive advantages, and positive market indicators. Leverage the provided research and data to address concerns and counter bearish arguments effectively. Key points to focus on: -- Growth Potential: Highlight the company's market opportunities, revenue projections, and scalability. +- Growth Potential: Highlight the coin's market opportunities, revenue projections, and scalability. - Competitive Advantages: Emphasize factors like unique products, strong branding, or dominant market positioning. - Positive Indicators: Use financial health, industry trends, and recent positive news as evidence. - Bear Counterpoints: Critically analyze the bear argument with specific data and sound reasoning, addressing concerns thoroughly and showing why the bull perspective holds stronger merit. diff --git a/tradingagents/graph/propagation.py b/tradingagents/graph/propagation.py index 58ebd0a8..c67ee215 100644 --- a/tradingagents/graph/propagation.py +++ b/tradingagents/graph/propagation.py @@ -16,12 +16,13 @@ class Propagator: self.max_recur_limit = max_recur_limit def create_initial_state( - self, company_name: str, trade_date: str + self, ticker: str, trade_date: str ) -> Dict[str, Any]: """Create the initial state for the agent graph.""" return { - "messages": [("human", company_name)], - "company_of_interest": company_name, + "messages": [("human", ticker)], + "company_of_interest": ticker, + "coin_of_interest": ticker, "trade_date": str(trade_date), "investment_debate_state": InvestDebateState( {"history": "", "current_response": "", "count": 0}