https://github.com/chankeypathak/rag-stock-assistant
A real-time financial assistant that combines market data, news, and SEC filings using Retrieval-Augmented Generation (RAG). Built with Python, KDB.AI Cloud for vector search, and HuggingFace embeddings. Ideal for research, trading insights, or fintech prototyping.
https://github.com/chankeypathak/rag-stock-assistant
ai cloud financial-analysis genai kdb kdb-q kdbq kx openai python q rag saas
Last synced: 2 months ago
JSON representation
A real-time financial assistant that combines market data, news, and SEC filings using Retrieval-Augmented Generation (RAG). Built with Python, KDB.AI Cloud for vector search, and HuggingFace embeddings. Ideal for research, trading insights, or fintech prototyping.
- Host: GitHub
- URL: https://github.com/chankeypathak/rag-stock-assistant
- Owner: chankeypathak
- License: apache-2.0
- Created: 2025-06-12T17:43:42.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-06-12T19:29:42.000Z (4 months ago)
- Last Synced: 2025-06-12T20:54:46.127Z (4 months ago)
- Topics: ai, cloud, financial-analysis, genai, kdb, kdb-q, kdbq, kx, openai, python, q, rag, saas
- Language: Python
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RAG-Based Stock Assistant
This project is a **Retrieval-Augmented Generation (RAG) stock assistant**, built using:
- **Python CLI** interface
- **KDB.AI Cloud** as the vector store
- **HuggingFace embeddings**
- **Real-time stock data sources**: yFinance, RSS, and SEC EDGAR filingsThis project implements a Retrieval-Augmented Generation (RAG) pipeline tailored for financial use cases. It ingests real-time stock prices (via yFinance), market-moving news (via RSS), and company disclosures (via SEC EDGAR).
The documents are embedded using a HuggingFace transformer and stored in KDB.AI Cloud, a high-performance vector database. Queries from users are embedded, top-k relevant documents are retrieved, and responses are generated via an LLM.
Designed for easy replication with Docker, this assistant can support decision-making for investors, researchers, or algorithmic trading environments.
---
## Use case
| Category | Example Queries |
| ----------------------------------- | ------------------------------------------------------------------------------------------------- |
| **Market Summaries** | *"Summarize today’s financial news."*
*"What happened in the stock market today?"* |
| **Stock-specific News** | *"Any news about Reliance today?"*
*"What's new with TCS stock?"* |
| **Sentiment or Trend Inference** | *"Is the market sentiment bullish today?"*
*"What's the tone of today's financial headlines?"* |
| **Keyword Searches** | *"Find documents mentioning interest rates."*
*"Which news mentions inflation?"* |
| **Sector-based Questions** | *"What's going on in the IT sector?"*
*"Any updates in the banking industry?"* |---
## Process
1. Ingest stock prices, news, and SEC filings.
2. Embed documents using a SentenceTransformer model.
3. Store embeddings in **KDB.AI Cloud**.
4. Accept a user query via CLI.
5. Embed the query and retrieve top-k similar documents.
6. Generate a natural-language answer using an LLM.---
## Components Overview
| Component | Description |
| -------------------- | --------------------------------------------------------- |
| `ingest.py` | Fetch & preprocess news, stock data, filings |
| `embed.py` | Generate embeddings using HuggingFace |
| `query.py` | Query KDB.AI and trigger LLM-based response |
| `docker-compose.yml` | Run CLI + processing modules in containers |
| `KDB.AI` | Vector DB (SaaS) used for storing and querying embeddings |
| `CLI Interface` | User interacts with RAG system via terminal |## TODO
- Add Streamlit UI
- Add alerts for stock anomalies
- Key management in Docker