# Build Hyperliquid spot and perpetual orders for the right market

Resolve an exact Hyperliquid instrument, inspect its order book, review the intended spot or perpetual order, and reconcile fills with account activity.

Guide: https://www.bitpont.com/help/ai-agents/hyperliquid-spot-and-perpetual-orders/

## 1. Resolve the exact market and book

Search hyperliquid.directory with kind set to spot or perp. Save the returned market key, coin and venue. The example looks up spot markets matching WOW. Use viewHyperliquidSpot for a spot instrument, or viewHyperliquidVenue with the selected venue for a perpetual. A last trade or candle can differ from the best executable price.

## 2. Set the trade terms for this instrument

Pass the exact market identity and kind to hyperliquidOrderDraft with side, order type and decimal size. For a limit order, compare price and time-in-force. A protective perpetual order requires its trigger and reduce-only intent. Inspect depth, available balance or margin, account mode and fees, then use the returned review or a supported execution route with the authorized venue signer.

## 3. Reconcile the selected account

Save the venue order reference and query the same wallet and venue for open orders and fills. A partially filled limit can have both executed size and an open remainder. Compare the resulting token balance for a spot fill or the position and funding activity for a perpetual. Keep account timestamps when reading successive pages.

## Look up the WOW spot market by instrument kind

```
curl -fsS "https://www.bitpont.com/api/v1/read/hyperliquid.directory?kind=spot&q=WOW"
```

## Tools

- `hyperliquid.directory`
- `viewHyperliquidSpot`
- `viewHyperliquidVenue`
- `hyperliquidOrderDraft`
- `viewHyperliquidAccountActivity`

## Further reading

- [Hyperliquid market and order API](<https://www.bitpont.com/developers/hyperliquid/>)
- [Hyperliquid trading guide](<https://www.bitpont.com/help/hyperliquid/>)
- [Trade perpetuals and inspect funding-rate markets](<https://www.bitpont.com/help/ai-agents/perpetuals-and-funding-rates/>)
- [Sign wallet actions and recover an agent order](<https://www.bitpont.com/help/ai-agents/wallet-signing-and-order-recovery/>)
- [Build an agent portfolio view across wallets and positions](<https://www.bitpont.com/help/ai-agents/portfolio-position-reads/>)
