mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-09-19 11:15:24 +03:00
fix(agents): ground the Trader in the technical market report
- the Trader received only the digested investment plan, so its entry / stop / sizing levels were not anchored to real price structure (ATR, support and resistance, current price) - inject the market report and instruct the Trader to take concrete price levels from it and direction/strategy from the plan; when the market analyst was not selected the report is empty, so the section and grounding note are omitted #1167
This commit is contained in:
@@ -25,6 +25,23 @@ def create_trader(llm):
|
||||
company_name = state["company_of_interest"]
|
||||
instrument_context = get_instrument_context_from_state(state)
|
||||
investment_plan = state["investment_plan"]
|
||||
# The research plan digests the debate but loses exact price structure;
|
||||
# give the Trader the technical market report so entry/stop levels are
|
||||
# grounded in real ATR / support-resistance / current price (#1167). The
|
||||
# report is empty when the user did not select the market analyst, so
|
||||
# only offer it (and the grounding instruction) when it has content.
|
||||
market_report = (state["market_report"] or "").strip()
|
||||
|
||||
if market_report:
|
||||
grounding = (
|
||||
"Ground concrete price levels (entry, stop-loss, position sizing) in the technical "
|
||||
"market report's price structure -- current price, support/resistance, ATR, and "
|
||||
"volatility -- and use the research plan for direction and strategy. "
|
||||
)
|
||||
report_section = f"Technical Market Report:\n{market_report}\n\n"
|
||||
else:
|
||||
grounding = ""
|
||||
report_section = ""
|
||||
|
||||
messages = [
|
||||
{
|
||||
@@ -32,7 +49,7 @@ def create_trader(llm):
|
||||
"content": (
|
||||
"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. "
|
||||
"Anchor your reasoning in the analysts' reports and the research plan. "
|
||||
+ grounding
|
||||
+ NO_EXTERNAL_TOOLS
|
||||
+ get_language_instruction()
|
||||
),
|
||||
@@ -40,12 +57,11 @@ def create_trader(llm):
|
||||
{
|
||||
"role": "user",
|
||||
"content": (
|
||||
f"Based on a comprehensive analysis by a team of analysts, here is an investment "
|
||||
f"plan tailored for {company_name}. {instrument_context} This plan incorporates "
|
||||
f"insights from current technical market trends, macroeconomic indicators, and "
|
||||
f"social media sentiment. Use this plan as a foundation for evaluating your next "
|
||||
f"trading decision.\n\nProposed Investment Plan: {investment_plan}\n\n"
|
||||
f"Leverage these insights to make an informed and strategic decision."
|
||||
f"Here is the research team's investment plan for {company_name}. "
|
||||
f"{instrument_context}\n\n"
|
||||
f"{report_section}"
|
||||
f"Proposed Investment Plan:\n{investment_plan}\n\n"
|
||||
f"Make an informed, strategic trading decision."
|
||||
),
|
||||
},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user