Hypr is a full-stack application engineered to analyze financial market sentiment by aggregating data from news outlets and social media platforms. It uses a fine-tuned NLP model to generate a "Hype Index" and trading signals, demonstrating a modern, microservices-based approach to building data-intensive applications.
This project was built to explore the challenges of real-time data aggregation, asynchronous task processing, and the practical application of machine learning models in a decoupled system.
- Aggregates Market Data: Pulls in financial news, company fundamentals, and social media posts from sources like Finnhub, Yahoo Finance, Reddit, and Bluesky.
- Analyzes Sentiment: Uses a fine-tuned FinBERT model to understand the sentiment behind the text it finds.
- Streams Analysis Live: Shows its work in real-time using Server-Sent Events (SSE), so you're not stuck looking at a loading spinner.
- Calculates a "Hype Index": A custom score that combines news sentiment, social media buzz, and the model's confidence level into a single, understandable metric.
- Generates Trading Signals: Offers a final BUY, SELL, or HOLD opinion based on its analysis.
- Seach and Discover: You can search any for symbol and company or discover most popular and trending symbols.
- Backend: Python, FastAPI
- Frontend: Next.js, React, TypeScript
- ML: Hugging Face Transformers, PyTorch, FinBERT
- Database: Supabase (PostgreSQL)
- Communication: WebSockets, Server-Sent Events (SSE), REST
- Deployment: Docker, Railway, Hugging Face Spaces
The application is built on a decoupled, microservices architecture to ensure scalability and maintainability. The system is composed of three main services that communicate to deliver real-time analysis.
graph TD
subgraph Client
F[Next.js Frontend]
end
subgraph API Layer
B[FastAPI Backend]
DB[(Supabase DB)]
end
subgraph AI Service
ML[FinBERT Microservice]
end
F -- REST & SSE --> B
F -- WebSocket --> B
B -- REST --> ML
B -- SQL --> DB
This is the client-facing dashboard where users initiate a stock analysis. It uses Server-Sent Events (SSE) to display the analysis progress live to the requesting user and WebSockets to broadcast general market data to all connected clients.
The backend is the central orchestrator. When a user requests an analysis, it executes the following pipeline:
- Fetches financial data from APIs like Finnhub and Yahoo Finance.
- Uses GPT-4 to generate creative, relevant search terms for the company.
- Scours social media platforms for posts using those terms.
- Sends each piece of text to the ML microservice for sentiment analysis.
- Crunches all the numbers to generate the final "Hype Index" and trading signal, then stores the result in a Supabase database.
This is a dedicated, containerized service whose only job is to run the FinBERT model. The backend sends it text, and it returns a sentiment analysis score. Decoupling this computational task keeps the main application fast and responsive.
-
Prerequisites:
- Python 3.9+, Node.js v18.0+, and Docker.
- Create a
.envfile in thebackenddirectory and add your API keys.
-
Start the Services:
- Backend:
cd backend pip install -r requirements.txt python main.py - ML Service:
cd service pip install -r requirements.txt python main.py
- Backend:
-
Start the Frontend:
- Navigate to the
frontenddirectory:npm install && npm run dev - The application will be available at
http://localhost:3000.
- Navigate to the