hsliuping/TradingAgents-CN · error · ValueError
Indicator {indicator} is not supported. Please choose from:
Error message
Indicator {indicator} is not supported. Please choose from: {list(best_ind_params.keys())} What it means
Raised by get_stock_stats_indicators_window when the requested indicator name is not a key of best_ind_params (the fixed indicator dictionary: RSI, MACD, boll, etc.). The message interpolates {indicator} and the list of valid keys at raise time.
Source
Thrown at tradingagents/dataflows/interface.py:737
"ATR: Averages true range to measure volatility. "
"Usage: Set stop-loss levels and adjust position sizes based on current market volatility. "
"Tips: It's a reactive measure, so use it as part of a broader risk management strategy."
),
# Volume-Based Indicators
"vwma": (
"VWMA: A moving average weighted by volume. "
"Usage: Confirm trends by integrating price action with volume data. "
"Tips: Watch for skewed results from volume spikes; use in combination with other volume analyses."
),
"mfi": (
"MFI: The Money Flow Index is a momentum indicator that uses both price and volume to measure buying and selling pressure. "
"Usage: Identify overbought (>80) or oversold (<20) conditions and confirm the strength of trends or reversals. "
"Tips: Use alongside RSI or MACD to confirm signals; divergence between price and MFI can indicate potential reversals."
),
}
if indicator not in best_ind_params:
raise ValueError(
f"Indicator {indicator} is not supported. Please choose from: {list(best_ind_params.keys())}"
)
end_date = curr_date
curr_date = datetime.strptime(curr_date, "%Y-%m-%d")
before = curr_date - relativedelta(days=look_back_days)
if not online:
# read from YFin data
data = pd.read_csv(
os.path.join(
DATA_DIR,
f"market_data/price_data/{symbol}-YFin-data-2015-01-01-2025-03-25.csv",
)
)
data["Date"] = pd.to_datetime(data["Date"], utc=True)
dates_in_df = data["Date"].astype(str).str[:10]
View on GitHub (pinned to 74783e8817)
Solutions
- Read the error message: it lists the supported indicators
- Use one of the listed keys exactly (e.g. 'rsi', 'macd', 'boll')
- Call get_stock_stats directly for custom indicators outside the curated set
Example fix
# before
report = get_stockstats_indicators_report('AAPL', 'CCI')
# after
report = get_stockstats_indicators_report('AAPL', 'rsi') Defensive patterns
Strategy: validation
Validate before calling
import tradingagents.dataflows.interface as iface
indicator = indicator.lower()
# whitelist derived from the module's best_ind_params keys
assert indicator in ('rsi','macd','boll','obv','mfi'), f'unsupported: {indicator}'
report = get_stockstats_indicators_report(symbol, indicator) Type guard
def is_supported_indicator(name: str) -> bool:
return name.lower() in ('rsi','macd','boll','obv','mfi') Try / catch
try:
report = get_stockstats_indicators_report(symbol, indicator)
except ValueError as e:
if 'not supported' in str(e):
report = get_stockstats_indicators_report(symbol, 'rsi') # default
else:
raise Prevention
- Lowercase user input before passing
- Expose the supported list in your UI/validation layer
- Wrap user-facing indicator params in an enum
When it happens
Trigger: Calling get_stockstats_indicators_report(symbol, indicator='cci') or a case variant like 'BOLL' — anything not exactly matching a key in best_ind_params in interface.py.
Common situations: Assuming any stockstats/pandas-ta indicator name works, case mismatches, or copy-pasting indicator names from other libraries.
Related errors
- REDDIT FETCHING ERROR: max limit is less than the number of
- 不支持的指标: {name}
- name
- MongoDB连接字符串未配置。请设置环境变量 MONGODB_CONNECTION_STRING\n例如: MONGO
- Redis连接配置未完整设置。请设置以下环境变量之一:\n1. REDIS_CONNECTION_STRING=redi
AI-assisted analysis of hsliuping/TradingAgents-CN@74783e8817 (2026-08-28).
Data as JSON: /api/errors/23f269652246f454.
Report an issue: GitHub.