fix: preserve exchange-qualified tickers across agent prompts

This commit is contained in:
CadeYu
2026-03-21 13:10:09 +08:00
parent f362a160c3
commit 08bfe70a69
11 changed files with 91 additions and 24 deletions
+11 -1
View File
@@ -19,6 +19,16 @@ from tradingagents.agents.utils.news_data_tools import (
get_global_news
)
def build_instrument_context(ticker: str) -> str:
"""Describe the exact instrument so agents avoid cross-exchange symbol mixups."""
return (
f"The exact listed instrument to analyze is `{ticker}`. "
"Use this exact ticker in every tool call, report, and recommendation. "
"If it includes an exchange suffix such as `.TO`, `.L`, `.HK`, or `.T`, preserve that suffix and do not mix in companies from other exchanges that share the same root symbol. "
"If it does not include a suffix, do not invent one."
)
def create_msg_delete():
def delete_messages(state):
"""Clear messages and add placeholder for Anthropic compatibility"""
@@ -35,4 +45,4 @@ def create_msg_delete():
return delete_messages