roq-hyperliquid

$ conda install \
      --channel https://roq-trading.com/conda/unstable \
      roq-hyperliquid
$ conda install \
      --channel https://roq-trading.com/conda/stable \
      roq-hyperliquid

Supports

Products

Spot

Futures

Swap

Option

Orders & Quotes
Account

Funds

Position

Note

✅ = Available.

❎ = Not implemented.

❌ = Unavailable.

❶ The exchange protocol does not support streaming updates for reference data and market status.

Using

$ roq-hyperliquid [FLAGS]

Flags

$ roq-hyperliquid --help
--exchange (hyperliquid)

Exchange identifier

--dex

DEXs (list)

--aggregator (false)

Treat Hyperliquid as an aggregator? The exchange field is then the name of the DEX

--rest_uri (https://api.hyperliquid-testnet.xyz)

Exchange end-point

--rest_host

Host (when URI is an IP address)

--rest_proxy

Proxy end-point

--rest_ping_freq (5s)

Ping frequency

--rest_ping_path

Ping path

--rest_request_timeout (30s)

Request timeout

--rest_recv_window (30s)

Receive window (please refer to exchange documentation)

--rest_terminate_on_403 (false)

(TEST) Trigger program termination after receiving a 403 response code?

--rest_back_off_delay (30s)

(TEST) Time to wait before retrying a rejected request

--ws_uri (wss://api.hyperliquid-testnet.xyz/ws)

Exchange end-point

--ws_host

Host (when URI is an IP address)

--ws_ping_freq (30s)

Ping frequency

--ws_request_timeout (15s)

Request timeout

--ws_max_subscriptions_per_stream (100)

Maximum number of symbols per connection

--ws_mbp_depth (0)

Maximum depth

--mbp_allow_price_inversion (false)

Allow price inversion?

--request_limit (10)

Maximum number of requests per interval

--request_limit_interval (1s)

Monitor interval

--encode_buffer_size (1048576)

Encode buffer size

--decode_buffer_size (10485760)

Decode buffer size

--suspend_after_429 (60s)

HTTP status 429 will suspend the connection for this period

Environments

$ --flagfile $CONDA_PREFIX/share/roq-hyperliquid/flags/prod/flags.cfg
# flagfile for the roq-hyperliquid gateway

--rest_uri=https://api.hyperliquid.xyz
--ws_uri=wss://api.hyperliquid.xyz/ws
$ --flagfile $CONDA_PREFIX/share/roq-hyperliquid/flags/test/flags.cfg
# flagfile for the roq-hyperliquid gateway

--rest_uri=https://api.hyperliquid-testnet.xyz
--ws_uri=wss://api.hyperliquid-testnet.xyz/ws

Configuration

$ --config_file $CONDA_PREFIX/share/roq-hyperliquid/config.toml

Important

This template will be replaced when the software is upgraded. Make a copy and modify to your own needs.

# config template for the roq-hyperliquid gateway

symbols = [
  "^BTC$",
  "^ETH$",
  "^SOL$"
]

[accounts]

  [accounts.A1]
  master = true
  login = "YOUR_HYPERLIQUID_PUBLIC_ADDRESS_GOES_HERE"
  secret = "YOUR_HYPERLIQUID_PRIVATE_KEY_GOES_HERE"
  symbols = [ ".*" ]

[users]

  [users.test]
  password = "1234"
  symbols = ".*"

  [users.trader]
  password = "secret"
  accounts = [ "A1" ]
  symbols = [ ".*BTC.*", ".*ETH.*" ]

[rate_limits]

  [rate_limits.global]
    type = "ORDER_ACTION"
    aggregate = true
    request_limit = 100
    monitor_period = "10s"
    ban_period = "5m"

Market Data

Inbound

Event

Field

activeAssetCtx

openInterest

OPEN_INTEREST

activeAssetCtx

dayNtlVlm

TRADE_VOLUME

activeAssetCtx

markPx

SETTLEMENT_PRICE

activeAssetCtx

funding

FUNDING_RATE

Order Management

Comments

  • Only mainnet is currently supported.

  • The login (TOML config) should be your account’s public address.

  • The secret (TOML config) should be your account’s private key.

    Note

    The account’s public key (not address!) can be derived from the private key is therefore not required.

  • Downloaded orders lack several attributes, e.g. TimeInForce.

  • Order management can only be enabled after downloading reference data. This is due to protocol using asset IDs (as opposed to symbol names) and very strict usage of significant decimals.

  • REST response has very little information for rejects.

  • ModifyOrder does not currently work.

  • Q: Do we need vault address for anything?

References

Common

Exchange