MarketLab Docs

Examples

Real command examples for sources, studies, and strategies.

Examples

This page focuses on the commands people will actually run first:

  • source
  • study
  • strategy run
  • strategy backtest

All examples below assume:

  • --provider mmt
  • millisecond timestamps at the CLI boundary
  • current provider support limited to MMT

Sources

Orderbook snapshot

cargo run -- source orderbook \
  --provider mmt \
  --exchange bybitf \
  --symbol BTC/USDT \
  --depth 100 \
  --output terminal

Orderbook stream

cargo run -- source orderbook \
  --provider mmt \
  --exchange bybitf \
  --symbol BTC/USDT \
  --depth 100 \
  --stream \
  --min-size 0.1 \
  --price-group 1 \
  --interval-ms 1000 \
  --buffer-size 20 \
  --output terminal

Candles range

cargo run -- source candles \
  --provider mmt \
  --exchange binancef \
  --symbol BTC/USDT \
  --timeframe 60 \
  --from 1779880000000 \
  --to 1779883600000 \
  --output json

Candles stream

cargo run -- source candles \
  --provider mmt \
  --exchange binancef \
  --symbol BTC/USDT \
  --timeframe 60 \
  --stream \
  --output jsonl

VD range

cargo run -- source vd \
  --provider mmt \
  --exchange bybitf \
  --symbol BTC/USDT \
  --timeframe 60 \
  --from 1779620400000 \
  --to 1779624000000 \
  --bucket 1 \
  --output json

VD stream

cargo run -- source vd \
  --provider mmt \
  --exchange bybitf \
  --symbol BTC/USDT \
  --timeframe 60 \
  --bucket 1 \
  --stream \
  --output jsonl

Studies

Spread

cargo run -- study spread \
  --provider mmt \
  --exchange bybitf \
  --symbol BTC/USDT \
  --depth 20 \
  --output json

Depth

cargo run -- study depth \
  --provider mmt \
  --exchange bybitf \
  --symbol BTC/USDT \
  --levels 20 \
  --output json

Imbalance

cargo run -- study imbalance \
  --provider mmt \
  --exchange bybitf \
  --symbol BTC/USDT \
  --depth 50 \
  --output json

Slippage

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

VAMP

cargo run -- study vamp \
  --provider mmt \
  --exchange bybitf \
  --symbol BTC/USDT \
  --depth 100 \
  --dollar-depth 250000 \
  --output json

CVD

cargo run -- study cvd \
  --provider mmt \
  --exchange bybitf \
  --symbol BTC/USDT \
  --timeframe 3600 \
  --from 1779620400000 \
  --to 1779624000000 \
  --bucket 1 \
  --output json

Strategy Run

Live SMA crossover

cargo run -- strategy run sma-crossover \
  --provider mmt \
  --exchange bybitf \
  --symbol BTC/USDT \
  --timeframe 60 \
  --output terminal

Live SMA crossover with warmup anchor

cargo run -- strategy run sma-crossover \
  --provider mmt \
  --exchange bybitf \
  --symbol BTC/USDT \
  --timeframe 60 \
  --from 1779887295785 \
  --output jsonl

Strategy Backtest

Historical SMA crossover

cargo run -- strategy backtest sma-crossover \
  --provider mmt \
  --exchange bybitf \
  --symbol BTC/USDT \
  --timeframe 60 \
  --from 1779660000000 \
  --to 1779705600000 \
  --fast 20 \
  --slow 50 \
  --confirm-bars 1 \
  --output terminal

Historical SMA crossover JSON

cargo run -- strategy backtest sma-crossover \
  --provider mmt \
  --exchange bybitf \
  --symbol BTC/USDT \
  --timeframe 60 \
  --from 1779660000000 \
  --to 1779705600000 \
  --fast 20 \
  --slow 50 \
  --output json

On this page