Skip to content

About

Institutional-grade financial intelligence organism combining deep learning price forecasting, FinBERT NLP sentiment, Bayesian belief networks, and epistemic uncertainty governance with a Next.js dashboard.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

1 Commit

Folders and files

Repository files navigation

SENTINEL: Transcendent Market Intelligence

CI License: MIT Python 3.10+ Next.js 16 React 19

SENTINEL is an institutional-grade financial market intelligence platform combining deep learning price forecasting, natural language processing for sentiment analysis, Bayesian belief networks, and epistemic uncertainty filters.

Instead of operating as a traditional automated execution bot, SENTINEL acts as a cognitive market analysis organism. It integrates technical price regression with NLP sentiment analysis, multi-timeframe regime detection, and safety governanceβ€”including an Epistemic Humility Protocol and Silence Intelligence that suppresses predictions when market ambiguity exceeds quantifiable confidence thresholds.


Architecture Overview

The system operates across a 6-tier intelligence pipeline orchestrated by the Fusion Engine:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               WEB DASHBOARD (Next.js 16 + React 19)              β”‚
β”‚       Framer Motion Β· Tailwind CSS Β· Holographic Fallback       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚ HTTP (REST)
                                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                FASTAPI NEURAL CORTEX (main.py)                  β”‚
β”‚                     Port 8000 Β· CORS Enabled                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    TIER 4-6: COGNITIVE GOVERNANCE               β”‚
β”‚  β€’ Transcendent Intelligence (Epistemic awareness, daily budget) β”‚
β”‚  β€’ Omega Intelligence (Silence protocol & ambiguity suppression)β”‚
β”‚  β€’ Elite Governance (Hard risk filters & decision audit)        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 TIER 1-3: FUSION & INFERENCE ENGINE             β”‚
β”‚  β€’ Bayesian Belief Networks (Prior/Posterior Regime Odds)       β”‚
β”‚  β€’ Decision Quality (Drawdown-aware confidence estimation)      β”‚
β”‚  β€’ Fusion Aggregation: 0.6 Γ— LSTM + 0.4 Γ— Sentiment             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚                              β”‚
                   β–Ό                              β–Ό
      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚   LSTM TREND PREDICTOR  β”‚   β”‚     FINBERT SENTIMENT     β”‚
      β”‚ β€’ PyTorch 2-layer LSTM  β”‚   β”‚ β€’ Hugging Face FinBERT    β”‚
      β”‚ β€’ 60-day rolling window β”‚   β”‚ β€’ TextBlob / VADER fallbackβ”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚                              β”‚
                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                  β–Ό
                   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                   β”‚       DATA INGESTION        β”‚
                   β”‚ β€’ Yahoo Finance (yfinance)  β”‚
                   β”‚ β€’ Alpha Vantage Connector   β”‚
                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The 6 Intelligence Tiers

Tier Name Core Functionality Primary Components
Tier 1 Core Analytic Price trend regression & short-term trajectory PyTorch 2-layer LSTM (lstm_model.py), yfinance data loader (stock_data.py)
Tier 2 Contextual Multi-timeframe trend alignment & sentiment FinBERT NLP model (sentiment_engine.py), Reddit/news ingestors (fetch_social.py)
Tier 3 Decision Quality Capital preservation and confidence weighting Drawdown-aware penalty model (decision_quality.py), Bayesian belief network (bayesian_belief.py)
Tier 4 Elite Governance Institutional rules, bounds, and audit checks Hard risk constitution (elite_governance.py), guardrails (advanced_guardrails.py)
Tier 5 Omega Sentience Silence protocol & ambiguity discrimination Silence Intelligence (omega_intelligence.py), uncertainty tools (uncertainty_tools.py)
Tier 6 Transcendent Epistemic awareness, cognitive budgeting, ethics Daily insight budgeting (transcendent_state.json), moral restraint (transcendent_intelligence.py)

Implemented Features

  • Sequential Deep Learning Forecasts: 2-layer PyTorch LSTM model trained on 60-day rolling OHLCV windows to estimate expected price trajectories.
  • Financial NLP Sentiment: Sentiment classification using Hugging Face Transformers (ProsusAI/finbert) with automatic fallback to VADER and TextBlob when GPU/model weights are unavailable.
  • Bayesian Belief Networks: Dynamic probability distributions evaluating likelihood across Bullish, Neutral, and Bearish regimes.
  • Epistemic Humility & Silence Protocol: Automatically silences buy/sell signals when epistemic ambiguity (unknown unknowns) exceeds risk thresholds, preventing over-trading during regime shifts.
  • Daily Insight Budgeting: Limits cognitive inferences to preserve high conviction hypotheses and reduce noise amplification.
  • Hybrid Deployment Support: Fully decoupled web dashboard (Next.js) and computation core (FastAPI), with built-in client-side holographic mock telemetry for offline demonstration.
  • Multi-Asset Telemetry: Pre-configured analysis targets for BTC-USD, AAPL, TSLA, MSFT, ^NSEI, and ^NSEBANK.
  • Offline CLI Inference: Standalone command-line inference tool (cli_predict.py) for rapid local queries without launching the UI.

Tech Stack

Backend & AI Engine

  • Language: Python 3.10+ (tested on Python 3.12)
  • Deep Learning: PyTorch (torch), Scikit-learn
  • NLP: Hugging Face Transformers (transformers), VADER (vaderSentiment), TextBlob
  • API Framework: FastAPI, Uvicorn, Pydantic
  • Statistical Modeling: SciPy, NumPy, Pandas
  • Data Providers: Yahoo Finance (yfinance), Alpha Vantage (alpha_conn.py), PRAW (Reddit API)

Frontend Dashboard

  • Framework: Next.js 16.1 (App Router, Turbopack)
  • Library: React 19.2
  • Language: TypeScript 5
  • Styling: Tailwind CSS v4
  • Animation & Visuals: Framer Motion 12, Lucide React, Recharts 3

Repository Structure

.
β”œβ”€β”€ backend/                        # Python AI & API Engine
β”‚   β”œβ”€β”€ modules/                    # Core Intelligence Modules
β”‚   β”‚   β”œβ”€β”€ advanced_analysis.py    # Multi-factor market analytics
β”‚   β”‚   β”œβ”€β”€ advanced_guardrails.py  # Runtime boundaries & execution constraints
β”‚   β”‚   β”œβ”€β”€ alpha_conn.py           # Alpha Vantage integration connector
β”‚   β”‚   β”œβ”€β”€ backtest_tracker.py     # Prediction history logger
β”‚   β”‚   β”œβ”€β”€ bayesian_belief.py      # Bayesian belief network & regime odds
β”‚   β”‚   β”œβ”€β”€ database.py             # SQLite persistence utility
β”‚   β”‚   β”œβ”€β”€ decision_quality.py     # Confidence decay and drawdown scoring
β”‚   β”‚   β”œβ”€β”€ elite_governance.py     # Hard risk constitution & compliance
β”‚   β”‚   β”œβ”€β”€ fusion.py               # Central ensemble fusion engine
β”‚   β”‚   β”œβ”€β”€ lstm_model.py           # PyTorch 2-layer LSTM sequential model
β”‚   β”‚   β”œβ”€β”€ omega_intelligence.py   # Silence protocol & ambiguity filter
β”‚   β”‚   β”œβ”€β”€ sentiment_engine.py     # FinBERT and lexical sentiment analyzer
β”‚   β”‚   β”œβ”€β”€ stock_data.py           # Market data ingestion (yfinance)
β”‚   β”‚   β”œβ”€β”€ transcendent_intelligence.py # Epistemic budget & ethics engine
β”‚   β”‚   └── uncertainty_tools.py    # Entropy & epistemic bounds tools
β”‚   β”œβ”€β”€ data/                       # State and data ingestion scripts
β”‚   β”‚   β”œβ”€β”€ fetch_prices.py         # Standalone price fetch utility
β”‚   β”‚   β”œβ”€β”€ fetch_social.py         # Standalone Reddit/social scraper
β”‚   β”‚   └── transcendent_state.json # Daily cognitive budget state store
β”‚   β”œβ”€β”€ .env.example                # Template for external API credentials
β”‚   β”œβ”€β”€ cli_predict.py              # CLI entry point for predictions
β”‚   β”œβ”€β”€ list_models.py              # Model directory / inspection script
β”‚   β”œβ”€β”€ main.py                     # FastAPI server entry point
β”‚   β”œβ”€β”€ requirements.txt            # Complete Python dependencies
β”‚   β”œβ”€β”€ requirements_lite.txt       # Lightweight dependencies (no PyTorch/Transformers)
β”‚   └── test_system.py              # System self-verification test script
β”œβ”€β”€ data/                           # Reference test fixtures & backtest data
β”‚   β”œβ”€β”€ backtest_history.json       # Historical prediction log
β”‚   └── raw/                        # Sample reference CSVs (BTC-USD OHLCV & sentiment)
β”œβ”€β”€ frontend/                       # Next.js Web Dashboard
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ actions.ts              # Server action connecting UI to FastAPI / mock
β”‚   β”‚   β”œβ”€β”€ globals.css             # Tailwind CSS imports & theme definitions
β”‚   β”‚   β”œβ”€β”€ layout.tsx              # Root HTML layout with Geist font
β”‚   β”‚   └── page.tsx                # Dashboard interface with real-time telemetry
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ mockData.ts             # Holographic telemetry mock payload
β”‚   β”‚   └── utils.ts                # Class merging (clsx + tailwind-merge)
β”‚   β”œβ”€β”€ public/                     # Static assets (favicon.png)
β”‚   β”œβ”€β”€ eslint.config.mjs           # ESLint 9 configuration
β”‚   β”œβ”€β”€ next.config.ts              # Next.js configuration
β”‚   β”œβ”€β”€ package.json                # Frontend package dependencies & scripts
β”‚   β”œβ”€β”€ postcss.config.mjs          # PostCSS configuration
β”‚   └── tsconfig.json               # TypeScript configuration
β”œβ”€β”€ .gitignore                      # Git exclusion rules
β”œβ”€β”€ LICENSE                         # MIT License
β”œβ”€β”€ PRODUCTION_DEPLOYMENT.md        # Cloud deployment guide (Render + Vercel)
β”œβ”€β”€ README.md                       # Repository documentation
β”œβ”€β”€ SYSTEM_GUIDE.md                 # Detailed architectural walkthrough
└── TRANSCENDENT_VISION.md          # Theoretical paper on the 6-tier architecture

Prerequisites

  • Node.js: 18.18+ or 20+ (verified with Node.js 26)
  • npm: 9+ (verified with npm 11)
  • Python: 3.10+ (tested with Python 3.12)
  • Git

Installation & Setup

1. Clone Repository

git clone https://github.com/nfsprogramming/Sentinel-Intelligence.git
cd Sentinel-Intelligence

2. Frontend Setup

cd frontend
npm install
npm run dev

The web dashboard is now accessible at http://localhost:3000. By default, if the backend server is offline, the frontend operates in Holographic Demo Mode, displaying verified sample telemetry.

3. Backend Setup (Optional for Full Local AI Execution)

Open a separate terminal window:

cd backend

# Create virtual environment
python -m venv venv

# Activate virtual environment
# Windows:
.\venv\Scripts\activate
# Linux/macOS:
source venv/bin/activate

# Install dependencies (for complete deep learning & NLP pipeline):
pip install -r requirements.txt

# Or for lightweight testing without PyTorch / Transformers:
# pip install -r requirements_lite.txt

# Configure environment variables (optional):
cp .env.example .env

To run the FastAPI server:

python main.py

The API starts at http://127.0.0.1:8000.


Usage

Web Interface

  1. Launch both the backend (python main.py) and frontend (npm run dev).
  2. Open http://localhost:3000.
  3. Select an asset (BTC-USD, AAPL, TSLA, MSFT, ^NSEI, ^NSEBANK) or click Run Market Analysis.
  4. Review the 6-tier telemetry:
    • Regime Classification: Current market phase and volatility state.
    • Bayesian Distribution: Bullish, Neutral, and Bearish posterior probabilities.
    • Silence Status: Indicates whether the Omega tier has approved or suppressed signal output.
    • Cognitive Budget: Inferences consumed vs. daily quota.

Command Line Interface

To run predictions directly from the terminal without the web server:

cd backend
python cli_predict.py --ticker BTC-USD

Testing & Validation

Frontend Verification

cd frontend
npm run lint    # ESLint check (passes with 0 errors)
npm run build   # Next.js production build verification

Backend Verification

With the Python environment active:

cd backend
python test_system.py

Limitations

  • Proprietary Bounds: As noted in institutional filings, high-frequency execution drivers and proprietary alpha weights for real-money execution are decoupled from this public repository.
  • First-Run Weight Download: Initial execution of test_system.py or main.py requires downloading the FinBERT model weights (~440 MB) from Hugging Face.
  • API Rate Limits: Yahoo Finance and Reddit APIs impose rate limits during high-frequency querying. For continuous production streaming, dedicated API keys should be populated in backend/.env.

Contributing

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/improvement).
  3. Ensure all tests and linting pass (npm run lint and npm run build in frontend/).
  4. Commit your changes (git commit -m "Add feature").
  5. Push to the branch (git push origin feature/improvement).
  6. Open a Pull Request.

License

This project is licensed under the MIT License. Copyright (c) 2026 NFS Programming.

About

Institutional-grade financial intelligence organism combining deep learning price forecasting, FinBERT NLP sentiment, Bayesian belief networks, and epistemic uncertainty governance with a Next.js dashboard.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages