Skip to content

SaadxSalman/Fin-Agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Fin-Agent πŸ’°πŸ“ˆ

A multi-agent system that autonomously monitors financial markets, reads news articles, and analyzes sentiment to make predictions and generate reports. Fin-Agent acts as a personal financial advisor, with a strong focus on risk management and data-driven insights.


✨ Features

  • Autonomous Market Monitoring: The Data Retrieval Agent autonomously pulls and processes real-time financial market data and news.
  • Sentiment and News Analysis: The Sentiment Analysis Agent reads news articles and social media to gauge market sentiment, providing a crucial leading indicator.
  • Predictive Modeling: The Modeling Agent runs complex simulations and analyzes historical data to generate predictions and identify potential risks.
  • Comprehensive Reporting: The Reporting Agent synthesizes all findings into clear and concise reports, making complex financial data accessible to the user.
  • Chart and Graph Interpretation: Utilizes a vision model to interpret charts and graphs directly from financial reports, adding a powerful layer of visual data analysis.
  • Specialized Knowledge: Employs a specialized embedding model fine-tuned on financial news and SEC filings for highly accurate and contextually relevant analysis.

πŸ› οΈ Tech Stack

1. Frontend (The Command Center)

  • Framework: Next.js 14+ (App Router) for Server-Side Rendering (SSR) and optimized performance.
  • Styling: Tailwind CSS for a high-density, "Bloomberg-style" dark UI.
  • State Management & Data Fetching: TanStack Query (React Query) for managing server state and caching.
  • Icons & UI: Lucide React for financial icons and Framer Motion for smooth agent-status transitions.

2. Communication (The Bridge)

  • Protocol: tRPC for end-to-end typesafe API calls. This allows your Frontend to "know" exactly what data the Backend agents return without manually defining types twice.
  • Validation: Zod for strict schema validation of ticker symbols and market data inputs.

3. Backend (The Orchestrator)

  • Runtime: Node.js with Express to manage the tRPC server and coordinate Python agent execution.
  • Database (General): MongoDB (via Mongoose) to store user profiles, saved reports, and watchlists.
  • Agent Bridge: child_process and spawn modules to execute Python scripts and stream real-time logs from the AI agents.

4. AI & Multi-Agent Logic (The Brains)

  • Languages: Python 3.10+ for the heavy-duty data science and LLM logic.
  • Orchestration: LangChain or a custom Agent class to manage the flow between retrieval and reporting.
  • Models:
  • Reasoning: gpt-4o for synthesizing complex financial reports.
  • Vision: gpt-4o-vision for interpreting candlestick charts and technical indicator graphs.
  • Embeddings: text-embedding-3-small for specialized financial news processing.

5. Specialized Data Storage

  • Vector Database: Qdrant (Running in Docker) for high-speed retrieval of SEC filings and historical news using RAG (Retrieval-Augmented Generation).
  • Time-Series Database: QuestDB or TimescaleDB for storing millions of real-time price ticks with sub-millisecond query times.

6. DevOps & Infrastructure

  • Containerization: Docker and Docker Compose to standardize the environment (Qdrant, Mongo, and the Python environment).
  • CI/CD: GitHub Actions for automated pytest and TypeScript build checks.
  • Testing: Pytest for Python agents and Jest for frontend components.

πŸ“Š Stack Interoperability Summary

Layer Technology Key Benefit
Type Safety TypeScript + tRPC Prevents runtime crashes between Frontend and Backend.
Intelligence OpenAI GPT-4o Allows the "Reporting Agent" to sound like a human analyst.
Memory Qdrant Allows agents to remember news from 2 years ago instantly.
Real-time Custom Time-Series DB Handles the high-frequency nature of market price updates.

πŸš€ Getting Started

Prerequisites

  • Node.js (for Next.js)
  • Python 3.10+ (for backend services and models)
  • Docker (for the time-series database and Qdrant)

Installation

  1. Clone the repository:
    git clone https://github.com/saadsalmanakram/Fin-Agent.git
    cd Fin-Agent
  2. Start Docker containers:
    docker-compose up -d
  3. Set up the frontend and backend: Follow the instructions in the frontend/ and backend/ directories to install dependencies and configure the services.

Configuration

Create a .env file to store your API keys for financial data providers and other necessary environment variables.

Usage

Run the Next.js server and the backend agent services to begin autonomous market monitoring and reporting.


To pull everything together for saadsalmanakram/Fin-Agent, here is the final, comprehensive directory structure. This includes the multi-agent Python scripts, the tRPC-powered backend, the Next.js frontend, and the automated CI/CD configurations.

πŸ“‚ Project Structure

Fin-Agent/
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── ci.yml                # GitHub Actions pipeline
β”œβ”€β”€ docker-compose.yml            # Qdrant, MongoDB, & Time-Series DB
β”œβ”€β”€ .env                          # API Keys (OpenAI, Qdrant, etc.)
β”œβ”€β”€ .gitignore
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ agents/               # Python Multi-Agent Logic
β”‚   β”‚   β”‚   β”œβ”€β”€ data_retrieval.py
β”‚   β”‚   β”‚   β”œβ”€β”€ sentiment_analysis.py
β”‚   β”‚   β”‚   β”œβ”€β”€ vector_storage.py # Qdrant / RAG logic
β”‚   β”‚   β”‚   β”œβ”€β”€ modeling_agent.py # Prediction logic
β”‚   β”‚   β”‚   β”œβ”€β”€ reporting.py      # Markdown synthesis
β”‚   β”‚   β”‚   └── tests/            # Pytest suite for CI
β”‚   β”‚   β”œβ”€β”€ routers/              # tRPC Router definitions
β”‚   β”‚   β”‚   β”œβ”€β”€ index.ts          # Root router
β”‚   β”‚   β”‚   β”œβ”€β”€ sentiment.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ memory.ts
β”‚   β”‚   β”‚   └── orchestrator.ts   # Master agent coordinator
β”‚   β”‚   β”œβ”€β”€ models/               # MongoDB Schemas
β”‚   β”‚   β”œβ”€β”€ trpc.ts               # tRPC initialization
β”‚   β”‚   └── index.ts              # Express server entry
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ tsconfig.json
β”‚   └── requirements.txt          # Python deps (pandas, openai, etc.)
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/                  # Next.js App Router
β”‚   β”‚   β”‚   β”œβ”€β”€ layout.tsx
β”‚   β”‚   β”‚   └── page.tsx          # Main Dashboard UI
β”‚   β”‚   β”œβ”€β”€ components/           # UI Components
β”‚   β”‚   β”‚   β”œβ”€β”€ RiskGauge.tsx     
β”‚   β”‚   β”‚   β”œβ”€β”€ SentimentCard.tsx
β”‚   β”‚   β”‚   └── ReportMarkdown.tsx
β”‚   β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”‚   └── trpc.ts           # tRPC Client & Hooks
β”‚   β”‚   └── styles/
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ tailwind.config.js
β”‚   └── tsconfig.json
└── data/                         # Local volume for DB persistence


About

Agentic Financial Analyst (Fin-Agent) πŸ’°πŸ“ˆ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published