1
Install the SDK
Add
@outcome.xyz/hip4 to your project:2
Create and initialize the adapter
Import The adapter connects to the Hyperliquid testnet endpoints for both REST and WebSocket traffic.
createHIP4Adapter and call initialize(). It loads the market side names that prices and positions use.testnet: true is also the default when you omit the option. Pass { testnet: false } when you’re ready for mainnet.3
Fetch markets
Call
fetchMarkets() to retrieve live prediction markets. The response is an array of typed market objects - each one carries pre-computed side identifiers, expiry dates, and outcome metadata.defaultBinary markets are recurring price binary markets (e.g. “Will BTC be above $69,070 at expiry?”). You can also filter by "labelledBinary", "multiOutcome", or "priceBucket", or omit the type filter to get all markets.4
Set up authentication
Trading requires an approved ephemeral agent key. The agent key signs orders on your behalf without exposing your main wallet’s private key. The approval flow is a one-time operation per agent.After
initAuth() completes, the adapter signs all subsequent orders automatically using the agent key.5
Place a limit order
With auth initialized, call
hip4.trading.placeOrder() to submit a limit order. The method returns a result object instead of throwing on rejections.getMinShares(markPx) computes the minimum number of shares required to meet the $1 notional floor (MIN_NOTIONAL) at the given price. Passing markPx to placeOrder makes the SDK check this before signing and submitting.Next steps
- Read the core concepts to understand market types, coin naming, and the two signing flows.
- See the trading guide for market orders, cancellations, and builder fee configuration.
- Explore the real-time data guide to subscribe to live order books and price streams.