Skip to main content
Back to Sample Apps

Hyperliquid Portfolio Tracker

Build a real-time portfolio tracker that monitors Hyperliquid perpetual positions, PnL, margin utilization, and vault holdings using Quicknode's Hyperliquid info endpoint.

Frontend Framework/Library:
React
Language:
TypeScript
Build Tool/Development Server:
Vite
Sample app preview

Introduction

As a perpetual trader on Hyperliquid, having a comprehensive portfolio tracker is essential for monitoring your positions, PnL, and margin utilization in real-time. This guide shows you how to build a powerful portfolio tracker that monitors any Hyperliquid wallet using Quicknode's Hyperliquid info endpoint.

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


Additional Resources

For an in-depth guide on implementing this portfolio tracker from scratch, check out our comprehensive guide on Quicknode


Features


  • Live Position Tracking: Real-time updates on perpetual positions with PnL
  • Portfolio Analytics: Account value, margin usage, and risk metrics
  • Vault Management: Track vault value and lock-up schedules
  • Spot Holdings: Monitor token balances and USD values
  • Search For Any Wallet: Switch between different trading accounts

Tech Stack

Frontend​


  • React + TypeScript + Tailwind CSS + shadcn/ui & Radix UI
  • Displays trading data in a responsive interface
  • Polls database every 1000ms for updates
  • Handles wallet switching through database requests

Backend​


  • Node.js indexer with 500ms polling interval
  • Fetches data from 5 different Hyperliquid endpoints
  • Stores data in PostgreSQL with proper precision handling
  • Manages wallet switching requests from the frontend

Polling Considerations

This guide uses aggressive polling intervals (500ms for indexer, 1000ms for frontend) to demonstrate real-time updates. You can adjust these intervals if needed:

  • Frontend: src/Dashboard.tsx lines 260-264 - Change the 1000 value in:
    const interval = setInterval(async () => {
    await fetchData(currentWallet);
    }, 1000);
  • Indexer: src/indexer/indexer.ts lines 623-630 - Change the 500 value in:
    setInterval(async () => {
    await indexer.checkForWalletSwitch();
    await indexer.indexData();
    }, 500);

Monitor your Quicknode and Supabase usage to optimize costs.

Database​


  • Supabase PostgreSQL
  • Stores trading data in 6 tables with financial precision (DECIMAL types)
  • Handles communication between frontend and indexer via wallet_switch_requests table
  • Uses unique constraints to prevent duplicate entries

Data Source​


  • Hyperliquid info endpoint via Quicknode
  • Provides account data, positions, vault holdings, spot balances, and delegations
  • Returns data in JSON format with string numbers for precision
  • Accessed via HTTP POST requests with wallet address parameter

Architecture


                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Perp Trader β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ 1. Enter wallet address
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ React Dashboard │◄─────────────────┐
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ 2. Store request β”‚ 6. Read & display data
β–Ό β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ Supabase │◄──────────────────
β”‚ PostgreSQL β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ 3. Detect request β”‚ 5. Store data
β–Ό β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ Indexer β”‚β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ (500ms poll) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ 4. Fetch HyperCore data
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Quicknode β”‚
β”‚ Hyperliquid β”‚
β”‚ Endpoint β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The portfolio tracker consists of three components that communicate through a PostgreSQL database. The indexer fetches data from Hyperliquid, stores it in the database, and the frontend queries the database for display.


Prerequisites


  • Quicknode account with Hyperliquid endpoint
  • Supabase account
  • Node.js v20+, npm, and a code editor
  • Basic React/TypeScript and REST API concepts
  • Basic SQL concepts
  • Optional: Hyperliquid perpetual trading experience
Why Quicknode Endpoint?

Quicknode provides dedicated Hyperliquid API endpoints that eliminate the need to run your own node:

  • Pre-configured endpoints with no setup required
  • Handles connection management and failover
  • Direct access to HyperCore data without additional infrastructure

Quick Start

1. Clone the Repository​

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

2. Setup Environment File​

cp .env.example .env

3. Supabase Database Setup​


  1. Create a new Supabase account or login at supabase.com

  2. Create a new project, then click the Connect button

Connect Button


  1. In the App Frameworks section, select React and change using to Vite

Select React


  1. Copy the VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY values to your .env file 1
  2. Navigate to the SQL Editor, paste the content of supabase/schema.sql, then click Run

SQL Editor

This creates all necessary tables and functions for storing and fetching trading data.

4. Quicknode Setup​


  1. Create a free trial Quicknode account
  2. Create a Hyperliquid RPC endpoint
  3. Copy the endpoint URL and paste it to your .env file
Important

Make sure you remove the existing /evm and add /info at the end of your Quicknode endpoint URL to gain access to the Hyperliquid info endpoints.

5. Start the Application​

npm install && npm run dev:both

This runs both the frontend application and the indexer. Open your browser at http://localhost:5173 and use the demo wallet button to see the tracker in action.


Troubleshooting


If the indexer stops responding or no data appears after wallet search, simply re-run the indexer:

npm run dev:indexer

Then search again by inputting a valid wallet address.


Preview

Main Page​

Main Page

Dashboard View​

Dashboard View


Learn More



Future Improvements


  • Liquidation Warnings: Alert users when positions approach dangerous margin levels
  • Performance Charts: Track portfolio performance over time with Recharts
  • Price Alerts: Send notifications using your favorite notification service
  • Multi-Wallet Dashboard: Compare multiple trading accounts side-by-side

Contributions & Feedback
We'd love to hear your feedback and welcome any contributions to this sample app!
To report issues or share feedback, open a GitHub issue in the qn-guide-examples repository.
To contribute, follow these steps:
  1. Fork the repository
  2. Create a feature branch:
    git checkout -b feature/amazing-feature
  3. Commit your changes:
    git commit -m "Add amazing feature"
  4. Push your branch:
    git push origin feature/amazing-feature
  5. Open a Pull Request.