A tool for analyzing stock market trends using Reddit posts and Google News data, powered by Google's Gemini AI. This tool is experimental and should be used with extreme caution.
The tool implements several mechanisms to ensure data quality and reliability:
-
Content Filtering:
- Only processes Reddit posts with 5+ upvotes to filter out low-quality content
- Excludes posts older than 2 months to ensure relevance
- Removes duplicate content across sources
-
Source Validation:
- Reddit posts are fetched from trusted financial subreddits
- News articles are sourced from verified Google News providers
- Cross-references data between Reddit and news sources
-
Data Processing:
- Implements rate limiting and retry logic for API calls
- Maintains historical data for trend comparison
- Uses confidence scoring based on multiple factors:
- Post upvotes and engagement
- News source reliability
- Historical performance consistency
- Risk level alignment
-
Quality Metrics:
- Confidence scores for each stock recommendation
- Risk assessment based on historical volatility
- Source diversity tracking
- Temporal relevance scoring
The tool is designed to process a significant amount of data:
- Default configuration processes up to 100 messages per run.
- By increasing the
loopLimitparameter, it can process up to 3,000-4,000 messages - Data is processed in chunks of 10 messages for optimal AI analysis
- Historical data is maintained in memory for comparison
- All processed data is stored in JSON files for future reference
Note: Processing more messages increases accuracy but also increases API costs and processing time.
- Real-time analysis of stock market trends from Reddit and Google News
- AI-powered stock recommendations using Google's Gemini AI
- Support for multiple risk profiles (low, medium, high)
- Country-specific analysis (India, Global)
- Confidence scoring system for stock recommendations
- Memory-based analysis for tracking stock performance over time
- Detailed JSON reports and summaries
- Node.js
- TypeScript
- API Keys:
- Google Gemini API Key (Get it from Google AI Studio)
- SerpAPI Key (Get it from SerpAPI)
- Clone the repository:
git clone https://github.com/manaver/stocks-analysis.git
cd stocks-analysis- Install dependencies:
npm install- Create a
.envfile in the root directory with your API keys:
GEMINI_API_KEY=your_gemini_api_key
SERPAPI_KEY=your_serpapi_keyNote: You can get your API keys from:
- Gemini API: Google AI Studio
- SerpAPI: SerpAPI
Run real-time analysis with custom parameters:
npx ts-node stocks-analysis.ts \
--risk medium \
--subreddit StockMarketIndia \
--subreddit IndianStockMarket \
--subreddit IndianStocks \
--subreddit IndianStreetBets \
--subreddit personalfinanceindia \
--subreddit unitedstatesofindia \
--subreddit IndiaFinance \
--news "Indian stock market" \
--news "energy sector India" \
--news "stock market spike news" \
--news "stock market breaking news" \
--news "Indian renewable energy stocks" \
--news "high-risk stocks India" \
--news "Indian market volatility" \
--news "top stock market news channels" \
--news "trusted stock market sources" \
--country "India"Analyze historical data stored in memory:
npx ts-node analyze-memory.ts --risk high --country=india--risk, -r: Risk level (low, medium, high) [default: low]--subreddit, -s: Subreddit(s) to analyze (can be specified multiple times)--news, -n: News query (can be specified multiple times)--country, -c: Country for analysis (e.g., india) [default: global]
--risk, -r: Risk level (low, medium, high) [default: low]--country, -c: Country for analysis (e.g., india) [default: global]
The tool generates several JSON files:
stock-report.json: Detailed analysis of top stocksstock-summary.json: Summary of analysis including confidence scoresai-compare-memory.json: Historical comparison datatemp_memory.json: Temporary storage for current analysis
- Low: Focuses on blue-chip stocks with stable growth
- Medium: Includes mid-cap or growth stocks with moderate volatility
- High: Includes small-cap or volatile stocks with high growth potential
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
This tool is for educational and research purposes only. It should not be used as financial advice. The data and analysis provided may be inaccurate or misleading. Always do your own thorough research and consult with qualified financial advisors before making any investment decisions. The developers of this tool are not responsible for any financial losses or decisions made based on this tool's output.
Using this tool for investment decisions carries significant risks:
- The tool may provide incorrect or misleading information
- Market conditions can change rapidly, making analysis outdated
- Social media sentiment may not reflect actual market fundamentals
- AI-generated analysis may contain errors or biases
- Past performance does not guarantee future results
By using this tool, you acknowledge and accept these risks. You are solely responsible for any investment decisions you make.