From 823627c6a4bf89cd8a04c5b1f215c207a179e5f3 Mon Sep 17 00:00:00 2001 From: mhmmdjafarg Date: Fri, 26 Dec 2025 01:52:22 +0700 Subject: [PATCH] change trader prompt to crypto --- tradingagents/agents/trader/trader.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tradingagents/agents/trader/trader.py b/tradingagents/agents/trader/trader.py index 1b05c35d..4135cab7 100644 --- a/tradingagents/agents/trader/trader.py +++ b/tradingagents/agents/trader/trader.py @@ -5,7 +5,7 @@ import json def create_trader(llm, memory): def trader_node(state, name): - company_name = state["company_of_interest"] + ticker = state["ticker_of_interest"] investment_plan = state["investment_plan"] market_research_report = state["market_report"] sentiment_report = state["sentiment_report"] @@ -22,15 +22,24 @@ def create_trader(llm, memory): else: past_memory_str = "No past memories found." + base_asset = "" + quote_asset = "" + if isinstance(ticker, str) and "/" in ticker: + base_asset, quote_asset = ticker.split("/", 1) + + pair_context = ticker + if base_asset and quote_asset: + pair_context = f"{ticker} (base={base_asset}, quote={quote_asset})" + context = { "role": "user", - "content": f"Based on a comprehensive analysis by a team of analysts, here is an investment plan tailored for {company_name}. This plan incorporates insights from current technical market trends, macroeconomic indicators, and social media sentiment. Use this plan as a foundation for evaluating your next trading decision.\n\nProposed Investment Plan: {investment_plan}\n\nLeverage these insights to make an informed and strategic decision.", + "content": f"Based on a comprehensive analysis by a team of analysts, here is an investment plan for the crypto pair {pair_context}. This plan incorporates insights from current technical market trends, macroeconomic indicators, and social media sentiment. Use this plan as a foundation for evaluating your next crypto trading decision.\n\nProposed Investment Plan: {investment_plan}\n\nLeverage these insights to make an informed and strategic decision for this crypto market.", } messages = [ { "role": "system", - "content": f"""You are a trading agent analyzing market data to make investment decisions. Based on your analysis, provide a specific recommendation to buy, sell, or hold. End with a firm decision and always conclude your response with 'FINAL TRANSACTION PROPOSAL: **BUY/HOLD/SELL**' to confirm your recommendation. Do not forget to utilize lessons from past decisions to learn from your mistakes. Here is some reflections from similar situatiosn you traded in and the lessons learned: {past_memory_str}""", + "content": f"""You are a crypto trading agent analyzing cryptocurrency market data for a specific trading pair (e.g., BTC/USDT). Based on your analysis, provide a specific recommendation to BUY, SELL, or HOLD the base asset relative to the quote asset for the pair {pair_context}. End with a firm decision and always conclude your response with 'FINAL TRANSACTION PROPOSAL: **BUY/HOLD/SELL**' to confirm your recommendation. Do not forget to utilize lessons from past decisions to learn from your mistakes. Here is some reflections from similar situations you traded in and the lessons learned: {past_memory_str}""", }, context, ]