Skip to content

IbrahimF1/Sussy-Scanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Sussy Scanner ๐Ÿ”

Investor protection through suspicious behavior screening


Demo GIF

๐Ÿ“ฐ Background: The Impact of Market Manipulation

Market manipulation is not a victimless crime. It erodes the foundational trust that financial markets depend on to function efficiently, and its consequences ripple far beyond the trading floor.

๐Ÿ’ฐ Real-World Damage

  • Retail investors lose billions annually to pump-and-dump schemes, where coordinated social media campaigns inflate stock prices before insiders sell off, leaving ordinary investors holding worthless shares. The U.S. Securities and Exchange Commission estimates that microcap fraud alone costs investors $3โ€“5 billion per year.

  • The GameStop saga (January 2021) demonstrated how social media-driven momentum on platforms like Reddit's r/WallStreetBets can create extreme volatility. While some profited, many retail investors who bought at the peak lost over 80% of their investment within weeks.

  • Cryptocurrency pump-and-dump schemes have become rampant, with researchers at the University of Texas finding that 80%+ of ICOs in 2017โ€“2018 showed signs of manipulation, resulting in estimated losses exceeding $1 billion.

  • Confidence erosion: A CFA Institute survey found that 56% of retail investors believe markets are rigged against them, leading to reduced market participation and a widening wealth gap.

๐ŸŽฏ Why Detection Matters

Traditional manipulation detection relies on regulatory bodies with limited resources. By the time enforcement actions are taken, the damage is already done. Real-time, AI-powered screening tools like Sussy Scanner aim to give everyday investors the ability to see the same red flags that institutional risk managers monitor, before they become casualties.

"Sunlight is said to be the best of disinfectants." โ€” Louis Brandeis, U.S. Supreme Court Justice


๐Ÿš€ What Is Sussy Scanner?

Sussy Scanner is a full-stack market manipulation detector that cross-references real-time stock data with social media activity to flag suspicious behavior patterns. Built for the Hack Brooklyn hackathon, it combines multi-source data ingestion, statistical feature engineering, and Google Geminiโ€“powered AI analysis to produce an explainable, composite risk score for any publicly traded stock.

โœจ Key Features

Feature Description
๐Ÿ“Š Multi-Score Risk Engine Five independent sub-scores (Pump Risk, Social Hype, Liquidity Stress, Technical Fragility, Squeeze Pressure) combined into a weighted composite
๐Ÿค– AI-Powered Analysis Google Gemini analyzes social media posts for promotional language, hype signals, and coordinated campaigns
๐Ÿ“ˆ Interactive Charts TradingView lightweight charts for candlestick/line visualization + Recharts for risk signals and narrative breakdowns
๐Ÿ” Similarity Engine Compares current stock behavior against a database of known historical pump events (GME, AMC, DWAC, BBBY, SMCI)
๐Ÿง  Explainable Scoring Every score includes top contributing features and AI-generated natural language narratives
๐Ÿ“ฐ News Cross-Referencing Checks whether price moves are backed by credible news or appear "unexplained"
๐Ÿ’ฌ Social Media Aggregation Aggregates posts from multiple sources (Tavily search, Reddit) with sentiment and hype classification
โฑ๏ธ Smart Caching SQLite-backed caching layer with TTL to avoid redundant API calls and speed up repeat analyses
๐Ÿ—‚๏ธ Preset Historical Events One-click analysis of famous manipulation events (GameStop squeeze, AMC rally, Trump SPAC, etc.)

๐Ÿ—๏ธ Architecture

The following diagram traces the complete data flow from the moment a user enters a stock ticker to the final rendered analysis dashboard:

flowchart TB
    User["๐Ÿ‘ค User"]

    subgraph Frontend ["๐ŸŒ Frontend โ€” React + Vite"]
        direction LR
        FE1["๐Ÿ” Ticker Search"]
        FE2["๐Ÿ“ก API Client<br/>(Axios)"]
        FE3["๐Ÿ“Š Dashboard Grid<br/>Charts + Panels"]
        FE4["๐ŸŽฏ Risk Scores<br/>& Narratives"]
        FE5["๐Ÿ“ˆ TradingView<br/>Candlestick Charts"]
        FE1 -->|"build request"| FE2 -->|"render components"| FE3 -->|"display scores"| FE4
        FE3 -->|"render chart"| FE5
    end

    subgraph Backend ["๐Ÿ–ฅ๏ธ Backend โ€” Express + Node.js"]
        direction LR
        BE1["๐Ÿ”€ API Router<br/>+ SQLite Cache"]
        BE2["๐Ÿ“ˆ Market Data Fetcher<br/>Yahoo Finance ยท Finnhub"]
        BE3["๐Ÿ’ฌ Social Aggregator<br/>Tavily ยท Reddit ยท News"]
        BE4["๐Ÿงฎ Feature Vector Builder<br/>Price ยท Tech ยท Liquidity ยท Social ยท Squeeze"]
        BE5["๐ŸŽฏ Scoring Engine<br/>5 Sub-Scores โ†’ Composite"]
        BE6["๐Ÿค– Gemini Post Analyzer<br/>Hype ยท Sentiment ยท Narratives"]
        BE7["๐Ÿ“ Narrative Generator<br/>Score Explanations"]
        BE8["๐Ÿ”— Similarity Engine<br/>Historical Pump Matching"]

        BE1 -->|"fetch market data"| BE2
        BE2 -->|"fetch social posts"| BE3
        BE3 -->|"compute features"| BE4
        BE4 -->|"generate scores"| BE5
        BE5 -->|"classify posts"| BE6
        BE6 -->|"explain scores"| BE7
        BE7 -->|"match history"| BE8
        BE8 -->|"assembled analysis"| BE1
    end

    subgraph External ["๐ŸŒ External APIs"]
        direction TB
        EX1["Yahoo Finance<br/>Price ยท Volume ยท Stats"]
        EX2["Tavily Search<br/>Social Media Posts"]
        EX3["Reddit<br/>r/wallstreetbets"]
        EX4["Google Gemini<br/>AI Analysis"]
        EX5["Finnhub<br/>Quotes ยท News"]
        EX1 --- EX2 --- EX3 --- EX4 --- EX5
    end

    %% User โ†’ Frontend
    User -->|"enters ticker<br/>e.g. GME"| FE1
    FE3 -.->|"views dashboard"| User

    %% Frontend โ†” Backend
    FE2 -->|"GET /api/analysis/:symbol"| BE1
    BE1 -->|"JSON scores + narratives"| FE3

    %% Backend โ†’ External
    BE2 -.->|"price, volume, stats"| EX1
    BE3 -.->|"social media posts"| EX2
    BE3 -.->|"reddit discussions"| EX3
    BE2 -.->|"quotes, news"| EX5
    BE6 -.->|"classify posts, sentiment"| EX4
    BE7 -.->|"generate narratives"| EX4

    %% Styling
    style Frontend fill:#dbeafe,color:#1e3a5f,stroke:#7aa2f7
    style Backend fill:#dcfce7,color:#14532d,stroke:#4ade80
    style External fill:#fee2e2,color:#7f1d1d,stroke:#f87171
Loading

๐Ÿ“ Scoring Methodology

The composite manipulation risk score is a weighted average of five independent sub-scores, each ranging from 0โ€“100:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Sub-Score            โ”‚ Weight โ”‚ Key Features                              โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ ๐Ÿ”ด Pump Risk         โ”‚  30%   โ”‚ Volume z-scores, price gaps, ROC accel.   โ”‚
โ”‚ ๐ŸŸ  Social Hype       โ”‚  25%   โ”‚ Mention velocity, hype score, spam ratio  โ”‚
โ”‚ ๐Ÿ”ต Liquidity Stress  โ”‚  20%   โ”‚ Float, ADV, market cap, inst. ownership   โ”‚
โ”‚ ๐ŸŸก Technical Fragilityโ”‚  15%   โ”‚ RSI, SMA distance, Bollinger breaches     โ”‚
โ”‚ ๐ŸŸฃ Squeeze Pressure  โ”‚  10%   โ”‚ Short % float, days-to-cover, P/C ratio   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Risk Bands

Band Score Range Color
๐ŸŸข LOW 0โ€“25 Green
๐ŸŸก MEDIUM 25โ€“50 Yellow
๐ŸŸ  HIGH 50โ€“75 Orange
๐Ÿ”ด CRITICAL 75โ€“100 Red

The composite applies a stacking floor (when 2+ sub-scores are HIGH, the composite can't fall below their average) and a correlation cap (no single outlier can push the composite more than 15 points above the max sub-score) to prevent dilution or exaggeration.


๐Ÿ› ๏ธ Tech Stack

Frontend

Backend

Data Sources & AI


๐Ÿ“ Project Structure

sussy-scanner/
โ”œโ”€โ”€ ๐Ÿ“‚ client/                          # React + Vite frontend
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ AnalysisHeader.jsx      # Symbol, date, score badge
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ DashboardGrid.jsx       # Main analysis layout
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ TradingViewChart.jsx    # Candlestick / line chart
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ SignalsPanel.jsx        # Expandable risk scores
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ NarrativeMixChart.jsx   # Social narrative donut
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ SocialPanel.jsx         # Social media posts feed
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ NewsPanel.jsx           # News articles panel
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ KeyStatsPanel.jsx       # Feature value table
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ScoreCard.jsx           # Individual score display
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ SimilarityCallout.jsx   # Historical match display
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”‚   โ”œโ”€โ”€ routes/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Landing.jsx             # Home page with search
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ Analysis.jsx            # Analysis dashboard
โ”‚   โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ api.js                  # Axios API client
โ”‚   โ”‚   โ””โ”€โ”€ styles/
โ”‚   โ”‚       โ””โ”€โ”€ tokens.css              # Design tokens
โ”‚   โ””โ”€โ”€ package.json
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ server/                          # Express backend
โ”‚   โ”œโ”€โ”€ index.js                        # App entry + route definitions
โ”‚   โ”œโ”€โ”€ db.js                           # SQLite connection
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ ingestion/                   # Data source adapters
โ”‚   โ”‚   โ”œโ”€โ”€ marketData.js               # Unified market data facade
โ”‚   โ”‚   โ”œโ”€โ”€ yahooFinance.js             # Yahoo Finance quote/stats
โ”‚   โ”‚   โ”œโ”€โ”€ yahooChart.js               # Yahoo Finance OHLCV history
โ”‚   โ”‚   โ”œโ”€โ”€ finnhub.js                  # Finnhub quote/news adapter
โ”‚   โ”‚   โ”œโ”€โ”€ newsService.js              # News aggregation
โ”‚   โ”‚   โ”œโ”€โ”€ tavilySearch.js             # Tavily social media search
โ”‚   โ”‚   โ”œโ”€โ”€ redditSearch.js             # Reddit post search
โ”‚   โ”‚   โ””โ”€โ”€ timestampEnricher.js        # Post timestamp normalization
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ features/                    # Feature engineering modules
โ”‚   โ”‚   โ”œโ”€โ”€ featureVector.js            # Feature assembly + ordering
โ”‚   โ”‚   โ”œโ”€โ”€ priceVolumeFeatures.js      # Volume z-scores, returns
โ”‚   โ”‚   โ”œโ”€โ”€ technicalFeatures.js        # RSI, SMA, Bollinger Bands
โ”‚   โ”‚   โ”œโ”€โ”€ liquidityFeatures.js        # Float, ADV, market cap
โ”‚   โ”‚   โ”œโ”€โ”€ squeezeFeatures.js          # Short interest, options
โ”‚   โ”‚   โ”œโ”€โ”€ socialFeatures.js           # Mentions, hype, sentiment
โ”‚   โ”‚   โ””โ”€โ”€ stats.js                    # Statistical helpers
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ services/                    # Business logic
โ”‚   โ”‚   โ”œโ”€โ”€ explainability.js           # Main analysis orchestrator
โ”‚   โ”‚   โ”œโ”€โ”€ compositeScore.js           # Weighted score aggregation
โ”‚   โ”‚   โ”œโ”€โ”€ pumpRiskScore.js            # Pump & dump detection
โ”‚   โ”‚   โ”œโ”€โ”€ socialHypeScore.js          # Social media hype scoring
โ”‚   โ”‚   โ”œโ”€โ”€ liquidityScore.js           # Liquidity stress scoring
โ”‚   โ”‚   โ”œโ”€โ”€ techFragilityScore.js       # Technical fragility scoring
โ”‚   โ”‚   โ”œโ”€โ”€ squeezeScore.js             # Short squeeze scoring
โ”‚   โ”‚   โ”œโ”€โ”€ scoringHelpers.js           # Severity + band utilities
โ”‚   โ”‚   โ”œโ”€โ”€ geminiClient.js             # Gemini API client
โ”‚   โ”‚   โ”œโ”€โ”€ geminiAnalyzer.js           # AI post classification
โ”‚   โ”‚   โ”œโ”€โ”€ geminiNarrator.js           # AI narrative generation
โ”‚   โ”‚   โ”œโ”€โ”€ similarityEngine.js         # Historical event matching
โ”‚   โ”‚   โ””โ”€โ”€ cache.js                    # SQLite TTL cache
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ data/                        # Reference datasets
โ”‚   โ”‚   โ”œโ”€โ”€ pump_anchors.json           # Known pump event features
โ”‚   โ”‚   โ””โ”€โ”€ preset_squeeze.json         # Preset analysis events
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ package.json
โ”‚
โ”œโ”€โ”€ .env.example                        # Environment template
โ””โ”€โ”€ package.json                        # Root workspace config

โšก Quick Start

Prerequisites

  • Node.js โ‰ฅ 18
  • npm โ‰ฅ 9
  • API keys for:

Installation

# 1. Clone the repository
git clone <repo-url>
cd "Hack Brooklyn"

# 2. Install all dependencies (root + server + client)
npm run install:all

# 3. Configure environment variables
cp .env.example .env
# Edit .env with your API keys

# 4. Start development servers (both client + server)
npm run dev

The app will be available at:

  • ๐Ÿ–ฅ๏ธ Frontend: http://localhost:5173 (Vite dev server)
  • โš™๏ธ Backend: http://localhost:3001 (Express API)

Environment Variables

Variable Required Description
TAVILY_API_KEY โœ… Tavily search API key for social media ingestion
GEMINI_API_KEY โœ… Google AI Studio API key for Gemini/Gemma model
GEMINI_MODEL โŒ Model ID (default: gemma-3-27b-it)
FINNHUB_API_KEY โŒ Finnhub API key for enhanced market data
PORT โŒ Server port (default: 3001)
CACHE_DB_PATH โŒ SQLite cache path (default: ./cache.sqlite)

๐Ÿ”Œ API Reference

Core Endpoints

Method Endpoint Description
GET /api/health Health check + model info
GET /api/analysis/:symbol ๐Ÿ”ฅ Full analysis โ€” scores, features, AI narratives, similarity
GET /api/similarity/:symbol Historical pump event similarity match
GET /api/timeline/:symbol Price + volume + social velocity time series
GET /api/presets List of preset historical events

Market Data

Method Endpoint Description
GET /api/stock/quote/:symbol Real-time quote
GET /api/stock/history/:symbol OHLCV history (?period1=&period2=&interval=1d)
GET /api/stock/stats/:symbol Key statistics (market cap, float, etc.)
GET /api/stock/search?q= Symbol search / autocomplete

Social & News

Method Endpoint Description
GET /api/social/:symbol Social media posts (?date=&window=7)
GET /api/news/:symbol News articles (?date=&window=7)

All endpoints support an optional date query parameter for historical analysis (e.g., ?date=2021-01-27).


๐Ÿงช Preset Historical Events

The app ships with pre-configured famous market events for instant analysis:

Ticker Date Event
๐ŸŽฎ GME 2021-01-27 GameStop short squeeze
๐ŸŽฌ AMC 2021-06-02 AMC ape rally
๐Ÿ›๏ธ DWAC 2021-10-22 Trump SPAC pump
๐Ÿ›๏ธ BBBY 2022-08-16 Bed Bath & Beyond meme revival
๐Ÿ’ป SMCI 2024-03-08 Super Micro AI spike

๐Ÿง  How the AI Analysis Works

  1. Social Post Collection โ€” Tavily and Reddit APIs gather recent social media posts mentioning the stock
  2. Pre-filtering โ€” Posts are pre-screened using regex patterns for clearly benign (earnings, SEC filings) or clearly suspicious ("to the moon", "diamond hands") language
  3. Gemini Batch Analysis โ€” Remaining posts are sent to Google Gemini in batches of 5, classified for:
    • Promotional language detection
    • Hype score (0โ€“1)
    • Urgency signals
    • Sentiment (bullish/bearish/neutral)
    • Narrative categorization (meme_hype, short_squeeze, coordination_signal, etc.)
  4. Narrative Generation โ€” Gemini generates one-line explanations for each risk sub-score
  5. Similarity Matching โ€” The assembled feature vector is compared against known historical pump events using cosine similarity

This project was built for Hack Brooklyn and is intended for educational and research purposes. Market data is sourced from public APIs; this tool does not constitute financial advice.


Built with ๐Ÿ” by the Sussy Scanner team @ Hack Brooklyn

About

Protecting investors from suspicious market activity.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors