跳至主要內容
返回範例應用程式

Hyperliquid TP/SL 熱力圖

A real-time browser dashboard that visualizes resting Hyperliquid TP/SL trigger orders as price-level clusters, anchored against live bid/ask prices from Quicknode Hypercore gRPC streams.

前端框架/函式庫:
React
語言:
TypeScript
建置工具/開發伺服器:
Vite
範例應用程式預覽

概覽

This app connects to Quicknode's Hyperliquid gRPC endpoint to stream live TP/SL trigger order events (StreamTpslUpdates) and best bid/offer prices (StreamBboBook). Open orders are clustered into configurable price buckets and pushed to the browser over WebSocket, where a canvas-based heatmap renders the aggregated trigger pressure at each price level in real time.

The app ships with a built-in demo mode that uses a synthetic feed, so you can explore the UI without any credentials.

This example app is provided for educational and demonstration purposes only.

建築

Browser (React + Canvas)

│ WebSocket

Node.js HTTP + WebSocket Server

├── gRPC: StreamTpslUpdates ──┐
│ ├── Quicknode Hyperliquid gRPC Endpoint
└── gRPC: StreamBboBook ──────┘

特色


  • Real-time TP/SL heatmap: price-bucket clusters updated live from Quicknode gRPC streams
  • BBO anchor: current bid and ask prices overlaid on the heatmap for market context
  • TP/SL mix indicator: each bucket shows a small green/red marker for take-profit vs. stop-loss share
  • Multi-asset support: monitor BTC, ETH, SOL, HYPE, and any other Hyperliquid perp symbol simultaneously
  • Configurable bucket width: BUCKET_SIZE_PCT scales bucket size relative to the current mid price
  • Demo mode: runs with a synthetic feed when credentials are missing or DEMO_MODE=true
  • Health endpoint: GET /health returns server status and current run mode as JSON

先決條件


  • Quicknode account with a Hyperliquid endpoint (gRPC access required)
  • Node.js v18+
  • pnpm

專案架構

proto/
orderbook.proto # gRPC service definition
src/
client/
App.tsx # Coin selector and WebSocket client
HeatmapCanvas.tsx # Canvas-based heatmap renderer
main.tsx # React entry point
styles.css # App styles
server/
cluster-store.ts # Order clustering and BBO state
config.ts # Env var loading
demo.ts # Synthetic demo feed
grpc.ts # gRPC client setup
server.ts # HTTP + WebSocket server
streams.ts # Live gRPC stream connections
shared/
types.ts # Shared TypeScript types

環境變數

複製 .env.example.env and fill in your credentials:

# https://your-endpoint.hype-mainnet.quiknode.pro:10000
QUICKNODE_GRPC_ENDPOINT=your-endpoint.hype-mainnet.quiknode.pro:10000
QUICKNODE_GRPC_TOKEN=your-auth-token
TARGET_COINS=BTC,ETH,SOL
DEFAULT_COIN=BTC
BUCKET_SIZE_PCT=0.75
DEMO_MODE=false
PORT=8787
Variable說明
QUICKNODE_GRPC_ENDPOINTYour Quicknode Hyperliquid gRPC endpoint (host:port)
QUICKNODE_GRPC_TOKENAuth token for the gRPC endpoint
TARGET_COINSComma-separated list of Hyperliquid perp symbols to monitor
DEFAULT_COINWhich coin to display on load (must be in TARGET_COINS)
BUCKET_SIZE_PCTBucket width as a percentage of mid price (e.g., 0.75 = ~$500 buckets on BTC near $64k)
DEMO_MODESet to true to force demo mode regardless of credentials
PORTHTTP server port (default: 8787)

開始使用

1. Clone the repo

git clone https://github.com/quiknode-labs/qn-guide-examples.git
cd qn-guide-examples/sample-dapps/hyperliquid-tpsl-heatmap

2. Install dependencies

pnpm install

3. Configure environment

cp .env.example .env

開啟 .env and set QUICKNODE_GRPC_ENDPOINT 以及 QUICKNODE_GRPC_TOKEN with your Quicknode Hyperliquid endpoint credentials. Omitting them will start the app in demo mode automatically.

4. Start the app

pnpm dev

Open http://localhost:8787 in your browser.


預覽

Hyperliquid TP/SL Heatmap dashboard preview
貢獻與回饋
我們非常樂意聽取您的意見,並歡迎您為這個範例應用程式提供任何貢獻!
若要回報問題或提供意見回饋,請在 qn-guide-examples 儲存庫。
若要貢獻,請依照以下步驟操作:
  1. 分叉此儲存庫
  2. 建立功能分支:
    git checkout -b feature/amazing-feature
  3. 將您的變更提交:
    git commit -m "新增超棒的功能"
  4. 推送您的分支:
    git push origin feature/amazing-feature
  5. 開啟一個 Pull Request。