Skip to content

Latest commit

Β 

History

48 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Stonklytics

A modern stock market analytics platform with AI-powered insights, real-time data, and portfolio tracking.

Stonklytics Python React Django

Features

πŸ“Š Stock Analytics

  • Real-time stock data from Polygon.io API
  • Historical price charts with multiple views (Line, Area, Volume)
  • OHLC data (Open, High, Low, Close)
  • Market cap & volume statistics
  • Company search with autocomplete

πŸ€– AI-Powered Insights

  • AI Chat Assistant - Ask questions about stocks, markets, and investing (powered by Gemini)
  • AI Stock Summaries - Get instant AI-generated analysis for any stock
  • AI Market News - Daily market news generated by AI (no API rate limits!)

πŸ“ˆ Portfolio Management

  • Multiple Watchlists - Create and manage watchlists
  • Track stocks - Add/remove stocks from watchlists
  • Real-time prices - View current prices for watchlist items

πŸ“° News & Fundamentals

  • Stock News - Latest news articles from Polygon.io
  • Cash Flow Statements - Quarterly financial data
  • Income Statements (Coming Soon)
  • Balance Sheets (Coming Soon)

🎨 Modern UI

  • Clean, matte dark theme
  • Responsive design
  • Inter & JetBrains Mono fonts
  • Smooth animations

Tech Stack

Layer Technology
Frontend React 18, Vite, Tailwind CSS
Backend Django 4, Django REST Framework
Database SQLite (dev), PostgreSQL (prod)
Authentication Firebase Auth (Email/Password)
Stock Data Polygon.io API
AI Google Gemini 2.5 Flash

Prerequisites

  • Python 3.10+
  • Node.js 18+ & npm
  • Git

Project Structure

stonklytics/
β”œβ”€β”€ backend/                 # Django API
β”‚   β”œβ”€β”€ api/                 # Auth, Chat, Watchlist, Summary endpoints
β”‚   β”œβ”€β”€ stock/               # Stock data, News, Financials endpoints
β”‚   β”œβ”€β”€ backend/             # Django settings
β”‚   β”œβ”€β”€ .env                 # Environment variables (create this)
β”‚   β”œβ”€β”€ manage.py
β”‚   └── requirements.txt
β”œβ”€β”€ frontend/                # React + Vite
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/      # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/           # Page components
β”‚   β”‚   β”œβ”€β”€ api.js           # API client
β”‚   β”‚   β”œβ”€β”€ firebase.ts      # Firebase config
β”‚   β”‚   └── index.css        # Global styles
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.js
└── README.md

Quick Start

1. Clone the Repository

git clone https://github.com/yuktakul04/stonklytics.git
cd stonklytics

2. Backend Setup

cd backend

# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate

# Install dependencies
pip install -U pip
pip install -r requirements.txt

# Create .env file
touch .env

Add the following to backend/.env:

POLYGON_API_KEY=your_polygon_api_key
GEMINI_API_KEY=your_gemini_api_key

Run migrations and start the server:

python manage.py migrate
python manage.py runserver

Backend runs at: http://127.0.0.1:8000

3. Frontend Setup

Open a new terminal:

cd frontend
npm install
npm run dev

Frontend runs at: http://localhost:5173


Environment Variables

Backend (backend/.env)

Variable Description Required
POLYGON_API_KEY API key from Polygon.io Yes
GEMINI_API_KEY API key from Google AI Studio Yes

Frontend (frontend/src/firebase.ts)

Configure your Firebase project credentials:

const firebaseConfig = {
  apiKey: "your-api-key",
  authDomain: "your-project.firebaseapp.com",
  projectId: "your-project",
  storageBucket: "your-project.appspot.com",
  messagingSenderId: "your-sender-id",
  appId: "your-app-id"
};

API Endpoints

Authentication

Method Endpoint Description
POST /api/signup Create new user
POST /api/login User login
GET /api/profile Get user profile

Stock Data

Method Endpoint Description
GET /api/stock/data/?ticker=AAPL Get stock data
GET /api/stock/data/historical/?ticker=AAPL&from=2024-01-01&to=2024-12-01 Historical prices
GET /api/stock/search/?q=apple Search companies
GET /api/stock/news/?ticker=AAPL&limit=5 Stock news
GET /api/stock/financials/?ticker=AAPL Financial statements

AI Features

Method Endpoint Description
POST /api/chat AI chat assistant
GET /api/summary/{symbol} AI stock summary
GET /api/market-news AI-generated market news

Watchlist

Method Endpoint Description
GET /api/watchlist Get all watchlists
POST /api/watchlist/create Create watchlist
POST /api/watchlist/add Add stock to watchlist
DELETE /api/watchlist/remove/{ticker} Remove stock
DELETE /api/watchlist/delete/{id} Delete watchlist

Firebase Setup

  1. Go to Firebase Console
  2. Create a new project or select existing
  3. Enable Authentication β†’ Sign-in method β†’ Email/Password
  4. Go to Project Settings β†’ General β†’ Your apps β†’ Web app
  5. Copy the config to frontend/src/firebase.ts

Development

Running Both Servers

Terminal 1 - Backend:

cd backend
source .venv/bin/activate
python manage.py runserver

Terminal 2 - Frontend:

cd frontend
npm run dev

Building for Production

cd frontend
npm run build

The build output will be in frontend/dist/.


Troubleshooting

CORS Issues

Ensure django-cors-headers is configured in backend/backend/settings.py:

CORS_ALLOWED_ORIGINS = [
    "http://localhost:5173",
    "http://127.0.0.1:5173",
]

Firebase "api-key-not-valid"

  • Verify Firebase config in firebase.ts
  • Check API key restrictions in Google Cloud Console
  • Add allowed referrers: http://localhost:5173/*

Polygon API Rate Limits

  • Free tier: 5 API calls/minute
  • The app caches stock data for 1 hour to reduce API calls
  • AI Market News uses Gemini instead of Polygon to save API calls

Clean Install

# Frontend
cd frontend
rm -rf node_modules
npm install

# Backend
cd backend
rm -rf .venv
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Git Workflow

# Create feature branch
git checkout -b feat/your-feature

# Make changes and commit
git add .
git commit -m "feat: description of changes"

# Push and create PR
git push -u origin feat/your-feature

Team

Software Engineering Fall 2025


License

This project is for educational purposes.

About

A web app that collects, analyzes, and summarizes market research to help make smarter trading decisions for any stock.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages