Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OMEGA — Real-Time Market Sentiment Intelligence

A full-stack platform combining NLP sentiment analysis, technical price prediction, and LLM-powered summarisation to give investors an information edge over raw news feeds.

Home Dashboard


What it does

OMEGA aggregates news articles for publicly traded companies, scores them across three sentiment axes (subjectivity, optimism, enthusiasm), generates LLM summaries, and surfaces everything alongside live price data and technical analysis signals — all in a single, real-time dashboard.


Technical highlights

Sentiment analysis pipeline

  • Benchmarked five models (GPT-3.5, Llama2, Llama2-uncensored, Phi, Gemma) against a hand-labeled dataset of 30 articles using Spearman's rank correlation
  • Selected Llama2-uncensored (ρ = 0.63) over GPT-3.5 for its open-source reproducibility and strong off-the-shelf alignment with human raters
  • Characterized output variance per category across 100 repeated runs to quantify reliability before shipping

Price prediction

  • Hybrid algorithm combining RSI, Parabolic SAR, and Fibonacci retracement levels (TA-Lib) to generate a directional confidence score (−4 → +4)
  • Conservative signal design: returns 0 (uncertainty) in ~77% of cases; when confident, directional accuracy reached 100% across 7 live signals on AAPL
  • Linear regression baseline (sklearn) achieving ~78% next-day accuracy using OHLCV features — with documented limitations around trend-following regimes

LLM summarisation

  • LangChain refine chain for long-form document summarisation — handles articles exceeding model context windows by iterative chunk processing
  • Temperature tuned to 0.2 to minimise hallucinations while preserving factual fidelity

Article caching architecture

  • Articles scraped via BeautifulSoup at ingest time, not on request — eliminates per-request scraping latency
  • Sentiment scores and summaries persisted to the database post-generation, so LLM inference runs once per article, not once per page load
  • Average article download time: 0.12s; full 10-company, 6-article-each refresh under 7s worst case

Authentication

  • AbstractBaseUser with email as the unique identifier (overrides Django's default username model)
  • JWT via simplejwt + React Context API with a checkLoginStatus server-round-trip to prevent client-side session spoofing

Stack

Layer Tech
Backend Django 4.2 · Django REST Framework · simplejwt · gunicorn
Frontend React 18 · Vite · MUI v5 · Recharts
Sentiment Llama2-uncensored (Ollama) · VADER fallback
Summarisation LangChain refine chain
Price data yfinance · TA-Lib · sklearn
Auth JWT · Django AbstractBaseUser

Prerequisites

  • Python 3.10+
  • Node.js 18+
  • Ollama with llama2-uncensored pulled (for AI features)

Quick start

# 1. Backend
cd backend
python3 -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
python manage.py migrate
python manage.py runserver 8000

# 2. Frontend (new terminal)
cd frontend
npm install
npm run dev                      # → http://localhost:5173

The frontend proxies all /api/* requests to Django on port 8000.


API reference

Method Endpoint Description
GET /api/companies/ All tracked companies with live prices
GET /api/companies/<symbol>/ Detail + news + sentiment scores
GET /api/companies/<symbol>/news/ Articles with per-article sentiment
GET /api/companies/<symbol>/history/?period=1mo OHLCV price history
GET /api/search/?q=<query> Company search
POST /api/auth/register/ Create account
POST /api/auth/login/ JWT login → access + refresh tokens
POST /api/sentiment/ Trigger sentiment analysis on article
POST /api/summary/ Trigger LLM summarisation on article

Environment variables

Variable Description
DJANGO_SECRET_KEY Django secret key
DJANGO_DEBUG True for local dev, False in production
DJANGO_ALLOWED_HOSTS Comma-separated allowed hosts
CORS_ALLOWED_ORIGINS Comma-separated CORS origins

Tracked companies

AAPL · GOOGL · MSFT · NVDA · TSLA · AMZN · META · NFLX · JPM · BRK-B · DIS · PYPL


Architecture & scalability notes

The system is structured as six decoupled Django apps (companies, users, articles, notifications, recommendations, auth), each with their own URL routing and views. This mirrors a microservices separation of concerns while remaining deployable as a monolith.

Rate limiting from Yahoo Finance (2,000 req/hr) is handled by spreading data refresh calls over time as background tasks. Transitioning to a distributed architecture (multiple Django workers + a dedicated data broker API) is a natural next step and is architecturally straightforward given the modular design.

The recommendation engine uses collaborative filtering: suggest companies followed by users with overlapping portfolios, with a sector-similarity fallback and a curated default list for cold-start users.


Testing

All backend functions have unit and integration test coverage. AI-generated outputs (getSentiment, summarizeText) were manually validated given their non-deterministic nature. The full test suite passes with 12/12 functions verified.


Deployment

Backend → Railway: set the four env vars above and point Railway at backend/. The railway.toml and Procfile are pre-configured.

Frontend → Vercel: set VITE_API_URL to your backend URL. The vercel.json SPA rewrites are already in place.

About

software engineering project tool

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages