Events API
Events are subscribed on the widget or controller and always return an unsubscribe function; payload types on this page are what your handlers receive.
Search 69 supported events contracts below. Expand a result to see its TypeScript declaration, properties, methods, parameters, return values, and errors. Share a filtered URL or a symbol anchor when another engineer needs the same contract.
Start here
ChartEvent— Typed envelope delivered to chart event subscribers, pairing an event type with the payload shapeChartEventPayloadMapassigns to it.WidgetEvent— Event envelope delivered by the widget-level bus (widget.on(...)and the widgetonEventoption).- Event families and subscription guidance
Browse the reference
Classes 1
Controller behind the market-events API: merges built-in, provider-supplied, and host-registered event types into one catalog, owns the event store (host CRUD alongside provider refresh and live-subscription state), validates every event against its declared type, and reports event changes, catalog changes, provider errors, and event-center visibility through host callbacks. Every public method is gated by a direct-controller authorization lease that
destroy() releases.Interfaces 39
What an alert watches: a condition kind plus its kind-specific fields (price level, percent move, drawing id, indicator plot, or TradeScript expression) and an optional evaluation interval.
One alert record: the condition it watches plus lifecycle, delivery, presentation, and grouping fields. Passed to the alert CRUD APIs and carried on trigger events.
Scope selector for bulk alert operations (
ChartApi.setAlerts/getAlerts/clearAlerts).Partial update applied to an existing alert; only the supplied fields change, and the nullable timestamp fields (
expiresAt, triggeredAt) accept null to clear their current values.Pluggable persistence + evaluation backend for alerts — the datafeed-parallel seam. Every method is optional; omit the provider and the SDK evaluates simple
price-* conditions against the loaded symbol with its built-in evaluator. A real provider owns account-level persistence, cross-symbol quote subscriptions, expression evaluation, and out-of-app delivery. The SDK calls it optimistically (CRUD returns synchronously) and reconciles from AlertProvider.subscribe.Feature options for the built-in alerts surface; currently controls whether the price-axis "Add alert" gesture (axis context menu or the Alt/Option+A shortcut) creates a price-level alert relative to the current price.
On-chart presentation of an alert: the horizontal level line and the right-axis price flag, including the color used once the alert has fired.
Context carried by the
alert-trigger event and by provider triggered callbacks.Payload of the
autosave-needed event, emitted after the configured auto-save delay once tracked chart changes accumulate; carries the full chart-layout and chart-state snapshots the host should persist.Feature gates for the built-in indicator surface: whether it is enabled, which catalog entries are shown, hidden, or disabled, and whether the settings and style editors are exposed.
Animation options accepted by viewport moves such as
scrollToRealTime, zoomAtTime, zoomAtBar, and zoomAtCoordinate. Controls how long the animated transition runs.Immutable projection bound to one explicit pane and price scale. Unlike the removed global conversion aliases, a coordinate space cannot project against an implicit pane or scale.
Payload of the
chart-drag-export event, fired on a browser dragstart from the chart surface when dragExportEnabled is set; pairs the pointer position with DataTransfer helpers so the host can populate the drag with exported chart data.Normalized error record used across the SDK for datafeed, engine, and widget failures; delivered to hosts through the
data-error event and error-bearing results.Typed envelope delivered to chart event subscribers, pairing an event type with the payload shape
ChartEventPayloadMap assigns to it.Maps every
ChartEventType to its payload shape, so ChartApi.on handlers and the widget event bus receive fully typed payloads.A pixel coordinate on the chart surface, used by coordinate conversion and as the anchor point of zoom operations in
VisibleRangeChangePayload.Options for
ChartApi.scrollToTime and scrollToBar: the inherited animation duration plus where the target lands in the viewport.Serializable snapshot of one chart's full public state, returned by
getState, applied via setState, and carried by the ready event and autosave payloads. Every field is optional so a snapshot carries only the facts it describes.Exact revision domains changed by one controller-owned canonical mutation.
Payload of the
dialog-state-change chart event, emitted when a built-in SDK dialog opens or closes.Object form of the
drawingTools feature setting controlling which native drawing tools are available: an overall enable switch plus show, exclude, and disable lists with per-tool disabled reasons.Payload of the
hover-object-change chart event, emitted when the pointer moves onto a different chart object or leaves the hovered object.Constructor wiring for
MarketEventsController: the chart-context accessor it builds provider requests from, providers to register immediately, and the host callbacks it reports events, catalog changes, provider errors, and center visibility through.One pane-height assignment in a
setPaneHeights batch; the controller validates each entry and applies the batch through the engine.Payload of the
pane-layout-change chart event, emitted after a pane resize or state mutation actually changes the layout; extends the base layout payload with the pre-change snapshot.Snapshot of one pane in the chart's vertical pane layout, as returned by
getPaneLayout and carried on pane layout events.Base payload for pane layout events: the full post-change layout plus which pane or panes the mutation targeted.
Per-pane mutation the controller sends to the engine when resizing or changing the state of one pane (
setPaneHeight, maximizePane, minimizePane, restorePane).Inclusive min/max price interval. Used by
PriceScaleSettings.visiblePriceRange to pin the price axis to a fixed range.Payload of the chart's
trading-intent event, describing a user-initiated trade intent raised from chart surfaces such as shortcuts or the price axis so the host can act on it.Current undo/redo availability, returned by
getUndoRedoState and emitted with the undo-redo-state-change event so hosts can enable or disable their own undo/redo controls.Visible viewport range expressed in bar indices, returned by
getVisibleBarRange and carried by visible-range change notifications.A
VisibleBarRange whose store-owned price summary is guaranteed present, used where viewport facts are snapshotted together with their price summary.Visible viewport range expressed as start and end timestamps, used by
setVisibleRange/getVisibleRange and carried by visible-range change notifications.Event envelope delivered by the widget-level bus (
widget.on(...) and the widget onEvent option). Chart events carry the emitting chartId; workspace and widget lifecycle events do not. ChartApi.on(...) keeps delivering raw chart events.Payload of the widget-rail change notification, pairing the rail state before and after the transition.
Optional state patch applied by
openWidgetRailPanel when opening a rail panel: any WidgetRailState field (such as width, collapsed, or metadata) except visible and activePanelId, which the open call sets itself.State of the right-hand widget rail (visibility, active panel, sizing), returned by
getWidgetRailState, replaced wholesale by setWidgetRailState, and persisted with chart state.Functions 1
Builds a validated custom market event type descriptor: derives the canonical id
custom:<sourceId>:<typeId>, stamps kind: 'custom', and validates the required fields, detail-field declarations, and marker style, throwing a validation SdkError on any issue.Type aliases 27
A delivery hint the host/provider acts on. The SDK never sends email/sms itself.
What an alert watches.
price-* and percent-change are evaluated by the SDK's built-in evaluator against the loaded symbol; drawing-cross / indicator / expression are evaluated by an injected AlertProvider. expression carries TradeScript source, so any boolean the language can express becomes an alert — the same condition a strategy's alert.condition(...) emits.How often an armed alert may fire.
Callback an
AlertProvider.subscribe implementation invokes to push provider-driven events — out-of-band alert creates/updates/removes and provider-evaluated triggers — back into the SDK.Event pushed through an
AlertProvider subscription: a created/updated/removed change carrying the affected alert record, or a triggered event carrying the full AlertTriggerContext.Lifecycle state of an alert. Provider/host-driven; the SDK renders it.
Category of chart change that marks the chart dirty for auto-save, accumulated into
AutoSaveNeededPayload.reasons: symbol/interval switches, drawing, indicator, and comparison edits, display-settings and customization changes, price-scale changes, drag exports, pane order/layout changes, and template application.Which internal element of a pane
ChartApi.getChartDom returns.Well-known machine-readable values for
ChartError.code: the three datafeed operations (loadBars, searchSymbols, resolveSymbol), engine support, widget mount/destroyed lifecycle, agentic and symbol-link attachment, validation, and unknown failures.Severity ladder for
ChartError, from 'info' through 'warning' and 'error' to 'fatal'.Names the subsystem that raised a
ChartError: the datafeed, chart engine, widget shell, controller, an adapter, or customer (host) code.Callback signature for
ChartController.on and ChartApi.on subscriptions; receives the typed ChartEvent for the subscribed event type.Union of every event name a chart can emit — lifecycle, data, viewport, objects, layout, trading, market events, workers, and more — used as the key type for
ChartApi.on subscriptions and ChartEventPayloadMap.Discriminated payload of the
object-change chart event, describing one content mutation by kind: a drawing created/patched/removed, a generic object patched/removed, a comparison added/removed, a price-scale slot layout change, or an object-provider registration change.SDK-owned cause for a canonical state mutation that has no narrower public event.
Value of the
drawingTools feature option: a plain array of drawing tool ids acts as an allow-list of the tools to show, while a DrawingToolFeatureOptions object gives full enable/show/exclude/disable control.Display state of a chart pane:
normal, maximize (the pane expands to fill the chart), or minimize (the pane collapses to its header and values row).What candle-pane auto-scale fits:
visible-sources includes visible same-pane indicators, while main-series fits only the main price series.Visibility policy for the price-scale currency/unit header:
alwaysOn keeps it shown, alwaysOff hides it, and onMouseOver reveals it on hover.Default price-scale placement for indicators that do not request one:
balanced picks the side with fewer existing scales, left and right force a new axis on that side, and main-series shares the main series scale.Price-axis interaction mode:
locked keeps the axis auto-fitted and blocks manual y-scaling, while free lets the user drag and scale the axis.Stop a live SDK subscription.
Callback signature for widget-level event subscriptions (
widget.on(...) and the widget onEvent option); receives the typed WidgetEvent envelope for the subscribed type.Maps each widget event type to its payload type; identical to
ChartEventPayloadMap because the widget-level bus re-delivers chart events in its envelope.Origin of a widget-bus event:
'chart' for per-chart events (which carry a chartId), 'workspace' for multi-chart workspace events, or 'widget' for widget lifecycle events.Event-type union accepted by the widget-level event bus; identical to
ChartEventType.Identifier of a panel hosted in the right-hand widget rail: a built-in id (
'watchlist', 'details', 'data-window', 'news', 'market-depth', 'account-manager', 'order-ticket') or any other string for a host-defined panel.Constants 1
Catalog of the SDK's built-in market event types — news, company-calendar, corporate-action, market-structure, futures-lifecycle, and economic-calendar entries — each carrying its default marker style, group, ordering, default visibility, and applicable asset types. Seeded into every
MarketEventsController and used to validate built-in descriptors.Related pages
- Chart Events — the event families in prose, with subscription and cleanup guidance
- Chart Controller — the operations that emit these payloads
- Alerts — the alert lifecycle behind the alert event family