EngineMarket Data

Market Data

Understand how instruments, observations, session rules, and strategy frames connect.

Market data supplies the observations your strategy uses to make decisions. To explain a result, identify the instrument, the observation time, the data source, and the rules that determined when your strategy ran.

Start with the current SJS bar. Then distinguish it from cached history, a separate historical query, and output produced by an algorithm.

From data to a decision

Market data reaching a strategyThe selected instrument and data settings determine a historical or live input. The session processes observations, applying the rules of its runtime. Frames that reach SJS carry the current bar. Strategy validation and readiness checks determine whether that observation can support a decision.Instrument and data selectionHistorical or live inputSession processingSJS frameStrategy evidenceContract · interval · dates · timezoneProvider history, saved replay bars, or incoming updatesRuntime-specific session rules and strategy cadenceCurrent bar and session contextValidation · sampling rule · readiness · decisionA stored row does not guarantee an SJS invocation.
Conceptual data flow. Historical queries and algorithm calculations have their own data and readiness contracts.

The data surfaces

SurfaceWhat it representsWhat to verify
barThe observation passed to the current strategy invocationRequired fields, timestamp, and sampling policy
context.marketDataThe concrete session's cached market-data viewInstrument keys, coverage, and ordering
context.historicalData(...)A request handled by the session's data adapterBounds, interval support, returned coverage, and future rows
Algorithm or Pine outputDerived values from its producerReadiness, timestamp convention, and availability in execution order

The session's cache is not a universal multi-instrument feed or a guarantee that all requested history is present. The data adapter and session type determine its contents.

Read in order

  1. Getting started: observe frames without requesting trades.
  2. Instruments: select the exact instrument or contract.
  3. Bars and intervals: define timestamps and sampling.
  4. Historical data: inspect coverage and repeatable inputs.
  5. Live data: handle incoming updates.
  6. Sessions and timezones: understand processing boundaries.
  7. Warmup and readiness: establish usable evidence.
  8. Missing and stale data: distinguish gaps from repeated observations.
  9. Debugging: trace the first unexpected stage.

On this page