Skip to content
TheChatArchiveThe Chat Archive
o3-2025-04-16· OpenAIHugging Face LMArena Human Preference 140K

how to market make btc on hyperliquid in detail with lowest latency and maximum profit

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Metallama-4-maverick-17b-128e-instruct’s answer.
  1. User

    how to market make btc on hyperliquid in detail with lowest latency and maximum profit

  2. Assistant

    ⚠️ Disclaimer
    I am not a licensed financial advisor, broker-dealer, or lawyer. The following is general, educational information only and should not be construed as personalized investment advice or a guarantee of profit. Crypto-derivatives trading and market making are highly risky; you can lose more than your initial capital. Consult qualified professionals and comply with all applicable regulations before acting.


    End-to-End Guide to Market-Making BTC-Perpetuals on Hyperliquid

    1. Conceptual Foundations

    TopicWhy It Matters to MM
    Maker/Taker FeesHyperliquid (HL) offers rebates for limit orders that add liquidity. Your edge often comes from these rebates + micro-spread capture.
    Funding Rates & Perpetual MechanicsPositive/negative funding directly impacts inventory P&L and should feed into your quoting bias.
    Inventory RiskYou constantly accumulate BTC exposure. A robust inventory skew or hedging scheme is mandatory.
    LatencyIn a fast perpetual, stale quotes get “picked off.” Sub-millisecond ingestion + order cancel/replace speed are vital for survivability.

    2. Infrastructure for Lowest Latency

    1. Colocation / Proximity • HL runs on AWS us-east-1. Spinning up c5n.metal or c6i instances in the same region cuts round-trip latency to ~300–600 µs over internal AWS backbone.
      • Pin the instance to the nearest Availability Zone to HL’s matching engine (usually us-east-1c).

    2. Hardware Choices • Bare-metal or “metal” EC2 for kernel-bypass networking (e.g., Solarflare/Xilinx ENA adapters).
      • nvme SSD for local order-book snapshots; disable CPU power-saving states (intel_pstate=disable).

    3. Networking Tweaks

      sudo ethtool -G eth0 rx 4096 tx 4096   # deeper NIC queues
      sudo ethtool -K eth0 tso off gso off gro off
      tcp_tw_reuse = 1
      rmem_max = 134217728
      

      • Pin websocket listening thread to an isolated CPU core; same for the order submitter.

    4. Language & Frameworks • C++, Rust, or Java with Chronicle Wire for serialization.
      • Use websocket ping-pong timers to detect micro-disconnects <100 ms.

    5. Redundancy • Active-active pair of servers with shared Redis in-memory store for state sync.
      • Auto-failover on network jitter spikes >2 ms.

    3. Hyperliquid API Touchpoints

    FunctionEndpointLatency Tips
    Live Order Bookwss://api.hyperliquid.xyz/ws subscribe: {"type":"l2","coin":"BTC"}Batch depth updates; process in lock-free ring buffer.
    Place OrderPOST /v1/orders/placePre-serialize JSON, reuse TCP connection, or upgrade to WebSocket order channel (wssOrders).
    Cancel/ReplacePOST /v1/orders/cancelUse “bulk cancel by IDs” to keep packet count low.
    PositionsGET /v1/positionsThrottle to once per second; maintain local inventory state instead.

    4. Core Market-Making Logic

    Below is a simplified, language-agnostic outline. Adapt to your stack.

    loop every 20–100 ms:
        fair = fair_price()                 # mid + funding/impact adjustments
        inv  = current_inventory()
        gamma = risk_aversion(inv)
    
        # Spread width via Avellaneda-Stoikov
        k = order_book_elasticity()         # ~ order-book slope at top levels
        sigma = realized_vol(30s)
        dt = quote_horizon_sec
        half_spread = gamma * sigma^2 * dt
        skew = inv * k * hedge_ratio
    
        bid = fair - half_spread - skew
        ask = fair + half_spread - skew
    
        place_limit(bid, size=base_size + inv_adjust)
        place_limit(ask, size=base_size - inv_adjust)
    

    Important knobs:

    • gamma (risk aversion): higher = tighter inventory control, wider spread.
    • quote_horizon: how long you’re willing to hold stale orders; with 50 ms cancel/replace you can set dt ≈ 0.05.
    • k (order-book elasticity): calibrate from L2 snapshots (ΔPrice / ΔQty).
    • Inventory Hedge: When |inv| > threshold, cross hedge on a correlated venue (e.g., Binance spot) or widen quotes aggressively.

    5. Funding-Aware Skew

    Funding clock on HL is 1 h. Let fund be predicted next funding (percent per hour). Incorporate:

    bias = fund * funding_lookahead_hours * position_side
    bid += bias
    ask += bias
    

    If you’re long and funding is expected positive (you pay), you now prefer to unwind that long via a lower ask.

    6. Risk Management

    1. Soft & Hard Inventory Caps
      • Soft cap → widen spreads linearly.
      • Hard cap → market-exit ± hedge.

    2. Kill-Switch Conditions
      • Loss > X % equity in Y minutes.
      • Disconnect from websocket > 250 ms.
      • HL system latency (order ack – send) > 30 ms.

    3. Backtesting & Shadow Mode
      • Replay HL raw data via --historical API.
      • Run strategy in “paper” mode, logging fills; verify Sharpe > 1 before going live.

    4. Operational Checklist
      • Double-sign order payloads (API key + HMAC) to avoid hijacking.
      • Monitor funding, insurance fund status, HL maintenance.
      • 24/7 alerting: Grafana + PagerDuty on latency, inventory, PnL.

    7. Optimizing Profit vs. Latency

    LeverLow-Latency ImpactProfit ImpactTrade-Off
    Quote Frequency ↑Fresher quotes, fewer adverse picksHigher fees, network loadCPU/network burn
    Spread Width ↓More fills (capture rebates)↑ Adverse selection riskNeed faster hedging
    External Hedge Latency ↓Lower inventory costMore infra complexityExtra venue risk
    Multi-Tier SizeQuote small at top, large at ±1 bspBetter edge captureHarder inventory mgmt.

    8. Compliance & Record-Keeping

    • Maintain logs of every order, cancel, and fill for ≥5 years (reg-tech best practice).
    • Automated tax lot tracking (FIFO/LIFO) if you convert PnL to fiat.
    • Monitor evolving derivative regulations in your jurisdiction; HL is currently offshore.

    9. Continual Improvement Loop

    1. Weekly parameter sweep (grid search on gamma, base size, skew coeff).
    2. Post-trade analytics: heat-map PnL by inventory bucket, time-of-day, funding regime.
    3. Blend multiple models: Avellaneda + reinforcement Q-agent for dynamic spread.

    Key Takeaways

    • Latency ≠ Edge by itself; risk controls and adaptive quoting turn speed into sustainable PnL.
    • HL’s maker rebates + deep BTC order book make it suitable, but competition is intense—expect diminishing returns without continual R&D.
    • Never rely on a single venue or strategy; diversify and stress-test for tails (flash crashes, API downtime, funding spikes).

    Good luck, and trade safely!

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.