AutoHedge Sentiment Agent: Social Media Platforms and Scoring Explained
The AutoHedge Sentiment Agent monitors Reddit, Twitter, and StockTwits to calculate quantitative sentiment scores on a 0-to-1 scale, where 0 represents extremely negative and 1 represents extremely positive sentiment.
The-Swarm-Corporation/AutoHedge is an open-source algorithmic trading framework that deploys specialized AI agents to analyze market data and social sentiment. The Sentiment Agent aggregates retail investor conversations from major financial social platforms to generate normalized market mood indicators that drive automated trading decisions.
Monitored Social Media Platforms
According to the SENTIMENT_PROMPT defined in autohedge/prompts.py (lines 47-48), the Sentiment Agent explicitly tracks three social media platforms to capture comprehensive retail investor sentiment.
The agent analyzes discussion threads and subreddits related to specific stocks and market trends. Reddit serves as a primary source for grassroots investor sentiment, meme stock movements, and emerging market narratives that often precede mainstream financial coverage.
The system processes tweets and hashtags mentioning ticker symbols to capture real-time market reactions and breaking news sentiment. This platform provides immediate insight into broad retail investor mood swings and viral financial discussions.
StockTwits
As a dedicated stock-focused social network, StockTwits offers targeted financial conversations between traders and investors. The agent monitors this platform for professional sentiment analysis and ticker-specific discourse that may not appear on general social networks.
Sentiment Score Calculation Methodology
The Sentiment Agent produces a quantitative sentiment score normalized to a 0-to-1 scale (as specified in autohedge/prompts.py lines 49-50).
- 0: Extremely negative sentiment
- 1: Extremely positive sentiment
The score aggregates the polarity and intensity of collected news articles and social media posts. This quantitative approach converts qualitative social media chatter into a normalized metric representing the overall market mood for specific securities.
Implementation in the AutoHedge Codebase
The Sentiment Agent's behavior is implemented across two critical files that define both the analytical logic and the runtime interface.
Configuration in prompts.py
The platform list and scoring methodology are hardcoded in the system prompt. In autohedge/prompts.py, the SENTIMENT_PROMPT specifies:
- The three monitored platforms (Reddit, Twitter, StockTwits)
- The 0-1 scoring range and its interpretation
- The aggregation logic for polarity and intensity
Agent Initialization in workers.py
The sentiment_agent object is declared in autohedge/workers.py with its system prompt and model configuration pre-loaded. This encapsulation allows developers to invoke sentiment analysis without additional prompt engineering.
Practical Usage Example
from autohedge.workers import sentiment_agent
# Example input: ticker, recent news & social posts (simplified)
message = """\
Ticker: AAPL
News: Apple released its latest iPhone with strong sales forecasts.
Social: Reddit thread trending bullish, Twitter sentiment mixed, StockTwits praising earnings."""
# Run the agent – it returns a JSON-compatible sentiment breakdown
result = sentiment_agent.run(message)
print(result) # → overall score, news score, social score, etc.
The sentiment_agent.run() method processes the input through the configured LLM using the SENTIMENT_PROMPT, automatically applying the platform monitoring rules and 0-1 scoring logic defined in the source code.
Summary
- The AutoHedge Sentiment Agent monitors three platforms: Reddit, Twitter, and StockTwits.
- Sentiment scores are calculated on a 0-to-1 scale, where 0 is extremely negative and 1 is extremely positive.
- The scoring methodology aggregates polarity and intensity from both news articles and social media posts.
- Configuration resides in
autohedge/prompts.py(lines 47-50), while the agent implementation is inautohedge/workers.py. - The agent is pre-configured and ready to use via the
sentiment_agent.run()method without additional prompt engineering.
Frequently Asked Questions
Which social media platforms does the Sentiment Agent monitor?
The Sentiment Agent monitors Reddit, Twitter, and StockTwits. These platforms are explicitly listed in the SENTIMENT_PROMPT located in autohedge/prompts.py at lines 47-48, covering both general social networks and specialized financial communities.
How are sentiment scores calculated in AutoHedge?
Sentiment scores are calculated on a quantitative 0-to-1 scale, where 0 represents extremely negative sentiment and 1 represents extremely positive sentiment. The calculation aggregates the polarity and intensity of collected news articles and social media posts, as defined in autohedge/prompts.py lines 49-50.
Where is the Sentiment Agent configured in the codebase?
The Sentiment Agent is configured in autohedge/prompts.py, which defines the SENTIMENT_PROMPT containing platform specifications and scoring rules. The agent instance itself is created in autohedge/workers.py with this prompt and model configuration bound to it.
What does a score of 0.5 indicate in AutoHedge sentiment analysis?
A score of 0.5 indicates neutral sentiment, representing the midpoint between extremely negative (0) and extremely positive (1). This suggests balanced polarity and intensity in the aggregated social media and news data for the analyzed ticker.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →