TradingAgents: Multi-Agents LLM Financial Trading Framework
fix: handle comma-separated indicators in get_indicators tool
Yijia-Xiaofe9c8d5d3184
diff --git a/tradingagents/agents/utils/technical_indicators_tools.py b/tradingagents/agents/utils/technical_indicators_tools.pyindex c6c08bca3..77acf09cb 100644--- a/tradingagents/agents/utils/technical_indicators_tools.py+++ b/tradingagents/agents/utils/technical_indicators_tools.py@@ -10,14 +10,22 @@ def get_indicators(look_back_days: Annotated[int, "how many days to look back"] = 30,) -> str:"""- Retrieve technical indicators for a given ticker symbol.+ Retrieve a single technical indicator for a given ticker symbol.Uses the configured technical_indicators vendor.Args:symbol (str): Ticker symbol of the company, e.g. AAPL, TSM- indicator (str): Technical indicator to get the analysis and report of+ indicator (str): A single technical indicator name, e.g. 'rsi', 'macd'. Call this tool once per indicator.curr_date (str): The current trading date you are trading on, YYYY-mm-ddlook_back_days (int): How many days to look back, default is 30Returns:str: A formatted dataframe containing the technical indicators for the specified ticker symbol and indicator."""- return route_to_vendor("get_indicators", symbol, indicator, curr_date, look_back_days)\ No newline at end of file+ # LLMs sometimes pass multiple indicators as a comma-separated string;+ # split and process each individually.+ indicators = [i.strip() for i in indicator.split(",") if i.strip()]+ if len(indicators) > 1:+ results = []+ for ind in indicators:+ results.append(route_to_vendor("get_indicators", symbol, ind, curr_date, look_back_days))+ return "\n\n".join(results)+ return route_to_vendor("get_indicators", symbol, indicator.strip(), curr_date, look_back_days)\ No newline at end of file