Execution:
venue.trade() in chat code, strategy.execute() in strategy agents. Available in live (HYPERLIQUID) and paper (HYPERLIQUID_PAPER) modes. Data reference: Hyperliquid Data.Overview
Hyperliquid is an on-chain exchange for perpetual futures and spot pairs. Scalar Field connects to it as a tradable venue: market data is read from Hyperliquid’s public API, and orders are placed against an exchange account funded with USDC bridged from your Arbitrum wallet. A paper account (HYPERLIQUID_PAPER) is also available with virtual USDC and fills simulated against the live order book — see Paper Trading.
Order Semantics
- Symbols use the
H:prefix:H:BTCfor perps, canonical internal pair ids likeH:@142for spot. Thesymbolon every surface — trade input, trade responses, positions, history — is this same canonical id, so always match on it; the readable pair is display-only, carried separately asdisplay_symbol(withbase_asset/quote_asset). Never construct a pair name yourself — major-asset spot tokens are Unit-wrapped (BTC spot isUBTC, shown asH:UBTC/USDC;H:BTC/USDCdoes not exist). Discover markets withscreenHyperliquidMarkets(): itscoincolumn is the canonical id andnameis the readable pair. - Quantity is in the base asset (e.g.
0.01forH:BTC), not USD. To size from a dollar budget, useround(budget / price, sz_decimals).sz_decimalsis returned byscreenHyperliquidMarkets(); quantities that round to zero are rejected. - Selling more than the current position opens a short. Perp positions carry signed quantities — negative means short.
- Orders below $10 notional are rejected on the live account (no minimum on paper).
- Fills are synchronous:
venue.trade()blocks until the order fills or is rejected. Fill records include Hyperliquid-specific fieldsdirection(e.g."Open Short") andclosed_pnl.
Account Structure
Unlike wallet-funded venues, Hyperliquid holds its own USDC:cashon the account equals main-dex perps free collateral (withdrawable) — this is the buying power for new perp positions.- Spot and perp balances are separate.
venue.balances(account="HYPERLIQUID")returns one row per balance class, tagged"perp"or"spot". account_value,margin_used, andportfolio_valueinclude equity held on HIP-3 builder-deployed perp dexs (markets with symbols likeH:xyz:AAPL). Each HIP-3 dex holds its own USDC collateral; its perp balance rows carry an extradexkey with the dex name.- Perp positions carry additional fields:
leverage,leverage_type(cross/isolated),liq_price, andmargin_used.
Paper Trading
HYPERLIQUID_PAPER is a simulated Hyperliquid account with virtual USDC. Order calls have the same shape as live — pass account="HYPERLIQUID_PAPER" — so strategy code validated on paper runs unchanged against the live account.
- No setup. The paper account is provisioned automatically on first use (or with one click from the portfolio page). No wallet, bridging, deposits, or transfers are ever needed.
- Pre-funded balances. Every USDC bucket — perp, spot, and each HIP-3 dex — is pre-funded with $10M virtual USDC. HIP-3 buckets are seeded on first trade, so HIP-3 symbols (
H:xyz:AAPL) trade immediately without moving collateral. - Realistic fills. Market orders are simulated against the live Hyperliquid L2 order book: the fill price is the volume-weighted average of consumed book levels within the slippage limit (
slippage_bps, default 50). Real taker fees (4.5 bps) are charged on every fill. Orders that cannot fill within the slippage limit are rejected withNO_LIQUIDITY. - Full perp mechanics. Shorts, cross leverage (
venue.set_leverage()), real hourly funding rates, and cross-margin liquidations are all simulated. Spot is long-only.
Connecting and Funding
Paper: no setup —HYPERLIQUID_PAPER is provisioned automatically on first use.
Live:
- Connect Hyperliquid from the portfolio page.
- Fund your Arbitrum wallet (
WALLET_ARB) with USDC. - Bridge USDC from
WALLET_ARBto Hyperliquid from the portfolio page. Moving USDC between spot and perp balances is also done from the UI.
Usage
strategy.execute(symbol, target_qty) instead — see Strategies.
Data Functions
All functions read Hyperliquid’s public API; positions and fills are public on-chain data for any address, no authentication needed. Full parameter and schema documentation: Hyperliquid Data.Notes
- Order sizes are rounded to the market’s
sz_decimals; very small quantities may round to zero and be rejected. - Funding accrues hourly on perp positions;
funding_since_openon a position shows cumulative funding paid (negative = received). - Daily OHLCV bars are aligned to UTC midnight, which appears as 19:00/20:00 New York time in
ts_recv.
Related
- Hyperliquid Agent Architecture — how strategy agents share the account: funding and liquidation attribution
- Hyperliquid Data — full function reference
- Strategies — automated strategy execution
- Supported Venues — venue registry and
venue.*functions - Trading Fees