chore(agents): remove the deprecated social media analyst names

- the social_media_analyst module and the create_social_media_analyst alias; use create_sentiment_analyst
This commit is contained in:
Yijia-Xiao
2026-09-24 04:31:04 +00:00
parent 15b8276b92
commit a6e92a6b5e
4 changed files with 14 additions and 75 deletions
+1 -5
View File
@@ -1,10 +1,7 @@
from .analysts.fundamentals_analyst import create_fundamentals_analyst
from .analysts.market_analyst import create_market_analyst
from .analysts.news_analyst import create_news_analyst
from .analysts.sentiment_analyst import (
create_sentiment_analyst,
create_social_media_analyst, # deprecated alias kept for back-compat
)
from .analysts.sentiment_analyst import create_sentiment_analyst
from .managers.portfolio_manager import create_portfolio_manager
from .managers.research_manager import create_research_manager
from .researchers.bear_researcher import create_bear_researcher
@@ -32,6 +29,5 @@ __all__ = [
"create_portfolio_manager",
"create_conservative_debator",
"create_sentiment_analyst",
"create_social_media_analyst", # deprecated; will be removed in a future version
"create_trader",
]
@@ -1,31 +1,19 @@
"""Sentiment analyst — multi-source sentiment analysis for a target ticker.
"""Sentiment analyst: one sentiment report from three sources.
Previously named ``social_media_analyst``. Renamed and redesigned because
the old version had a prompt that demanded social-media analysis but the
only tool available was Yahoo Finance news — which led LLMs to fabricate
Reddit/X/StockTwits content under prompt pressure (verified live).
The node fetches its sources before calling the model and puts them in the
prompt, so the model reports on data it was given rather than inventing posts:
The redesigned agent pre-fetches three complementary data sources before
the LLM is invoked and injects them into the prompt as structured blocks:
1. News headlines: Yahoo Finance
2. StockTwits messages: the cashtag stream, with Bullish/Bearish tags
3. Reddit posts: r/wallstreetbets, r/stocks, r/investing
1. News headlines — Yahoo Finance (institutional framing)
2. StockTwits messages — retail-trader posts indexed by cashtag, with
user-labeled Bullish/Bearish sentiment tags
3. Reddit posts — r/wallstreetbets, r/stocks, r/investing
Each source is trimmed to the analysis window. These feeds serve recent items
and are not archived, so a historical run's sentiment inputs are not
point-in-time.
Each source is trimmed to the analysis window. These text feeds serve recent
items and are not archived as of a past date, so sentiment inputs for a
historical run are not guaranteed to be point-in-time.
The agent does not use tool-calling; the data is in the prompt from
turn 0. Output uses the structured-output pattern (json_schema for
OpenAI/xAI, response_schema for Gemini, tool-use for Anthropic), falling
back to free-text generation for providers that lack native support, so
the sentiment header (band + score + confidence) is deterministic across
runs and providers instead of free-form per-model prose.
See: https://github.com/TauricResearch/TradingAgents/issues/557
See: https://github.com/TauricResearch/TradingAgents/issues/796
The report is a SentimentReport through structured output where the provider
supports it and free text otherwise, so the band, score and confidence header
reads the same across providers.
"""
from datetime import datetime, timedelta
@@ -193,25 +181,3 @@ Fill the following fields:
- **narrative**: Full source-by-source breakdown, divergences, dominant narrative themes, catalysts and risks, and a markdown summary table of key sentiment signals (direction, source, supporting evidence).
{get_language_instruction()}"""
# ---------------------------------------------------------------------------
# Backwards-compatibility shim
# ---------------------------------------------------------------------------
def create_social_media_analyst(llm):
"""Deprecated alias for :func:`create_sentiment_analyst`.
Kept so existing code that imports ``create_social_media_analyst``
continues to work.
.. deprecated::
Import :func:`create_sentiment_analyst` directly instead.
"""
import warnings
warnings.warn(
"create_social_media_analyst is deprecated and will be removed in a "
"future version. Use create_sentiment_analyst instead.",
DeprecationWarning,
stacklevel=2,
)
return create_sentiment_analyst(llm)
@@ -1,23 +0,0 @@
"""Backwards-compatibility shim for the renamed module.
The agent is now ``sentiment_analyst`` and aggregates Yahoo Finance news,
StockTwits cashtag streams, and Reddit posts into a single sentiment
report. Import from ``tradingagents.agents.analysts.sentiment_analyst``
going forward; this module will be removed in a future release.
See: https://github.com/TauricResearch/TradingAgents/issues/557
"""
import warnings as _warnings
from tradingagents.agents.analysts.sentiment_analyst import ( # noqa: F401
create_sentiment_analyst,
create_social_media_analyst,
)
_warnings.warn(
"tradingagents.agents.analysts.social_media_analyst is deprecated. "
"Import from tradingagents.agents.analysts.sentiment_analyst instead.",
DeprecationWarning,
stacklevel=2,
)
+1 -1
View File
@@ -66,7 +66,7 @@ class GraphSetup:
Args:
selected_analysts (list): List of analyst types to include. Options are:
- "market": Market analyst
- "social": Social media analyst
- "social": Sentiment analyst
- "news": News analyst
- "fundamentals": Fundamentals analyst
"""