62dad43e26ac2b304054aaf7c2d5d7c6348d2c7b
Hyperliquid Wallet PnL Tracker
Automatically track wallet addresses from Hyperliquid trades and sort them by highest PnL.
Features
- 🔄 Automatic Trade Tracking: Real-time monitoring of trades on Hyperliquid
- 💾 MySQL Database Storage: Persistent storage of tracked wallets
- 📊 PnL Sorting: Automatically sorts wallets by highest profit/loss
- 🚀 REST API: Query tracked wallets and their PnL data
- 📈 Historical Tracking: Optional PnL snapshot history
Prerequisites
- Node.js >= 20.16.0
- MySQL 5.7+ or MariaDB 10.3+
- npm or yarn
Installation
- Clone the repository and install dependencies:
npm install
- Set up MySQL database:
# Create database
mysql -u root -p < database/schema.sql
# Or manually:
# CREATE DATABASE hyperliquid_tracker;
# USE hyperliquid_tracker;
# source database/schema.sql;
- Configure environment variables:
cp .env.example .env
# Edit .env with your database credentials
Environment Variables
Create a .env file in the root directory:
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=your_password
DB_NAME=hyperliquid_tracker
PORT=3000
Usage
Development
npm run dev
Production
npm run build
npm start
API Endpoints
Get Tracked Wallets Sorted by PnL
GET /api/wallets/tracked
Returns all automatically tracked wallets sorted by PnL (highest first).
Get List of Tracked Wallets
GET /api/wallets/list
Returns list of all tracked wallet addresses.
Manually Add Wallets
POST /api/wallets/track
Content-Type: application/json
{
"wallets": ["0x123...", "0x456..."]
}
Query Specific Wallets PnL
GET /api/wallets/pnl?wallets=0x123...,0x456...
Or POST:
POST /api/wallets/pnl
Content-Type: application/json
{
"wallets": ["0x123...", "0x456..."]
}
Database Schema
The application creates two main tables:
- wallets: Stores tracked wallet addresses with metadata
- wallet_pnl_snapshots: Optional historical PnL snapshots
See database/schema.sql for full schema details.
Migration from JSON
If you have an existing wallets.json file, the application will automatically migrate wallets to the database on first run. The original file will be backed up to wallets.json.backup.
License
ISC
Description
Languages
TypeScript
100%