Minimize indicator tool merge resolution

This commit is contained in:
samchen 2026-03-31 01:07:23 -05:00
parent abf82e2cec
commit 682c063272
1 changed files with 10 additions and 16 deletions

View File

@ -10,30 +10,24 @@ 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.
Comma-separated indicator names are supported.
indicator (str): A single technical indicator name, e.g. 'rsi', 'macd'.
Comma-separated input is also supported.
curr_date (str): The current trading date you are trading on, YYYY-mm-dd
look_back_days (int): How many days to look back, default is 30
Returns:
str: A formatted dataframe containing the technical indicators for the specified ticker symbol and indicator.
"""
indicators = [item.strip().lower() for item in indicator.split(",") if item.strip()]
# LLMs sometimes pass multiple indicators as a comma-separated string;
# split and process each individually.
indicators = [i.strip().lower() for i in indicator.split(",") if i.strip()]
results = []
for indicator_name in indicators:
for ind in indicators:
try:
results.append(
route_to_vendor(
"get_indicators",
symbol,
indicator_name,
curr_date,
look_back_days,
)
)
except ValueError as exc:
results.append(str(exc))
results.append(route_to_vendor("get_indicators", symbol, ind, curr_date, look_back_days))
except ValueError as e:
results.append(str(e))
return "\n\n".join(results)