Concepts
Understand the core Market Lab model before using individual commands.
Concepts
Market Lab is organized around four command layers:
source: raw market data accessstudy: computed market metrics built on top of market datastrategy: logic that consumes a time series and emits live events or backtest summariesscript: local JavaScript logic over Market Lab data sources
This separation matters because it keeps the CLI predictable.
Source
source commands expose provider data directly.
Examples:
source orderbooksource candlessource vdsource oisource volumes
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 spreadstudy depthstudy imbalancestudy slippagestudy vampstudy 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-crossoverstrategy 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.
Script
script commands run local JavaScript inside the CLI.
Scripts are not split into study scripts and strategy scripts. The script result determines how Market Lab can use it:
- metrics-only output is analysis-oriented
signalorintentoutput is strategy-like and can be backtested
Current script commands:
script runscript backtestscript runs listscript runs show
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 outputjson: machine-readable outputjsonl: stream-friendly machine-readable output
For study and strategy, default JSON is compact. Add --verbose if you want expanded context.