Skip to content

manaver/stocks-analysis

Repository files navigation

Stock Market Analysis Tool

⚠️ IMPORTANT DISCLAIMER: This is NOT a professional financial tool. The data and analysis provided by this tool may not be accurate and should be used at your own risk. This tool is for educational and experimental purposes only.

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.

Data Quality Assurance

The tool implements several mechanisms to ensure data quality and reliability:

  1. 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
  2. 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
  3. 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
  4. Quality Metrics:

    • Confidence scores for each stock recommendation
    • Risk assessment based on historical volatility
    • Source diversity tracking
    • Temporal relevance scoring

Message Processing Capacity

The tool is designed to process a significant amount of data:

  1. Default configuration processes up to 100 messages per run.
  2. By increasing the loopLimit parameter, it can process up to 3,000-4,000 messages
  3. Data is processed in chunks of 10 messages for optimal AI analysis
  4. Historical data is maintained in memory for comparison
  5. 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.

Features

  • 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

Prerequisites

  • Node.js
  • TypeScript
  • API Keys:

Installation

  1. Clone the repository:
git clone https://github.com/manaver/stocks-analysis.git
cd stocks-analysis
  1. Install dependencies:
npm install
  1. Create a .env file in the root directory with your API keys:
GEMINI_API_KEY=your_gemini_api_key
SERPAPI_KEY=your_serpapi_key

Note: You can get your API keys from:

Usage

Real-time Analysis

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"

Memory Analysis

Analyze historical data stored in memory:

npx ts-node analyze-memory.ts --risk high --country=india

Command Line Options

stocks-analysis.ts

  • --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]

analyze-memory.ts

  • --risk, -r: Risk level (low, medium, high) [default: low]
  • --country, -c: Country for analysis (e.g., india) [default: global]

Output Files

The tool generates several JSON files:

  • stock-report.json: Detailed analysis of top stocks
  • stock-summary.json: Summary of analysis including confidence scores
  • ai-compare-memory.json: Historical comparison data
  • temp_memory.json: Temporary storage for current analysis

Risk Levels

  • 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

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Disclaimer

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.

Risk Warning

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.

About

A stock market analysis tool that aggregates data from Reddit and Google News to identify investment opportunities. Features risk-level based analysis, support for Indian/global markets, and sentiment analysis from multiple sources. Built with TypeScript and Node.js.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors