Skip to content

Support different base URLs for /info, /exchange, and /ws endpoints #198

@smypmsa

Description

@smypmsa

Problem

The SDK currently requires all endpoints (/info, /exchange, /ws) to be served from the same base URL. This makes it impossible to:

  • Use different providers for different endpoints
  • Use providers that only support subsets of endpoints
  • Distribute endpoints across different infrastructure

Current limitation

# This forces /info, /exchange, and /ws to all use the same base URL
exchange = Exchange(wallet, base_url="https://api.hyperliquid.xyz")
# Internally creates: Info(base_url) which also creates WebSocket from base_url

Proposed solution

Add optional parameters to specify different base URLs for each endpoint:

exchange = Exchange(
    wallet,
    base_url="https://api.hyperliquid.xyz",     # Fallback default
    info_base_url="https://provider1.com",      # For /info
    exchange_base_url="https://provider2.com",  # For /exchange  
    ws_base_url="wss://provider3.com"         # For /ws
)

Benefits

  • Flexible endpoint routing
  • Backward compatible (all parameters optional)
  • Enables partial provider support

Would you be open to a PR implementing this approach?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions