ScriptingData Types
Data Types
JavaScript data shapes passed into Market Lab scripts.
Data Types
Script data types are organized by source.
Shared script pieces:
ctx: validated runtime context for your scriptinput: source-specific market data payload- return value:
{ metrics, meta? } | null
Source references:
Context
type StudyContext = {
inputs: Record<string, string | number | boolean>
}ctx.inputs contains values declared in the script manifest and passed through --input.
Example:
export function onData(ctx, input) {
const minVbuy = ctx.inputs.min_vbuy
}Script input names cannot reuse Market Lab runtime flag names such as provider, exchange, symbol, timeframe, from, to, stream, output, or verbose.
Return Type
Study hooks return:
type StudyReturn = {
metrics: Record<string, unknown>;
meta?: Record<string, unknown>;
} | nullReturn null when the hook has nothing to emit.
metrics must be JSON-serializable.
Do not return functions, undefined, circular objects, orders, signals, or intents from a study script.