Pacifica Hackathon 2026 · Track 2: Analytics & Data

Whale Watcher

Real-time whale tracking and orderbook imbalance analytics for Pacifica perpetual markets. Monitor large trades, visualize bid/ask pressure, and receive personalized alerts — all in one dashboard.

Real-time Whale Feed
Orderbook Imbalance
Order Flow Board
Volume Analytics
Telegram Alerts
Smart Trade Signals

Features

Real-time Whale Detection

Monitors every trade on Pacifica perpetuals via WebSocket. When a trade exceeds the configured threshold, it is instantly classified, stored, and broadcast to all connected clients.

Orderbook Imbalance Indicator

Aggregates bid and ask volume from the top orderbook levels (Pacifica book stream) and computes a normalized imbalance ratio. Updates every 250ms per Pacifica's stream cadence.

Order Flow Board

Splits detected whale trades into separate buy and sell columns for visual comparison, with total volume and pressure percentage shown at the bottom.

Volume Analytics

Shows 24-hour buy vs sell volume distribution as a bar chart, top 5 largest buys and sells, net flow, and market sentiment indicator.

Telegram Alerts

Each user can set their own minimum trade size for alerts. Quick templates at $10k, $50k, and $100k plus a custom /set_<amount> command.

Dashboard

The dashboard has five tabs. A symbol filter (ALL / BTC / ETH / SOL) applies globally.

Overview Tab

  • Live whale activity feed with real-time updates
  • Orderbook Imbalance indicator with per-symbol breakdown
  • Volume Distribution chart (24h buy vs sell)

Order Book Tab

  • Side-by-side buy and sell whale flow
  • Total volume per side
  • Buy/sell pressure progress bar

Analytics Tab

  • Top 5 largest buy trades and sells
  • Volume by symbol with buy-sell ratio
  • Market sentiment gauge

Smart Trade Tab

  • Signal per symbol: LONG / SHORT / HOLD with confidence %
  • Combines orderbook imbalance + whale flow + activity level
  • One-click link to execute on Pacifica testnet

Portfolio Tab

  • Account equity, balance, margin used, available
  • Open positions with unrealized PnL
  • Quick links to deposit

Smart Trade

The signal engine combines multiple data sources into a single actionable recommendation per symbol.

Signal Factors

50%
Orderbook Imbalance
Bid/ask volume ratio from top 10 levels
30%
Whale Flow Direction
% of recent whale volume that is buy vs sell
20%
Whale Activity Level
Number of recent whale trades (more = higher confidence)

Direction Logic

LONG — imbalance bullish + whale buy dominant + confidence 30%
SHORT — imbalance bearish + whale sell dominant + confidence 30%
HOLD — mixed signals or low confidence

Orderbook Imbalance

Reads the Pacifica book WebSocket stream and calculates the ratio of bid volume to total volume across the top 10 price levels.

Signal States

STRONG BUY> +20% imbalance
BUY PRESSURE+5% to +20%
NEUTRAL-5% to +5%
SELL PRESSURE-20% to -5%
STRONG SELL< -20% imbalance

Formula

bid_volume = Σ (price × size) for top 10 bid levels
ask_volume = Σ (price × size) for top 10 ask levels
ratio = bid_volume / (bid_volume + ask_volume)
imbalance_pct = (ratio − 0.5) × 200

Whale Detection

The backend subscribes to the Pacifica trades stream and checks each trade against per-symbol thresholds.

Thresholds

SymbolDashboard AlertTelegram Default
BTC$10,000$50,000
ETH$10,000$50,000
SOL$1,000$5,000

Trade Direction Mapping

open_long / close_shortBUY
open_short / close_longSELL

Telegram Bot

Search @watcherWallerWhales_bot on Telegram to subscribe. Each user has an independent threshold stored per chat session.

/startSubscribe to whale alerts (default threshold: $50,000)
/thresholdShow threshold menu with quick-select options
/set_10000Set threshold to $10,000 (small whales)
/set_50000Set threshold to $50,000 (medium whales)
/set_100000Set threshold to $100,000 (large whales)
/set_<amount>Set any custom threshold, minimum $1,000
/statusShow current subscription and threshold
/stopUnsubscribe from all alerts

API Reference

Base URL: https://43.157.201.151.sslip.io

GET
/health

Health check + WebSocket client count

GET
/api/v1/whales/recent

Recent whale alerts (query: symbol, limit)

GET
/api/v1/whales/stats

Whale statistics for 24h (query: symbol, hours)

GET
/api/v1/whales/symbols

All symbols with whale activity

GET
/api/v1/markets

All available Pacifica markets

GET
/api/v1/markets/imbalance

Aggregated orderbook imbalance (query: symbol)

GET
/api/v1/markets/{symbol}/imbalance

Imbalance for a single symbol

GET
/api/v1/trading/signals

Smart trade signals for all symbols

GET
/api/v1/trading/signals/{symbol}

Signal for a specific symbol

GET
/api/v1/trading/account

Pacifica account info (query: account)

GET
/api/v1/trading/positions

Open positions (query: account)

WebSocket

Connect to wss://43.157.201.151.sslip.io/ws/whales for a persistent real-time stream.

Message Types

initial_data← server

Sent on connect. Contains recent whale alerts array and current imbalance snapshot.

{ "type": "initial_data", "data": [...alerts], "imbalances": {...} }
whale_alert← server

Fired whenever a new whale trade is detected above the configured threshold.

{ "type": "whale_alert", "data": { "symbol": "BTC", "side": "buy", "usd_value": 12500, ... } }
imbalance_update← server

Throttled to once per second per symbol. Contains the latest orderbook imbalance data.

{ "type": "imbalance_update", "data": { "symbol": "BTC", "imbalance_pct": 41.5, ... } }
ping→ client

Send every 25 seconds to keep the connection alive.

{ "type": "ping" }

Architecture

The system connects to two Pacifica WebSocket channels simultaneously: trades for whale detection and book for orderbook imbalance.

Pacifica WebSocket
├── trades stream (BTC / ETH / SOL)
└── book stream (BTC / ETH / SOL, agg_level=1)
FastAPI Backend
├── WhaleDetector → filters by threshold → DB + broadcast
├── OrderbookMonitor → computes imbalance → broadcast (throttled)
└── TelegramBot → per-user threshold → sends alert
Next.js Frontend
├── WhaleWebSocketContext (shared, 1 connection / tab)
├── WhaleActivityFeed
├── OrderbookImbalance
├── WhaleOrderBook
└── WhaleAnalytics
Backend
FastAPI + SQLAlchemy
Frontend
Next.js 16 + Tailwind
Database
PostgreSQL (Supabase)
Alerts
Telegram Bot API
Built for Pacifica Hackathon 2026Pacifica API Docs ↗