๐ Institutional RAG Stock Earnings Analysis Engine
Autonomous Retrieval-Augmented Generation (RAG) system for financial 10-K, 10-Q, and earnings reports.
Transforms 200+ page SEC regulatory filings into hallucination-free, citation-grounded financial intelligence in seconds.
๐ฏ The Problem & The Solution
Analyzing institutional filings is exhausting. An average quarterly SEC 10-Q filing spans 70โ80 pages; comparing three consecutive quarters requires dissecting over 220 dense pages of revenue breakdowns, segment EBIT margins, management discussions, and risk disclosures. For an active portfolio of 10 equities, this exceeds 100+ hours of manual document ingestion.
This RAG engine automates the entire ingestion, vector indexing, and comparative quantitative reasoning pipeline:
- Zero Hallucinations: Every generated metric and insight is hard-grounded with exact document page citations (e.g.,
[Q3 10-Q, Page 14]).
- Vector Search Acceleration: Semantic indexing powered by Pinecone vector database.
- Multi-Asset Coverage: Supports equities (SEC 10-K/10-Q), macro commodities (OPEC / LBMA reports), and real estate (REIT filings).
๐๏ธ Architecture & Pipeline
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ DOCUMENT INGESTION โ
โ Google Drive / SEC EDGAR PDF Ingestion via Google Sheets โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ TEXT CHUNKING & EMBEDDING โ
โ Recursive Text Splitter โ High-Dimensional Vectorization โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ PINECONE VECTOR DATABASE โ
โ Namespace: `company-earnings` โข Cosine Similarity Index โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ RAG RETRIEVAL & SYNTHESIS AGENT โ
โ Gemini Pro / LangChain Orchestrator with Source Citations โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ EXECUTIVE FINANCIAL DOSSIER OUTPUT โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Setup & Configuration
Prerequisites
- n8n (Self-hosted Docker or n8n Cloud)
- Pinecone Account (Free tier supported)
- Google AI Studio / Vertex AI API Key
- Google Drive & Sheets OAuth2 Credentials
Configuration Steps
Pinecone Index Setup:
- Create an index named
company-earnings.
- Select your vector dimension matching the embedding model (e.g., 768 or 1536).
- Acquire your Pinecone API Key from the console.
Document Repository Setup:
- Create a Google Sheet with a
File URL column containing links to your target PDF reports in Google Drive.
- Configure the List Of Files To Load node in n8n to target this sheet.
Credential Mapping:
- Set up
Google Sheets OAuth2, Google Drive OAuth2, and Google Docs OAuth2 connections in n8n.
- Attach your
Google Gemini API and Pinecone API credentials.
Execute & Inquire:
- Trigger the workflow to chunk and embed target filings.
- Query the agent (e.g., "Compare Google Cloud's operating margin expansion between Q2 and Q3"), and receive an exact cited synthesis.
๐จโ๐ป Author
xCodeWraith
GitHub: @xCodeWraith
X (Twitter): @DEV
๐ License
This project is open-source under the MIT License.