Skip to content

About

A financial intelligence system that monitors real-time news streams to detect market sentiment

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

🧠 Jimmy-AI Sentiment Analyzer

A financial intelligence system that monitors real-time news streams to detect market sentiment (Bullish 🚀 vs. Bearish 📉) before it reflects in stock prices. Jimmy combines the concurrency and stability of Java with the NLP capabilities of Python through a polyglot microservices architecture.


Architecture

┌─────────────────────┐      POST /analyze       ┌─────────────────────┐
│   THE MUSCLE        │ ──────────────────────▶   │   THE BRAIN         │
│   Java 17 Collector │ ◀──────────────────────   │   Python Analyzer   │
│   Spring Boot       │      sentiment result     │   FastAPI + VADER   │
│   ROME + Async      │                           │   + FinBERT toggle  │
└────────┬────────────┘                           └─────────────────────┘
         │
    ┌────▼────┐     SSE /stream      ┌──────────────────────┐
    │ Postgres│                      │   DASHBOARD          │
    │   DB    │                      │   Real-Time Web UI   │
    └─────────┘                      │   Chart.js + SSE     │
         ▲                           └──────────────────────┘
         │           persist              │
         └────────────────────────────────┘

The Muscle: Data Ingestion Service 💪

Technology: Java 17, Spring Boot, ROME, CompletableFuture, Spring Data JPA

The backbone of the system, handling high-throughput data collection with:

  • Multithreading: Uses CompletableFuture to scrape multiple RSS feeds (CoinDesk, Yahoo Finance, TechCrunch) in parallel without blocking the main thread
  • Resilience: Implements scheduled tasks (@Scheduled, 10s interval) and per-feed error handling to ensure continuous uptime
  • Persistence: Saves every sentiment result to PostgreSQL via Spring Data JPA
  • SSE Broadcasting: Streams live results to connected dashboard clients via Server-Sent Events

The Brain: NLP Analysis Service 🧠

Technology: Python, FastAPI, VADER Sentiment, NLTK, FinBERT (optional)

The intelligence layer that processes and analyzes financial content:

  • VADER: Default sentiment engine — lightweight, fast, tuned for social media and financial contexts
  • FinBERT: Optional transformer-based model (?model=finbert) for higher accuracy financial sentiment analysis using ProsusAI/finbert
  • Performance: Exposes a lightweight REST API optimized for fast inference times

Sentiment Classification

Compound Score Sentiment Emoji
>= 0.15 Bullish 🚀
<= -0.15 Bearish 📉
Between Neutral ⚖️

Real-Time Dashboard 📊

Technology: HTML, CSS, JavaScript, Chart.js, Server-Sent Events

  • Live Feed: Sentiment cards appear in real-time as articles are analyzed
  • Trend Chart: Doughnut chart showing Bullish / Bearish / Neutral distribution
  • History Table: Last 50 analyzed articles pulled from PostgreSQL
  • Design: Dark-mode glassmorphism UI with smooth animations

Key Features

  • Real-Time Monitoring: Scans financial news sources every 10 seconds
  • Semantic Analysis: Detects nuance (e.g., distinguishing between "Market crash" 🔴 and "Buying the dip" 🟢)
  • Persistent Storage: PostgreSQL database for historical trend analysis
  • Live Dashboard: SSE-powered real-time visualization of sentiment shifts
  • Dual NLP Models: VADER (default, fast) + FinBERT (opt-in, accurate)
  • Microservices Orchestration: Fully Dockerized with 4 services
  • Event-Driven Communication: HTTP REST + SSE between services

Tech Stack

Component Technology
Collector Java 17, Spring Boot 3, ROME, CompletableFuture
Analyzer Python 3.11, FastAPI, VADER, FinBERT
Database PostgreSQL 16
Dashboard HTML/CSS/JS, Chart.js, SSE
Orchestration Docker, Docker Compose

Project Structure

Jimmy-AI-Sentiment-Analyzer/
├── collector/                 # Java Spring Boot service
│   ├── src/main/java/...
│   ├── src/main/resources/
│   │   └── application.yml
│   ├── Dockerfile
│   └── pom.xml
├── analyzer/                  # Python FastAPI service
│   ├── main.py
│   ├── finbert_analyzer.py
│   ├── requirements.txt
│   └── Dockerfile
├── dashboard/                 # Real-time web UI
│   ├── index.html
│   ├── styles.css
│   └── app.js
├── docker-compose.yml
└── README.md

Quick Start

Prerequisites

  • Docker & Docker Compose

Run

docker-compose up --build
Service URL
Dashboard http://localhost:3000
Collector http://localhost:8080
Analyzer http://localhost:8000
Postgres localhost:5432

Test the Analyzer Directly

curl -X POST http://localhost:8000/analyze \
  -H "Content-Type: application/json" \
  -d '{"title": "Bitcoin Hits All-Time High", "text": "Crypto markets surge as institutional investors pile in"}'

Enable FinBERT

curl -X POST "http://localhost:8000/analyze?model=finbert" \
  -H "Content-Type: application/json" \
  -d '{"title": "Fed Signals Rate Hike", "text": "Markets tumble on hawkish Fed commentary"}'

Docker Services

Service Image Port Depends On
db PostgreSQL 16 5432 —
analyzer Python 3.11 8000 —
collector Java 17 8080 db, analyzer
dashboard nginx 3000 collector

API Reference

Analyzer

POST /analyze

Analyze text for financial sentiment.

Request:

{
  "title": "Market Rally Continues",
  "text": "Stocks posted their best weekly gains in months"
}

Response:

{
  "title": "Market Rally Continues",
  "sentiment": "Bullish",
  "score": 0.6249,
  "emoji": "🚀"
}

GET /health

Health check endpoint.

Collector

GET /stream

SSE endpoint — streams live sentiment results.

GET /api/history

Returns last 50 sentiment records from the database.


Roadmap

  • Java RSS collector with CompletableFuture concurrency
  • Python VADER sentiment analyzer
  • PostgreSQL persistence
  • SSE real-time dashboard
  • FinBERT transformer toggle
  • Kafka/RabbitMQ event streaming (future)
  • Multi-language sentiment support (future)
  • Alerting system for extreme sentiment shifts (future)

About

A financial intelligence system that monitors real-time news streams to detect market sentiment

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors