Market LabDocs
ScriptingSources

Sources

Market data sources and exact runtime selectors for Market Lab scripts.

Sources

The manifest declares base source kinds. Runtime flags bind those kinds to concrete providers and exchanges.

--source <selector>:<key>=<value>

Selectors

MMT is a multi-exchange provider, so its selector includes both exchange and provider:

--source candles@binancef@mmt:timeframe=60
--source candles@hyperliquid@mmt:timeframe=30
--source oi@binancef@mmt:timeframe=60

BULK remains its own exchange selector even when it is combined with MMT data:

--source orderbook@bulk:depth=20
--source candles@bulk:timeframe=5

There are no script-level --provider or --exchange flags. The source selector contains that information. This lets one script consume MMT and BULK, or several MMT exchanges, at the same time.

Example:

mlab script run ./scripts/cross-market.js \
  --symbol BTC/USDT \
  --source candles@binancef@mmt:timeframe=5 \
  --source candles@hyperliquid@mmt:timeframe=5 \
  --source orderbook@bulk:depth=20

The manifest still lists each required base kind once:

export const script = {
  name: 'cross-market',
  version: '1',
  sources: ['candles', 'orderbook'],
  params: {},
}

Market Lab validates that every configured kind appears in script.sources and that every manifest kind has at least one concrete selector.

Runtime Access

Use the same exact selector with history.source:

const binance = history.source('candles@binancef@mmt')
const hyperliquid = history.source('candles@hyperliquid@mmt')
const bulkBook = history.source('orderbook@bulk', 0)

Market records are not duplicated under input.candles, input.sources, or input.data. input carries metadata:

input.source // exact selector that triggered this hook
input.source_type // base source kind
input.source_configs['candles@binancef@mmt'].timeframe_sec

Available sources:

SourceMMT backtestMMT liveBULK backtestBULK live
candlesYesYesYesYes
orderbookYesYesNoYes
vdYesYesNoYes, trade-derived
oiYesYesNoYes, snapshots
volumesYesYesYesYes

Config keys:

SourceConfig
candlestimeframe
orderbookbacktest: timeframe, optional depth; live: optional depth
vdMMT: timeframe, bucket; BULK live: neither
oiMMT: timeframe; BULK live: no timeframe
volumestimeframe

The timeframe value is always an integer number of seconds. Support for arbitrary intervals is specific to live candles; other time-series sources and historical data retain provider-supported intervals.

See Source History for list/index semantics and Candles Source for live aggregation details.

On this page