Market LabDocs

Scripting

Write local JavaScript scripts for Market Lab.

Market Lab scripting lets you write JavaScript over normalized live and historical market data.

Market Lab owns provider access, market data loading, validation, simulation, execution routing, and output envelopes. Your script owns the market logic and decides when to call ctx.trade, ctx.order, or ctx.cancel.

Use script backtest to run execution calls against the historical simulator. Use script run to deploy a detached live job, and add --venue bulkf, --venue hyperliquidf, a HIP-3 venue such as --venue hyperliquidf-io, or --venue hyperlinkf only when that job should execute real perpetual orders. Hyperliquid defaults to mainnet; add --testnet for testnet. HyperLink is mainnet-only. Custom Spot scripts use --venue hyperliquid.

Standalone Binance Spot and USD-M perpetual futures can provide historical candles and candle-derived volume bars to script backtest without an API key. Use selectors such as btc@candles@binancef:timeframe=60; do not add @mmt unless you want the separate MMT route.

Start here: