From 1732b54e0c00da754bf74879c1518ff9c08aead9 Mon Sep 17 00:00:00 2001 From: mhmmdjafarg Date: Fri, 26 Dec 2025 09:07:54 +0700 Subject: [PATCH] fix fear and greed and market analyst symbol --- cli/main.py | 4 ++-- tradingagents/agents/utils/fundamental_data_tools.py | 6 +++--- tradingagents/dataflows/binance.py | 6 +++--- tradingagents/dataflows/taapi.py | 5 ++++- tradingagents/default_config.py | 2 +- tradingagents/graph/trading_graph.py | 4 +++- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/cli/main.py b/cli/main.py index 2e06d50c..56508472 100644 --- a/cli/main.py +++ b/cli/main.py @@ -432,7 +432,7 @@ def get_user_selections(): # Step 1: Ticker symbol console.print( create_question_box( - "Step 1: Ticker Symbol", "Enter the ticker symbol to analyze", "SPY" + "Step 1: Ticker Symbol", "Enter the ticker symbol to analyze", "BTC/USDT" ) ) selected_ticker = get_ticker() @@ -498,7 +498,7 @@ def get_user_selections(): def get_ticker(): """Get ticker symbol from user input.""" - return typer.prompt("", default="SPY") + return typer.prompt("", default="BTC/USDT") def get_analysis_date(): diff --git a/tradingagents/agents/utils/fundamental_data_tools.py b/tradingagents/agents/utils/fundamental_data_tools.py index 7c14fbff..73a4367e 100644 --- a/tradingagents/agents/utils/fundamental_data_tools.py +++ b/tradingagents/agents/utils/fundamental_data_tools.py @@ -5,14 +5,14 @@ from tradingagents.dataflows.interface import route_to_vendor @tool def get_fundamentals( - ticker: Annotated[str, "ticker symbol"], + ticker: Annotated[str, "ticker symbol"], # e.g., 'BTC/USDT' curr_date: Annotated[str, "current date you are trading at, yyyy-mm-dd"], ) -> str: """ Retrieve comprehensive fundamental data for a given ticker symbol. Uses the configured fundamental_data vendor. Args: - ticker (str): Ticker symbol of the company + ticker (str): Ticker symbol of the cryptocurrency curr_date (str): Current date you are trading at, yyyy-mm-dd Returns: str: A formatted report containing comprehensive fundamental data @@ -98,4 +98,4 @@ def get_market_cap() -> str: Returns: str: A formatted string containing market capitalization percentages """ - return route_to_vendor("get_market_cap") \ No newline at end of file + return route_to_vendor("get_market_cap") diff --git a/tradingagents/dataflows/binance.py b/tradingagents/dataflows/binance.py index 3ac38282..f6c6569d 100644 --- a/tradingagents/dataflows/binance.py +++ b/tradingagents/dataflows/binance.py @@ -28,16 +28,16 @@ def get_market_data(symbol: str, start_date: str, end_date: str): CSV formatted string with OHLCV data """ # remove / from symbol for binance format - symbol = symbol.replace("/", "") + formatted_symbol = symbol.replace("/", "") # Convert dates to epoch time (milliseconds) start_epoch = int(datetime.strptime(start_date, "%Y-%m-%d").timestamp() * 1000) end_epoch = int(datetime.strptime(end_date, "%Y-%m-%d").timestamp() * 1000) - print(f"DEBUG: Fetching data for {symbol} from {start_date} to {end_date}") + print(f"DEBUG: Fetching data for {formatted_symbol} from {start_date} to {end_date}") try: response = client.rest_api.klines( - symbol=symbol, + symbol=formatted_symbol, start_time=start_epoch, end_time=end_epoch, interval="1d", diff --git a/tradingagents/dataflows/taapi.py b/tradingagents/dataflows/taapi.py index aad48a89..c0d13777 100644 --- a/tradingagents/dataflows/taapi.py +++ b/tradingagents/dataflows/taapi.py @@ -149,7 +149,10 @@ def get_crypto_stats_indicators( Returns: str: A formatted report containing all requested technical indicators for the specified ticker symbol. """ - + # validate symbol it must in format BASE/QUOTE + if "/" not in symbol: + return f"Error: Symbol '{symbol}' is not in the correct format. Please use 'BASE/QUOTE' format, e.g., 'BTC/USDT'." + # Supported indicators mapping supported_indicators = { "sma": "Simple Moving Average", diff --git a/tradingagents/default_config.py b/tradingagents/default_config.py index aa74f5f5..ce045696 100644 --- a/tradingagents/default_config.py +++ b/tradingagents/default_config.py @@ -24,7 +24,7 @@ DEFAULT_CONFIG = { "core_stock_apis": "yfinance", # Options: yfinance, alpha_vantage, local "technical_indicators": "taapi", # Options: taapi "fundamental_data": "alpha_vantage", # Options: openai, alpha_vantage, local - "news_data": "alpha_vantage", # Options: openai, alpha_vantage, google, local + "news_data": "telegram", # Options: openai, alpha_vantage, google, local }, # Tool-level configuration (takes precedence over category-level) "tool_vendors": { diff --git a/tradingagents/graph/trading_graph.py b/tradingagents/graph/trading_graph.py index 489387c8..27b5e8f5 100644 --- a/tradingagents/graph/trading_graph.py +++ b/tradingagents/graph/trading_graph.py @@ -37,7 +37,8 @@ from tradingagents.agents.utils.agent_utils import ( get_news, get_insider_sentiment, get_insider_transactions, - get_global_news + get_global_news, + get_fear_and_greed ) from .conditional_logic import ConditionalLogic @@ -142,6 +143,7 @@ class TradingAgentsGraph: [ # News tools for social media analysis get_news, + get_fear_and_greed, ] ), "news": ToolNode(