Skip to main content

Overview

Venue adapters connect Notional’s event-driven architecture to external exchanges. The adapter pattern enables:
  • Multi-venue support - Trade across multiple exchanges
  • Unified interface - Consistent API regardless of venue
  • Async execution - Non-blocking order submission
  • Automatic reconciliation - Detect and correct state drift

Architecture

Hyperliquid Adapter

The primary venue adapter integrates with Hyperliquid, managing order submission, fill reconciliation, and connection reliability.

Order Management

The adapter implements priority queuing and concurrent order limits (Hyperliquid supports max 100 concurrent orders). Priority System:
  • System-initiated orders (liquidations): Priority 0 (highest)
  • User orders: Priority 1
Queue Processing:
  • Orders queued with priority
  • Respects 100 concurrent order limit
  • Converts internal format to Hyperliquid wire format
  • Tracks in-flight orders by order ID

Retry Logic

Exponential backoff: Delay = min(2^n × 100ms + Jitter, 10s). Maximum 5 retries before escalating to dead letter queue.

Connection Reliability

WebSocket: Automatic reconnection with 30s heartbeat timeout. Position reconciliation on reconnect to verify state. Dual-channel architecture: REST for order submission (synchronous ack), WebSocket for fills (real-time).

Fill Reconciliation

Matches venue fills to internal orders via order ID tracking. Handles out-of-order notifications and logs discrepancies for manual review.

Event Flow

Wire Format Conversion

Hyperliquid uses shortened field names for efficiency. Internal orders are converted to wire format: Internal Format:
  • asset: Asset name (e.g., “BTC”)
  • side: “buy” or “sell”
  • limitPx: Limit price as string
  • sz: Order size
  • reduceOnly: Boolean flag
Hyperliquid Wire Format:
  • a: Asset index (integer)
  • b: Buy flag (true/false)
  • p: Price (trailing zeros removed)
  • s: Size
  • r: Reduce only flag
  • t: Time-in-force specification
  • c: Client order ID (for tracking)

Next Steps