Skip to content

Personal project, Generative AI, Python, FastAPI, React, Docker/Docker Compose

License

Notifications You must be signed in to change notification settings

dantodor/stockchat

 
 

Repository files navigation

StockChat: DSPy-powered Stock Analysis Agent (OpenAI, DeepSeek, Gemini, GitHub)

X URL

An open-source alternative to Perplexity Finance.

screen_recording.mov

StockChat offers a real-time chat interface integrated with AI-powered stock analysis capabilities. Built for developers looking to implement financial NLP solutions.

πŸ“š Table of Contents

πŸš€ Quick Start (Docker)

# Set up environment variables
cp .env.example .env
# Edit .env with your API keys (OPENAI_API_KEY or DEEPSEEK_API_KEY or GEMINI_API_KEY or GITHUB_TOKEN required)

docker-compose up --build

And the app will be running on http://localhost:5173.

✨ Key Components

  • 🧠 DSPy Integration - Built-in financial analysis pipelines
  • πŸ“ˆ Trading Signals - Real-time visualization of technical indicators
  • πŸ“Š Market Data Processing - Extensible data ingestion framework
  • πŸ” Research Cache - SQLite-based analysis result storage
  • 🌐 Data Saving - Users can save their analysis through a specific URL endpoint
  • 🧠 TA-Lib Integration - Professional technical analysis calculations

πŸ› οΈ Local Development Setup

First, install TA-Lib to your computer according to TA-Lib Python Install Guide.

Backend Service

cd stockchat-backend
python -m venv venv
source venv/bin/activate  # Unix/MacOS
# .\venv\Scripts\activate  # Windows

# Set up environment variables
cp .env.example .env
# Edit .env with your API keys (either one required):
# OPENAI_API_KEY=your_openai_api_key
# DEEPSEEK_API_KEY=your_deepseek_api_key
# GEMINI_API_KEY=your_gemini_api_key
# GITHUB_TOKEN=your_github_token

pip install -r requirements.txt
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

Frontend Application

cd stockchat-frontend
npm install
npm run dev

And the app will be running on http://localhost:5173.

🧩 System Architecture

System Architecture

πŸ“¦ Technical Stack

Category Technologies
Frontend React, TypeScript, TailwindCSS, Vite
Backend FastAPI, Python, DSPy, TA-Lib
Database SQLite
Deployment Docker, Docker Compose
AI Integration Custom DSPy pipelines for financial analysis

🎯 Component Structure

src/
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ui/          # Shadcn UI components
β”‚   β”œβ”€β”€ Header.tsx   # App header with theme toggle
β”‚   β”œβ”€β”€ LandingPage.tsx  # Welcome screen with examples
β”‚   β”œβ”€β”€ LoadingPage.tsx  # Loading state display
β”‚   β”œβ”€β”€ MessageInput.tsx # Chat input component
β”‚   β”œβ”€β”€ MetricCard.tsx   # Financial metrics display
β”‚   β”œβ”€β”€ ResultPage.tsx   # Analysis results view
β”‚   β”œβ”€β”€ ShareButton.tsx  # Share functionality
β”‚   β”œβ”€β”€ StockChart.tsx   # Interactive stock chart
β”‚   β”œβ”€β”€ StockHeader.tsx  # Stock price header
β”‚   └── TradingSignal.tsx # Trading indicators
β”œβ”€β”€ util/
β”‚   β”œβ”€β”€ api.ts      # API client
β”‚   β”œβ”€β”€ theme.ts    # Theme management
β”‚   └── utils.ts    # Utility functions
└── App.tsx         # Main application

πŸ“„ License

MIT Licensed - See LICENSE for details.

About

Personal project, Generative AI, Python, FastAPI, React, Docker/Docker Compose

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 56.9%
  • Python 37.3%
  • CSS 2.1%
  • Dockerfile 1.7%
  • JavaScript 1.6%
  • HTML 0.4%