{"id":33345701,"url":"https://github.com/neelagarwal98/modular-equity-research-system","last_synced_at":"2026-04-06T21:31:50.423Z","repository":{"id":325368557,"uuid":"1100913222","full_name":"neelagarwal98/modular-equity-research-system","owner":"neelagarwal98","description":"A prototype application that automates financial equity research using a coordinated multi-module architecture. It combines the power of OpenAI's GPT-3.5-turbo, Serper API for Google search and RAG (Retrieval-Augmented Generation) to deliver accurate, well-sourced financial analysis reports with confidence scoring.","archived":false,"fork":false,"pushed_at":"2025-11-21T10:32:56.000Z","size":1057,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-21T11:22:03.656Z","etag":null,"topics":["equity","google-serp-api","langchain","llm","openapi","rag","streamlit"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neelagarwal98.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-20T23:46:45.000Z","updated_at":"2025-11-21T10:32:59.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/neelagarwal98/modular-equity-research-system","commit_stats":null,"previous_names":["neelagarwal98/modular-equity-research-tool","neelagarwal98/modular-equity-research-system"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/neelagarwal98/modular-equity-research-system","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neelagarwal98%2Fmodular-equity-research-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neelagarwal98%2Fmodular-equity-research-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neelagarwal98%2Fmodular-equity-research-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neelagarwal98%2Fmodular-equity-research-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neelagarwal98","download_url":"https://codeload.github.com/neelagarwal98/modular-equity-research-system/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neelagarwal98%2Fmodular-equity-research-system/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31491096,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-06T17:22:55.647Z","status":"ssl_error","status_checked_at":"2026-04-06T17:22:54.741Z","response_time":112,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["equity","google-serp-api","langchain","llm","openapi","rag","streamlit"],"created_at":"2025-11-22T05:00:23.086Z","updated_at":"2026-04-06T21:31:50.397Z","avatar_url":"https://github.com/neelagarwal98.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📊 Modular Equity Research System\n\n\u003e An AI-powered equity research platform that leverages specialized LLM modules and real-time data to generate comprehensive financial analysis reports.\n\n[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)\n[![Streamlit](https://img.shields.io/badge/streamlit-1.39.0-FF4B4B.svg)](https://streamlit.io)\n[![LangChain](https://img.shields.io/badge/langchain-0.3.7-green.svg)](https://langchain.com)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n---\n\n## 🎯 Overview\n\nThe **Modular Equity Research System** is a prototype application that automates financial equity research using a coordinated multi-module architecture. It combines the power of OpenAI's GPT-3.5-turbo, SERPER API for google search, and RAG (Retrieval-Augmented Generation) to deliver accurate, well-sourced financial analysis reports with confidence scoring.\n\n### Key Features\n\n- **🔍 Intelligent Query Analysis**: Automatically extracts company information, research intent, and relevant topics from natural language queries\n- **🌐 Dynamic Source Discovery**: Uses SERPER API to find the most relevant, up-to-date financial articles and reports\n- **✅ Automated Validation**: Evaluates source credibility and calculates confidence scores for research findings\n- **📝 RAG-Powered Synthesis**: Generates comprehensive reports using vector-based semantic search and LLM synthesis\n- **📊 Real-time Activity Logging**: Transparent pipeline execution with detailed activity tracking\n\n![screencapture.png](images/screencapture.png)\n\n## 🏗️ Architecture\n\n### System Design\n\nThe system follows a **modular pipeline architecture** where specialized components work in coordination to process research queries:\n\n![workflow.jpg](images/workflow.jpg)\n\n### Technology Stack\n\n#### **Core Framework**\n- **Streamlit** (1.39.0) - Web application framework\n- **Python** (3.11+) - Primary programming language\n\n#### **LLM \u0026 AI**\n- **LangChain** (0.3.7) - LLM application framework\n- **LangChain-OpenAI** (0.2.9) - OpenAI integration\n- **OpenAI GPT-3.5-turbo** - Language model for analysis and synthesis\n\n#### **Vector Store \u0026 Embeddings**\n- **FAISS** (1.9.0) - Vector similarity search\n- **OpenAI Embeddings** - Text vectorization\n\n#### **Data Sources**\n- **Serper API** - Real-time web search\n- **LangChain Document Loaders** - Web scraping and parsing\n\n#### **Additional Libraries**\n- **BeautifulSoup4** - HTML parsing\n- **python-dotenv** - Environment variable management\n- **Requests** - HTTP client\n\n---\n\n## 📁 Project Structure\n\n```\nmodular-equity-research-system/\n│\n├── modules/                   # Core processing modules\n│   ├── __init__.py\n│   ├── query_analyzer.py      # Query analysis \u0026 structuring\n│   ├── research_module.py     # Source discovery \u0026 loading\n│   ├── validation_module.py   # Source validation \u0026 scoring\n│   └── synthesis_module.py    # Report generation (RAG)\n│\n├── utils/                     # Utility functions\n│   ├── __init__.py\n│   ├── embeddings.py          # Vector store management\n│   └── logger.py              # Activity logging\n│\n├── config.py                  # Configuration settings\n├── app.py                     # Streamlit web application\n├── requirements.txt           # Python dependencies\n├── .env                       # Environment variables (gitignored)\n├── .gitignore                 # Git ignore rules\n└── README.md                  # This file\n```\n\n### Module Descriptions\n\n#### **1. Query Analyzer** (`query_analyzer.py`)\nProcesses natural language queries to extract structured information:\n- Company name and stock ticker\n- Research intent (earnings, valuation, competition, etc.)\n- Key topics to investigate\n- Time frame of interest\n- Generated search queries for discovery\n\n**Input**: Natural language query  \n**Output**: Structured JSON with company info and search strategies\n\n---\n\n#### **2. Research Module** (`research_module.py`)\nDiscovers and loads relevant financial content:\n- Uses SERPER API for dynamic source discovery\n- Filters for trusted financial domains (Reuters, Bloomberg, CNBC, etc.)\n- Loads and processes document content\n- Falls back to curated sources if API unavailable\n\n**Input**: Query analysis with search queries  \n**Output**: List of Document objects with source URLs and content\n\n---\n\n#### **3. Validation Module** (`validation_module.py`)\nEvaluates source quality and calculates confidence:\n- Assigns credibility scores (0-100) to each source\n- Checks against trusted financial domain list\n- Calculates weighted overall confidence score\n- Generates validation notes and quality indicators\n\n**Input**: Document list  \n**Output**: Validation report with scores and trust indicators\n\n---\n\n#### **4. Synthesis Module** (`synthesis_module.py`)\nGenerates comprehensive reports using RAG:\n- Creates FAISS vector store from documents\n- Performs semantic similarity search for relevant context\n- Uses GPT-3.5-turbo to generate structured reports\n- Includes full URL citations in markdown format\n- Extracts and formats source metadata\n\n**Input**: Documents, validation report, query  \n**Output**: Comprehensive research report with citations\n\n---\n\n## 🚀 Getting Started\n\n### Prerequisites\n\n- **Python 3.11+** install on your system\n- **OpenAI API key** (GPT-3.5-turbo access)\n- **Serper API key** (for Google search - 100 free searches/month)\n- **Git** (for cloning the repository)\n\n### Installation\n\n#### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/neelagarwal98/modular-equity-research-system.git\n```\n\n#### 2. Create Virtual Environment\n\n```bash\n# Create virtual environment\npython3 -m venv venv\n\n# Activate virtual environment\n# On macOS/Linux:\nsource venv/bin/activate\n\n# On Windows:\nvenv\\Scripts\\activate\n```\n\n#### 3. Install Dependencies\n\n```bash\npip install --upgrade pip\npip install -r requirements.txt\n```\n\n#### 4. Set Up Environment Variables\n\nCreate a `.env` file in the project root:\n\n```bash\n# Create .env file\ntouch .env\n```\n\nAdd your API keys to `.env`:\n\n```env\nOPENAI_API_KEY=sk-your-openai-api-key-here\nSERPER_API_KEY=your-serper-api-key-here\n```\n\n**Where to get API keys:**\n- **OpenAI**: https://platform.openai.com/api-keys\n- **Serper**: https://serper.dev (100 free searches/month)\n\n---\n\n## 💻 Usage\n\n### Running the Application\n\n```bash\nstreamlit run app.py\n```\n\nThe application will open in your browser at `http://localhost:8501`\n\n### Example Queries\n\nTry these sample queries to test the system:\n\n**Basic Company Analysis:**\n```\nAnalyze Apple's recent financial performance\n```\n\n**Competitive Analysis:**\n```\nCompare Tesla vs Rivian in the EV market\n```\n\n**Earnings Research:**\n```\nWhat were NVIDIA's Q3 2024 earnings results?\n```\n\n**Investment Outlook:**\n```\nIs Microsoft a good investment right now?\n```\n\n**Sector Analysis:**\n```\nHow is the semiconductor industry performing?\n```\n\n### Using the Interface\n\n1. **Enter Query**: Type your research question in the text area\n2. **Select Mode**: \n   - **Autonomous**: AI finds sources automatically (recommended)\n   - **Manual**: Provide your own URLs for analysis\n3. **Start Research**: Click the \"Start Research\" button\n4. **Monitor Progress**: Watch the activity log in the sidebar\n5. **Review Report**: Scroll down to see the generated report with:\n   - Executive summary\n   - Key findings with citations\n   - Detailed analysis\n   - Source list with quality indicators\n   - Validation notes\n\n---\n\n## ⚙️ Configuration\n\n### Key Settings (`config.py`)\n\n```python\n# Model Configuration\nLLM_MODEL = \"gpt-3.5-turbo\"          # LLM model to use\nLLM_TEMPERATURE = 0.3                # Lower for more factual\nMAX_TOKENS = 1000                    # Max tokens per response\n\n# Research Parameters\nMAX_SOURCES = 5                      # Number of sources to analyze\nSERP_SEARCH_LIMIT = 7                # Number of Google searches\nSERP_RESULTS_PER_QUERY = 3           # Results per search\n\n# Confidence Thresholds\nMIN_CONFIDENCE_SCORE = 0.6           # Minimum acceptable confidence\nHIGH_CONFIDENCE_THRESHOLD = 0.8      # High confidence threshold\n```\n\n### Customization Options\n\n**Adjust Source Quality:**\nModify `PRIORITY_DOMAINS` in `config.py` to add/remove trusted sources:\n\n```python\nPRIORITY_DOMAINS = [\n    \"reuters.com\",\n    \"bloomberg.com\",\n    \"wsj.com\",\n    # can add as per trusted priority\n]\n```\n\n**Increase Source Count:**\nFor more comprehensive research:\n\n```python\nMAX_SOURCES = 10  # Analyze more sources\n```\n\n---\n\n## 📊 Output Format\n\n### Research Report Structure\n\n```markdown\n## Research Report\n\n**Company:** NVIDIA Corporation  \n**Ticker:** NVDA  \n**Confidence:** 85.3%  \n**Sources:** 5\n\n### Executive Summary:\n[2-3 sentence overview with key takeaways]\n\n### Key Findings:\n• Finding 1 with data [Source: full-url.com](full-url.com)\n• Finding 2 with metrics [Source: another-url.com](another-url.com)\n• Finding 3 with analysis [Source: third-url.com](third-url.com)\n\n### Detailed Analysis:\n[2-3 paragraphs with in-depth analysis and data]\n\n### Important Considerations:\n• Risk factor 1\n• Limitation 1\n• Market dynamic 1\n\n### Sources:\n1. [reuters.com: nvidia q3 earnings](url) 🟢 High Quality (95/100)\n2. [cnbc.com: nvidia ai demand](url) 🟢 High Quality (90/100)\n\n### Validation Notes:\n✅ 5 source(s) from trusted financial sites\n⭐ 4 high-quality source(s) found\n```\n\n---\n\n## 🎨 Features in Detail\n\n### 1. Real-time Activity Logging\n- Tracks all module operations in sidebar\n- Shows complete research pipeline execution\n- Color-coded status indicators (✅ ⚠️ ❌)\n- Expandable details for debugging\n\n### 2. Source Validation\n- Trusted domain checking\n- Content quality analysis\n- Weighted confidence calculations\n\n### 3. RAG-Powered Synthesis\n- FAISS vector similarity search\n- Semantic context retrieval\n- GPT-3.5-turbo for coherent synthesis\n- Inline URL citations in markdown format\n\n### 4. Confidence Scoring\n- Source-level credibility scores\n- Overall weighted confidence\n- Trust ratio calculations\n- Visual confidence indicators\n\n---\n\n### Areas for Improvement\n\n- [ ] Add support for PDF report export\n- [ ] Implement query caching\n- [ ] Add support for more LLM providers (Anthropic, Cohere)\n- [ ] Enhance source validation with ML models\n- [ ] Add historical data tracking\n- [ ] Implement user authentication\n- [ ] Add support for batch processing\n\n---\n\n## 📄 License\n\nThis project is licensed under the MIT License - Neel Agarwal.\n\n---\n\n## 🙏 Key Acknowledgments\n\n- **LangChain** - For LLM application framework\n- **Streamlit** - For the intuitive web app framework\n- **OpenAI** - For GPT-3.5-turbo API\n- **Serper.dev** - For Google search API access\n- **FAISS** - For efficient vector similarity search\n\n---\n\n## 📞 Contact \u0026 Support\n\n- **Email**: neelagarwal98@gmail.com\n\n---\n\n## 🗺️ Roadmap\n\n### Short-term (v1.1)\n- [ ] PDF export functionality\n- [ ] Enhanced error handling\n- [ ] Query result caching\n- [ ] Improved mobile responsiveness\n\n### Mid-term (v1.2)\n- [ ] Support for multiple LLM providers\n- [ ] Advanced validation with ML\n- [ ] Historical tracking dashboard\n- [ ] Batch processing mode\n\n### Long-term (v2.0)\n- [ ] User authentication system\n- [ ] Collaborative research features\n- [ ] API endpoint for programmatic access\n- [ ] Multi-language support\n\n---\n\n## ⭐ Star History\n\nIf you find this project helpful, please consider giving it a star! ⭐\n\n---\n\n**Built using Python, LangChain, OpenAI GPT 3.5 turbo, SERPER API, FAISS, RAG and Streamlit**\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneelagarwal98%2Fmodular-equity-research-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneelagarwal98%2Fmodular-equity-research-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneelagarwal98%2Fmodular-equity-research-system/lists"}