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, look_back_days: Annotated[int, "how many days to look back"] = 30,
) -> str: ) -> 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. Uses the configured technical_indicators vendor.
Args: Args:
symbol (str): Ticker symbol of the company, e.g. AAPL, TSM 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'.
Comma-separated indicator names are supported. Comma-separated input is also supported.
curr_date (str): The current trading date you are trading on, YYYY-mm-dd 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 look_back_days (int): How many days to look back, default is 30
Returns: Returns:
str: A formatted dataframe containing the technical indicators for the specified ticker symbol and indicator. 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 = [] results = []
for indicator_name in indicators: for ind in indicators:
try: try:
results.append( results.append(route_to_vendor("get_indicators", symbol, ind, curr_date, look_back_days))
route_to_vendor( except ValueError as e:
"get_indicators", results.append(str(e))
symbol,
indicator_name,
curr_date,
look_back_days,
)
)
except ValueError as exc:
results.append(str(exc))
return "\n\n".join(results) return "\n\n".join(results)