Hyperliquid¶
Hyperliquid is a high-performance decentralized exchange (DEX) for perpetual futures trading.
NexusTrader connects to Hyperliquid via HyperLiquidAccountType.
Account Types¶
Account Type |
Description |
|---|---|
|
Mainnet (live trading) |
|
Testnet (paper / sandbox) |
|
Linear futures mock connector (local simulation) |
|
Inverse futures mock connector |
|
Spot mock connector |
Note
Hyperliquid uses an Ethereum wallet (private key) for authentication.
Provide the wallet address as api_key and the private key as secret.
API Keys Setup¶
Add your credentials to .keys/.secrets.toml:
[HYPER.TESTNET]
api_key = "0xYourWalletAddress"
secret = "your_private_key"
You can access them manually, or use the settings_key parameter
in BasicConfig to auto-resolve (see below).
from nexustrader.constants import settings
HYPER_API_KEY = settings.HYPER.TESTNET.API_KEY
HYPER_SECRET = settings.HYPER.TESTNET.SECRET
Configuration Example¶
from nexustrader.config import (
Config,
PublicConnectorConfig,
PrivateConnectorConfig,
BasicConfig,
)
from nexustrader.constants import ExchangeType
from nexustrader.exchange import HyperLiquidAccountType
config = Config(
strategy_id="hyperliquid_demo",
user_id="user_test",
strategy=MyStrategy(),
basic_config={
ExchangeType.HYPERLIQUID: BasicConfig(
settings_key="HYPER.TESTNET",
testnet=True,
)
},
public_conn_config={
ExchangeType.HYPERLIQUID: [
PublicConnectorConfig(
account_type=HyperLiquidAccountType.TESTNET,
enable_rate_limit=True,
)
]
},
private_conn_config={
ExchangeType.HYPERLIQUID: [
PrivateConnectorConfig(
account_type=HyperLiquidAccountType.TESTNET,
enable_rate_limit=True,
)
]
},
)
Symbol Format¶
Hyperliquid perpetual futures use USDC as the quote currency:
BTCUSDC-PERP.HYPERLIQUIDETHUSDC-PERP.HYPERLIQUID
Note
Unlike CEX perpetuals (which use USDT), Hyperliquid uses USDC as the margin currency.
Make sure to use the USDC suffix in symbol names.
See also
Instruments for the full symbol naming convention.