MarketLab Docs

Concepts

Understand the core Market Lab model before using individual commands.

Concepts

Market Lab is organized around three layers:

  • source: raw market data access
  • study: computed market metrics built on top of market data
  • strategy: logic that consumes a time series and emits live events or backtest summaries

This separation matters because it keeps the CLI predictable.

Source

source commands expose provider data directly.

Examples:

  • source orderbook
  • source candles
  • source vd

Use source when you want:

  • current market state
  • raw or lightly-normalized time series
  • streaming updates from a provider

Study

study commands compute market structure or execution metrics from source data.

Examples:

  • study spread
  • study depth
  • study imbalance
  • study slippage
  • study vamp
  • study cvd

Use study when you want:

  • execution cost estimates
  • liquidity shape
  • orderbook imbalance
  • derived statistics that are more useful than raw provider output

Strategy

strategy commands consume time-series data and evaluate logic over it.

Current example:

  • strategy run sma-crossover
  • strategy backtest sma-crossover

There are two modes:

  • run mode for live evaluation
  • backtest mode for historical evaluation

Run mode returns event-oriented output.

Backtest mode returns summary-oriented performance output.

Time Model

Market Lab uses milliseconds at the app boundary.

That means --from, --to, and ts_ms are millisecond-oriented in the CLI and JSON outputs.

Some providers, such as MMT, accept seconds over their API. Market Lab converts to provider-native units only at the adapter boundary.

Output Modes

The CLI is designed for both humans and machines.

  • terminal: compact human-readable output
  • json: machine-readable output
  • jsonl: stream-friendly machine-readable output

For study and strategy, default JSON is compact. Add --verbose if you want expanded context.

On this page