MarketLab Docs

JSON Output

Compact machine output, verbose mode, and stream-friendly JSONL behavior.

JSON Output

Market Lab has two priorities:

  • good human terminal output
  • compact machine-readable output

Market Catalog JSON

The markets command uses a dedicated --json flag:

mlab markets --provider bulk --json

Full catalog JSON contains:

  • schemaVersion
  • provider
  • sourceUrl
  • fetchedAt
  • markets

Requesting one symbol returns that market object directly:

mlab markets --provider bulk --symbol BTC/USDT --json

Each market contains symbol mapping, status, precision, tick and lot sizes, minimum notional, maximum leverage, order types, and time-in-force values. This output is an embedded rules snapshot, not live market data.

Default JSON

For study and strategy, default JSON is intentionally compact.

That means the default output includes only the fields an agent or script usually needs.

Script JSON follows the same rule: default output stays compact, while runtime reports can be inspected separately with script runs list and script runs show.

Verbose JSON

Add --verbose to include expanded context.

Examples:

mlab study spread --provider mmt --exchange bybitf --symbol BTC/USDT --depth 20 --output json --verbose
mlab strategy backtest sma-crossover --provider mmt --exchange bybitf --symbol BTC/USDT --timeframe 60 --from 1779660000000 --to 1779705600000 --fast 20 --slow 50 --output json --verbose

Stream JSONL

Use jsonl for stream-oriented commands.

Examples:

mlab source candles --provider mmt --exchange binancef --symbol BTC/USDT --timeframe 60 --stream --output jsonl
mlab strategy run sma-crossover --provider mmt --exchange bybitf --symbol BTC/USDT --timeframe 60 --output jsonl

Study Shape

Default compact study JSON contains:

  • type
  • version
  • provider
  • exchange
  • symbol
  • ts_ms
  • stream
  • metrics

Verbose study JSON also includes:

  • inputs
  • meta

Strategy Shape

Run strategy JSON is event-oriented.

Backtest strategy JSON is summary-oriented.

Default compact backtest JSON contains:

  • type
  • version
  • strategy
  • provider
  • exchange
  • symbol
  • ts_ms
  • performance

Verbose backtest JSON also includes:

  • window
  • inputs
  • latest_state
  • reasons

Default compact stream strategy JSON contains:

  • type
  • version
  • strategy
  • provider
  • exchange
  • symbol
  • ts_ms
  • mode
  • signal
  • decision
  • metrics

Script Shape

Script hooks return only the script payload:

  • metrics
  • optional signal
  • optional intent
  • optional meta

Market Lab wraps that payload in command output.

Default script backtest JSON contains:

  • type
  • version
  • provider
  • exchange
  • symbol
  • ts_ms
  • script
  • summary
  • performance
  • params

Verbose script backtest JSON also includes:

  • window
  • closed_trades
  • open_positions
  • latest_output
  • meta

Script Runtime Reports

Script runtime reports are stored locally and can be viewed from the CLI.

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

Runtime report JSON contains:

  • script
  • command
  • provider
  • exchange
  • symbol
  • started_at_ms
  • ended_at_ms
  • duration_ms
  • status
  • limits
  • runtime
  • error

On this page