Source data
Access provider-native candles, orderbooks, volume delta, open interest, funding, statistics, and volume through one command surface.
$ mlab source orderbook ...Market Lab is a programmable runtime for market research, execution-aware backtesting, and controlled live trading. Inspect order flow, simulate JavaScript orders, then deploy the same logic as a supervised BULK strategy job.
$ curl -fsSL https://marketlab.sh/install.sh | shmlab script backtest ./btc-momentum.js \--provider mmt --exchange hyperliquid \--symbol BTC/USDT \--from 1780307559000 --to 1780523645331 \--source candles:timeframe=60 \--param candles:fast=20 --param candles:slow=50 \--leverage 5~/.market-lab/runs/01J4BTC9Source, study, strategy, script, and execution share the same market model, validation boundary, and structured output contracts.
Access provider-native candles, orderbooks, volume delta, open interest, funding, statistics, and volume through one command surface.
$ mlab source orderbook ...Compute spread, depth, imbalance, slippage, VAMP, CVD, EMA, and SMA on normalized market data.
$ mlab study slippage ...Run built-in strategy logic live or over a historical range and inspect structured performance summaries.
$ mlab strategy backtest sma-crossover ...Run JavaScript against multiple sources, simulate execution over history, then deploy the same logic as a detached live job.
$ mlab script backtest ./strategy.js ...Validate CLI and scripted orders, attach native protection, and receive account lifecycle events through the isolated daemon.
$ mlab trade long BTC/USDT --dry-run ...Provider access, validation, historical inspection, studies, scripts, and output envelopes live behind one command surface. Your logic stays focused on the market.
Binance spot order books and trades.
candlesorderbookvdoivolumesfundingstatsSearch MMT venues and native BULK markets in one catalog. Provider, venue, native symbol, and Market Lab input remain explicit.
Each command advances the same workflow instead of starting a separate project, notebook, or integration.
mlab sourceConnect market data
mlab studyMeasure the market
mlab strategy backtestTest built-in logic
mlab script backtestSimulate custom execution
mlab script runDeploy a live worker
mlab script logsObserve execution events
Backtests intercept ctx.trade with a historical simulator. Live jobs route the same request through mlabd, with signing and account events kept outside JavaScript.
01 export const script = {
02 name: "ema-cross", version: "1",
03 sources: ["candles"],
04 lookback: 100
05 }
06 export function onData(ctx, input, history) {
07 if (input.source !== "candles@hyperliquid@mmt") return
08 const candles = history.source("candles@hyperliquid@mmt"); if (candles.length < 51) return
09 const fast = ctx.study.ema(candles, {
10 field: "c", window: 20
11 })
12 const slow = ctx.study.ema(candles, {
13 field: "c", window: 50
14 })
15 if (fast.previous <= slow.previous &&
16 fast.latest > slow.latest) {
17 const entry = ctx.trade({
18 key: "ema-cross-" + candles.at(-1).t,
19 position: "open-long", margin: 1000, leverage: 5,
20 order: { type: "market" }
21 })
22 return { metrics: {order_id: entry.id } }
23 }
24 }
25 export function onExecution(ctx, event) {
26 return { metrics: {event: event.type, order_id: event.orderId } }
27 }A compact surface for the recurring work behind quantitative research and market-structure analysis.
Market Lab is infrastructure for technical market participants, not another dashboard to watch.
Build, test, and inspect strategy logic without moving between notebooks, scripts, and dashboards.
Measure spread, depth, imbalance, VAMP, and slippage directly against the orderbook.
Give agents compact JSON, deterministic commands, and a constrained runtime they can operate programmatically.
Market Lab is public and licensed under AGPL-3.0. The current runtime covers market data, studies, JavaScript scripting, live evaluation, backtesting, and controlled BULK execution. Public market data stays behind the provider boundary, while signing and live order routing remain isolated inside mlabd.
Install Market Lab and go from market data to reproducible tests and validated execution in one runtime.