Market Confidence & Anomaly Detection

Human vs Automation • Divergence Engine • Composite Scoring • Trust Layer

← Back to Document Index

System Overview

The market confidence system answers the central question: "Is this price move driven by humans or algorithms?" It combines sentiment analysis, price correlation, funding rates, VIX regime, and bot detection into a unified signal.

flowchart TB subgraph DataSources["Data Sources"] Sentiment[("Sentiment Data
Reddit, Twitter, Telegram")] Price[("Price Data
Yahoo, CoinGecko")] Funding[("Funding Rates
Binance Perpetuals")] VIX[("VIX Data
Yahoo Finance")] Ticks[("Tick Data
Binance/Polygon")] end subgraph Engine["Analysis Engines"] Divergence["Divergence Engine
divergence-engine.ts"] ArbBot["Arb-Bot Detector
arb-bot-detector.ts"] TickClass["Tick Classifier
tick-classifier.ts"] end subgraph Composite["Composite Score Engine"] Score["Human-vs-Automation
composite-score.ts"] Weights["Weighted Average
5 sub-inputs"] end subgraph Output["Outputs"] DB[("computed_insights
kind='human_automation'")] UI["HumanAutomationPanel
/derivatives page"] ASE["All-Seeing Eye
Trust Layer aggregation"] end Sentiment --> Divergence Price --> Divergence Funding --> Score VIX --> Score Ticks --> TickClass Ticks --> ArbBot Divergence --> Score ArbBot --> Score TickClass --> Score Score --> Weights Weights --> DB DB --> UI DB --> ASE style DataSources fill:#1a1a2e style Engine fill:#16213e style Composite fill:#1a472a style Output fill:#2d132c

Composite Score: Human vs Automation

A single signal from -1 (bot-dominated) to +1 (human-driven) per symbol. File: composite-score.ts

-1
+1
Bot / Algorithmic Ambiguous Human / Conviction

5 Sub-Inputs (Weighted Average)

flowchart LR subgraph Inputs["Sub-Score Inputs"] I1["Divergence
weight: 3.2"] I2["Funding Extremity
weight: 1.5"] I3["VIX Regime
weight: 1.2"] I4["Arb-Bot Activity
weight: 2.0"] I5["Volume Anomaly
weight: 1.0"] end subgraph Calc["Calculation"] Avg["Weighted Average
Σ(vote × weight) / Σweight"] Conf["Confidence
#votes / #attempted"] end subgraph Output Score["Final Score
-1 to +1"] Label["Classification"] end I1 & I2 & I3 & I4 & I5 --> Avg Avg --> Score Avg --> Conf Conf --> Label style Calc fill:#16213e
Sub-Input Weight Signal Interpretation
Divergence Engine 3.2 HUMAN-DRIVEN → +1, BOT-LIKELY → -1, SOCIAL-NOISE → -0.3
Crypto Funding 1.5 Extreme rates (>0.05%) → -1 (algorithmic leverage stacking)
VIX Regime 1.2 High VIX (>75th percentile) → -0.5 (algo de-risking)
Arb-Bot Activity 2.0 High bot activity ratio → negative vote
Volume Anomaly 1.0 z-score > 2 with no news → -0.5 (hidden algo activity)

Divergence Engine

Classifies price moves by comparing sentiment and price correlation over a rolling window. File: divergence-engine.ts

5 Classification States

HUMAN-DRIVEN
Sentiment ↑ + Price ↑ (correlated)
BOT-LIKELY
Price moved, sentiment flat
SOCIAL-NOISE
Sentiment moved, price flat
QUIET
Neither moved materially
INSUFFICIENT
Not enough data
flowchart TB subgraph Input["Input Data"] Price["Daily Price Closes
7-day window"] Sent["Daily Sentiment
from sentiment_hourly"] end subgraph Calc["Classification Logic"] PMove{"Price Move
> 2%?"} SMove{"Sentiment Move
> 0.10?"} Corr{"Correlation
> 0.30?"} end subgraph Output["Classification"] Human["HUMAN-DRIVEN"] Bot["BOT-LIKELY"] Noise["SOCIAL-NOISE"] Quiet["QUIET"] end Price --> PMove Sent --> SMove PMove -->|Yes| SMove PMove -->|No| SMove SMove -->|"Both moved"| Corr Corr -->|Yes| Human Corr -->|No| Noise SMove -->|"Price only"| Bot SMove -->|"Sentiment only"| Noise SMove -->|"Neither"| Quiet style Calc fill:#16213e

Configuration Thresholds

Threshold Value Purpose
PRICE_MOVE_THRESHOLD 2% Minimum return to count as "price moved"
SENTIMENT_MOVE_THRESHOLD 0.10 Minimum Δ sentiment to count as "moved"
CORRELATION_HUMAN_THRESHOLD 0.30 Correlation required for "human-driven"
DEFAULT_WINDOW_DAYS 7 Rolling analysis window

Arb-Bot Detector

Detects arbitrage bot activity across prediction markets (Polymarket, Kalshi, etc.). File: arb-bot-detector.ts

flowchart LR subgraph Sources["Prediction Markets"] Poly["Polymarket"] Kalshi["Kalshi"] Meta["Metaculus"] end subgraph Detection["Bot Detection"] Spread["Cross-Market Spread
Analysis"] Timing["Trade Timing
Patterns"] Size["Order Size
Distribution"] end subgraph Output Ratio["Bot Activity Ratio
0-1"] Flag["Arb Opportunity
Detected?"] end Sources --> Spread & Timing & Size Spread & Timing & Size --> Ratio Spread --> Flag style Detection fill:#16213e

Bot Signatures

  • Sub-second trade timing
  • Round lot sizes
  • Consistent spread capture
  • Multi-market coordination

Output Metrics

  • botActivityRatio — 0-1 scale
  • arbOpportunityDetected — boolean
  • crossMarketSpread — basis points
  • lastArbTimestamp — ISO string

Trust Layer Integration

The trust layer aggregates confidence signals into All-Seeing Eye. File: all-seeing-eye/aggregation/trust-layer.ts

flowchart TB subgraph Inputs["Trust Signals"] HA["Human-Automation Score"] Div["Divergence Classification"] Manip["Manipulation Risk"] Wallet["Wallet Clustering"] end subgraph Aggregation["Trust Layer"] Fetch["fetchAllTrustData()"] Consensus["getTrustConsensus()"] Alerts["checkTrustAlerts()"] end subgraph Output["All-Seeing Eye"] UDP["UnifiedDataPoint[]
sourceType: 'trust'"] Risk["Trust Level:
high | medium | low"] end Inputs --> Fetch Fetch --> UDP Fetch --> Consensus Consensus --> Risk Fetch --> Alerts style Aggregation fill:#16213e

UI: HumanAutomationPanel

Displays per-symbol human-vs-automation scores on the /derivatives page.

Panel Features

  • Per-symbol score bar (-1 to +1)
  • Classification label pill
  • Expandable sub-score breakdown
  • Confidence indicator
  • Last update timestamp

API Endpoint

GET /api/predict/v1/insights/human-automation/batch

Returns latest scores for all monitored symbols. Public read access.

Scheduler Job

The human-automation composite is refreshed every 15 minutes.

Job Interval Process
human-automation 15 minutes 1. Run divergence engine for all symbols
2. Compute composite score with all sub-inputs
3. Persist to computed_insights

Data Pipeline

sequenceDiagram participant Sched as Scheduler participant Div as Divergence Engine participant Comp as Composite Score participant DB as computed_insights participant UI as Frontend Note over Sched: Every 15 minutes Sched->>Div: Run divergence for symbols Div->>Div: Fetch sentiment + price Div->>Div: Compute correlation Div->>DB: Store divergence result Sched->>Comp: Compute composite Comp->>DB: Read latest divergence Comp->>Comp: Fetch funding, VIX, arb-bot Comp->>Comp: Weighted average Comp->>DB: Store human_automation result UI->>DB: GET /insights/human-automation/batch DB-->>UI: Return scores + classifications

Anomaly Detection Signals

The system flags anomalies when signals diverge from normal patterns.

Volume Anomaly

ANOMALY

Volume z-score > 2 without corresponding news or sentiment.

Sentiment Divergence

ANOMALY

Strong sentiment move with no price response (social noise).

Price Without Narrative

WARNING

Significant price move with flat sentiment (bot-likely).

Funding Extremity

CAUTION

Crypto funding rate > 0.05% (leverage stacking).

Cross-Market Arb

INFO

Prediction market spreads indicate arbitrage opportunity.

VIX Regime Shift

REGIME

VIX crosses percentile thresholds (25th, 75th).

Data Persistence

Table Kind Contents
predict.computed_insights divergence_humanbot Per-symbol divergence classification + confidence
predict.computed_insights human_automation Composite score + sub-input breakdown
predict.sentiment_hourly Hourly sentiment rollup by topic

Results are keyed by inputs_hash to skip recompute when inputs haven't changed. Validity period: 30 minutes.

Future Enhancements (Blocked on Data)

These sub-inputs are designed but require paid data feeds to implement.

Sub-Input Blocker Weight (Planned)
Full Whale Classification Databento / Kaiko tick data 2.5
Order-Book Imbalance Binance depth@100ms / SIP L2 1.8
Inter-Exchange Lead/Lag Parallel exchange WebSockets 1.5
Dark Pool Activity FINRA ATS subscription 2.0