Market LabDocs

Quickstart

Authenticate providers, inspect market data, run a backtest, and preview execution.

Local Development

The CLI currently lives in the Rust repository.

Basic flow:

mlab --help

If you use the MMT provider, store an API key:

mlab auth set mmt

Public BULK market data needs no credential. To use account or execution commands, authorize a BULK agent wallet:

mlab auth set bulk

This stores the agent credential in the operating system keychain. The main wallet private key is used only through the hidden authorization prompt and is not stored.

First Useful Commands

Inspect BULK trading rules locally:

mlab markets --exchange bulk
mlab markets --exchange bulk --symbol BTC/USDT

MMT source example:

mlab source orderbook --provider mmt --exchange bybitf --symbol BTC/USDT --depth 100 --output terminal

BULK source example:

mlab source orderbook --exchange bulk --symbol BTC/USDT --depth 100 --output terminal

MMT uses --provider mmt --exchange <exchange>. Standalone BULK uses --exchange bulk without a provider flag.

Current study example:

mlab study slippage --provider mmt --exchange bybitf --symbol BTC/USDT --side buy --notional 100000 --depth 100 --output json

Current strategy example:

mlab strategy run twap BTC/USDT --exchange bulk --side buy --margin 100 --leverage 5 --duration 300 --interval 60 --dry-run

Remove --dry-run to confirm and deploy TWAP as a detached mlabd job. Read TWAP first; the current implementation uses market child orders.

Current script backtest example:

mlab script backtest ./scripts/sma-cross.js --symbol BTC/USDT --from 1704067200000 --to 1704667200000 --source candles@bybitf@mmt:timeframe=60 --param fast=20 --param slow=50 --param margin=1000 --param leverage=5 --output json

script backtest runs ctx.trade and ctx.cancel against the historical simulator. It never signs or submits a live order.

Deploy an analysis-only live script:

mlab script run ./scripts/candle-summary.js --symbol BTC/USDT --source candles@bulk:timeframe=5

The command returns a job ID. Inspect the worker with:

mlab script jobs
mlab script status <JOB_ID>
mlab script logs <JOB_ID> --follow

View script runtime reports:

mlab script runs list
mlab script runs show <run-id>

Preview a normalized Bulk trade without signing, submitting, or starting the execution daemon:

mlab trade long BTC/USDT --margin 10 --dry-run

Inspect account state:

mlab positions
mlab orders
mlab fills

Read Execution before removing --dry-run.

Read Strategies before submitting a built-in execution strategy.

Read Script Execution before adding --venue bulk to a live script.

Milliseconds First

Market Lab uses milliseconds at the app boundary.

That means values like:

  • --from
  • --to
  • ts_ms

should be treated as millisecond-oriented when using the CLI.

Providers may use other units internally. Market Lab handles that conversion.

On this page