Skip to content

i-ghz/algoliquidite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Liquidity Assessment Tool

A comprehensive tool to analyze liquidity and slippage across multiple decentralized perpetual exchanges. Get real-time market depth analysis and compare execution costs across different platforms.

Features

  • Multi-Exchange Support: Analyze liquidity across 5+ major DEX perpetual platforms

    • Hyperliquid
    • Paradex
    • Extended
    • Lighter
    • Aster
  • Comprehensive Slippage Analysis: Test multiple order sizes ($1k, $10k, $100k, $500k)

  • Cost Breakdown: See detailed breakdown of:

    • Raw slippage (bps)
    • Taker fees (bps)
    • Total execution cost (bps)
    • Effective spread
    • Orderbook depth used
  • Smart Rankings:

    • Ranking by slippage only
    • Ranking by total cost (slippage + fees)
  • Interactive CLI: Simple, user-friendly command-line interface

Installation

Prerequisites

  • Node.js (v14 or higher)
  • npm

Setup

  1. Clone the repository:
git clone <your-repo-url>
cd algo-liquidité
  1. Install dependencies:
npm install

Usage

Interactive Mode (Recommended)

Simply run the script and it will prompt you for the token:

node slippageTestAll.js

You'll be asked to enter a token ticker:

Enter token ticker (e.g., sui, btc, eth): sui

Direct Mode

Pass the token ticker as a command-line argument:

node slippageTestAll.js sui
node slippageTestAll.js btc
node slippageTestAll.js eth

Analyze Specific Exchanges

You can specify which exchanges to analyze:

node slippageTestAll.js sui hyperliquid,paradex
node slippageTestAll.js btc extended,lighter,aster

Understanding the Output

Results by Exchange

For each exchange, you'll see:

📊 HYPERLIQUID (Taker fee: 4.5 bps)
   Mid: $95000 | Top-of-book spread: 2.1 bps

   Size     │ Levels (B/S) │ Slippage    │ + Fees      │ = Total Cost
   ─────────┼──────────────┼─────────────┼─────────────┼─────────────
   $1k      │ 2/2          │ 0.52 bps    │ 4.5 bps     │ 5.02 bps ✅
   $10k     │ 5/5          │ 2.15 bps    │ 4.5 bps     │ 6.65 bps ✅
   $100k    │ 15/14        │ 8.45 bps    │ 4.5 bps     │ 12.95 bps ✅
   $500k    │ 35/32        │ 25.30 bps   │ 4.5 bps     │ 29.80 bps ⚠️
  • Levels (B/S): Number of orderbook levels consumed (Buy/Sell)
  • Slippage: Pure price impact in basis points
  • Fees: Exchange taker fees
  • Total Cost: Combined execution cost
  • ✅ = Order fully filled | ⚠️ = Partial fill

Rankings

The tool provides two types of rankings:

  1. By Slippage Only: Best liquidity (ignoring fees)
  2. By Total Cost: Best overall execution (including fees)
RANKINGS BY TOTAL COST (Slippage + Fees):

$1k:
  🥇 #1 lighter        0.45 bps (slip: 0.45 + fee: 0)
  🥈 #2 paradex        0.89 bps (slip: 0.89 + fee: 0)
  🥉 #3 hyperliquid    5.02 bps (slip: 0.52 + fee: 4.5)

How It Works

  1. Fetches Orderbooks: Retrieves real-time orderbook data from each exchange's API
  2. Calculates Slippage: Simulates market orders of different sizes
  3. Measures Impact: Calculates price impact, effective spread, and depth used
  4. Adds Fees: Incorporates exchange-specific taker fees
  5. Ranks Results: Provides comparative analysis across platforms

Supported Tokens

The tool supports any token available on the connected exchanges. Common examples:

  • BTC
  • ETH
  • SOL
  • SUI
  • APT
  • ARB
  • AVAX
  • And many more...

API Endpoints Used

The tool automatically handles different API endpoint formats for each exchange:

  • Hyperliquid: Direct token symbol (e.g., BTC)
  • Paradex: {TOKEN}-USD-PERP format
  • Extended: {TOKEN}-USD format
  • Lighter: Symbol matching via market details
  • Aster: {TOKEN}USDT format

Taker Fees Reference

Exchange Taker Fee
Hyperliquid 4.5 bps
Extended 2.5 bps
Lighter 0 bps
Aster 4 bps
Paradex 0 bps

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - feel free to use this tool for your trading analysis.

Disclaimer

This tool is for informational purposes only. Always verify liquidity conditions in real-time before executing large orders. Past liquidity is not indicative of future liquidity.

Support

For issues or feature requests, please open an issue on GitHub.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •