Skip to content

Aggregation action

Use this action with change({ id: 'Aggregation', context }).

Context

  • id?: Get | Update (Update is assumed if omitted)
  • aggregation fields for Update:
    • unit: Tick | Intraday | Day | Week | Month | Quarter | Year
    • size: number
    • spec: None | Nearest | Continue | PerCount | PerVolume | PerRange | PerSeconds | TopOfBook
    • isContractVolume: boolean
    • dividendsAdjust: boolean
    • backAdjust: boolean
    • daysToExpiration: number
    • contractRoll: expiration | combined

Behavior

Aggregation supports two sub-actions:

  • Get: returns the current aggregation object in the same shape as aggregation Update fields.
  • Update: merges provided aggregation fields into the current aggregation.

Only provided fields are changed.

TopOfBook is a specialized tick aggregation which fetches historical quote rows (best bid, best ask and their sizes) instead of the usual trade-based tick shape. It is primarily meant for consumers which read the raw container data directly, such as historical tables, and is not intended for normal chart visualization.

Example (Get):

const currentAggregation = chart.change({
id: "Aggregation",
context: { id: "Get" },
});