Execution
Preview, submit, inspect, cancel, and close Market Lab orders.
Use mlab trade for a direct order. Built-in strategies, bots, and scripts use the same execution layer.
Before You Trade
- Configure the venue in Authentication.
- Refresh its market snapshot with
mlab markets --exchange <exchange> --refresh. - Start with
--dry-run.
mlab auth status
mlab daemon statusVenues
| Venue | Market | Network |
|---|---|---|
bulkf | BULK perpetuals | Mainnet; --testnet for testnet |
hyperliquid | Hyperliquid Spot and HIP-4 outcomes | Mainnet; --testnet for testnet |
hyperliquidf | Hyperliquid core and HIP-3 perpetuals | Mainnet; --testnet for testnet |
hyperlink | HyperLink Spot execution | Mainnet only |
hyperlinkf | HyperLink core and HIP-3 perpetual execution | Mainnet only |
BULK and Hyperliquid use mainnet by default; add --testnet for their testnets. HyperLink has no public testnet and reuses Hyperliquid's public Spot and perpetual market snapshots.
HIP-3 uses the same hyperliquidf venue as core perpetuals. Put the DEX in the symbol, such as xyz:TSLA. See Hyperliquid Market Data for discovery and HyperLink Execution for its execution-only boundary.
Dry Run
mlab trade long BTC \
--venue hyperliquidf \
--margin 100 \
--leverage 5 \
--dry-runA dry run validates the market, amount, price rules, and available account information. It does not sign or submit an order.
Perpetual Order
Perpetuals use the base symbol:
mlab trade long BTC \
--venue hyperliquidf \
--margin 100 \
--leverage 5Use long to buy exposure and short to sell exposure.
For HIP-3, keep the venue and scope the symbol:
mlab trade long xyz:TSLA \
--venue hyperliquidf \
--margin 100 \
--leverage 5 \
--dry-runRoute a core or HIP-3 perpetual through HyperLink by changing only the execution venue:
mlab trade long BTC \
--venue hyperlinkf \
--margin 100 \
--leverage 5 \
--dry-run
mlab trade long xyz:TSLA \
--venue hyperlinkf \
--margin 100 \
--leverage 5 \
--dry-runConfigure it first with mlab auth set hyperlink. HyperLink's authenticated market metadata determines valid perpetual leverage. Market Lab caches that value in daemon memory and reloads it on demand after restart.
Spot Order
Spot uses the exact pair and buy or sell:
mlab trade buy HYPE/USDC \
--venue hyperliquid \
--margin 100 \
--dry-run
mlab trade sell HYPE/USDC \
--venue hyperliquid \
--size 10 \
--type limit \
--price 45 \
--tif alo \
--dry-runUse --venue hyperlink to route the same Spot pair through HyperLink mainnet.
Spot does not use leverage, reduce-only, attached stop loss, attached take profit, or mlab close.
Outcome Order
Outcome symbols use <outcome-id>:<side>:
mlab trade long \
1009:0 \
--venue hyperliquid \
--margin 100 \
--dry-runlong buys the selected outcome token. short sells tokens already held. Naked outcome shorting is not supported.
See Hyperliquid outcomes for discovery and account actions.
Amount
Every order uses exactly one amount:
| Flag | Meaning |
|---|---|
--size | Exact base-asset or token quantity |
--margin | Collateral budget |
For perpetuals, exposure is approximately margin × leverage before market-rule rounding. For a spot or outcome buy, margin is the quote-token budget.
Order Type
Market order:
mlab trade long BTC --venue hyperliquidf --margin 100 --leverage 5 --type market --dry-runLimit order:
mlab trade short BTC \
--venue hyperliquidf \
--size 0.001 \
--leverage 3 \
--type limit \
--price 65000 \
--tif alo \
--dry-runLimit time-in-force values:
gtc: good until cancelledioc: immediate or cancelalo: add liquidity only
Perpetual Protection
mlab trade long BTC \
--venue hyperliquidf \
--margin 100 \
--leverage 5 \
--sl 63000 \
--tp 69000 \
--dry-run--sl, --tp, --leverage, and --reduce-only are perpetual-only.
Account State
mlab positions --venue hyperliquidf
mlab orders --venue hyperliquidf
mlab fills --venue hyperliquidf
mlab positions --venue hyperliquidf --symbol xyz:TSLAAdd --testnet for BULK or Hyperliquid testnet. Filter with --symbol when needed.
Cancel and Close
mlab cancel BTC <ORDER_ID> --venue hyperliquidf --dry-run
mlab close BTC --venue hyperliquidf --dry-run
mlab close xyz:TSLA --venue hyperliquidf --dry-runclose exits a complete perpetual position with a reduce-only market order. Spot and outcomes must be sold instead.
Non-Interactive Execution
Terminal output asks for confirmation. Automation must add --yes and use structured output:
mlab trade long BTC \
--venue hyperliquidf \
--margin 100 \
--leverage 5 \
--yes \
--output jsonLive signing and order state run through mlabd.