Skip to main content

Advanced API

These contracts expose diagnostics, worker ownership, computation, and caching below the primary SDK surface. Reach for them only when the documented product APIs cannot express the need — they assume you already know which boundary you are stepping past.

Search 101 supported advanced 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

Browse the reference

Classes 2

Framework-agnostic core that decides which armed alerts fire for each price observation, honouring level versus transition semantics, AlertFrequency, expiry, and re-arming. It handles only the built-in price conditions (price-above, price-below, the price-cross variants, and percent-change) and has no dependency on the chart engine, DOM, or datafeed.
Incremental footprint aggregator for live tape: add buckets each trade into a bar (by intervalMs) and a price row (by rowSize), and getBars materializes sorted bars with delta, cumulative delta, POC, imbalance flags, and value area on demand. Renderer-agnostic and side-effect free.

Interfaces 50

Evaluates condition kinds the built-in evaluator cannot (e.g. expression).
A fire produced by the evaluator on a given tick.
A single price observation fed to the evaluator.
A cell position in the data grid, expressed as zero-based row and column indices.
Input to nextChartDataGridCell: the pressed navigation key, the currently active cell, the grid dimensions, and optional Ctrl/page-size modifiers.
One resolved table column: the exported field descriptor paired with its index into the export's schema and data arrays.
One flattened leaf in the projected chart-engine style payload: the engine style path, the value sent to the engine, and the native display-setting fields that produced it.
Attribution for a projected engine style value back to one native display-setting field: its path and effective value, plus the snapshot source and index when the inspection ran over tracked snapshots.
Full inspection result for chart display settings: the final settings snapshot, effective leaf fields, per-field change history across snapshots, native runtime ownership per field, the exact engine-style projection with source attribution, and contract diagnostics.
The exact chart-engine style payload projected from a set of display settings, plus the same payload flattened into path-ordered fields with native source-field attribution and contract diagnostics for the input settings.
Options for display-settings projection; the active main-series chart type drives conditional projections such as the high-low last-price rule.
One captured display-settings state: a host-defined source label identifying the precedence boundary plus the effective ChartDisplaySettings captured from the native chart controller at that point.
Tracker that records labeled display-settings snapshots at host-defined precedence boundaries and resolves them on demand into effective fields, ownership, engine-style projection, and diagnostics; dispose stops chart-event observation and is safe to call repeatedly.
Options for createClientAlertEvaluator: the datafeed used to stream per-symbol real-time bars, plus an optional persistence store, streamed interval, and custom evaluators for non-built-in condition kinds.
Native runtime ownership report for one customization or display-settings field: which subsystem consumes the value, whether it is applied unconditionally, conditionally, host-owned, state-only, or unknown, and a human-readable explanation.
One recorded change to a customization field from a tracked snapshot: the field path, the value set or cleared, and which snapshot (by source label and index) contributed it.
Change history for one customization field across all tracked snapshots, together with the contribution that currently wins.
One contract violation found while validating customization or display-settings state: what rule was broken, where, how severe it is, what was expected, and the offending value.
One captured customization state: a host-defined source label identifying the precedence boundary plus the effective CustomizationState captured from the native controller at that point.
One flattened leaf in the engine style payload projected from customization state: the engine style path, the projected value, and the native customization fields that produced it.
Attribution for a projected engine style value back to one native customization field: its path and effective value, plus the snapshot source and index when the inspection ran over tracked snapshots.
Inspection result for customization state: the final controller-produced state snapshot, effective leaf fields ordered by path, per-field change history across snapshots, native runtime ownership per field, and contract diagnostics.
The exact chart-engine style payload projected from a customization state for a given chart type, plus the same payload flattened into path-ordered fields with native source-field attribution.
Options for customization style projection; the required active main-series chart type drives conditional native style projections.
Contract report for one drawing tool's style customization: whether the tool id exists in the native catalog, the renderer-backed style and metadata paths it supports, and diagnostics for unsupported or invalid fields.
Options for drawing-style contract inspection; path overrides the root path used in diagnostics, which defaults to drawingStyles.<toolId>.
The winning contribution for a customization field — a CustomizationFieldContribution narrowed to kind: 'set', since a field with an effective value must have been set by some snapshot.
Per-bar footprint data consumed by the runtime.
Configuration for the footprint engine: rowSize (price covered by one ladder row) and intervalMs (bar interval in ms) define bucketing, while imbalanceRatio (default 3), imbalanceMinVolume (default 0), valueAreaRatio (default 0.7), and the builder-only maxBars retention cap tune the derived reads.
One price row in a bid/ask footprint bar.
One aggressor-tagged trade fed to the footprint engine, as derived from time and sales.
Contract report for a built-in indicator's default settings: whether the indicator id exists in the native catalog, its supported input ids, style ids and style aliases, and diagnostics for unsupported or invalid default fields.
Options for built-in indicator default inspection; path overrides the root path used in diagnostics, which defaults to indicatorDefaults.<indicatorId>.
Contract report for a built-in indicator properties patch: whether the indicator id exists in the native catalog, its supported input ids, style ids and style aliases, and diagnostics for unsupported or invalid patch fields.
Options for built-in indicator properties-patch inspection; path overrides the root path used in diagnostics, which defaults to indicatorProperties.<indicatorId>.
Configuration for the in-memory alert store, currently just an optional seed list of alerts present at creation.
One named color ramp from the liquidity-heatmap palette registry, mapping normalized intensity to a color via evenly spaced RGB stops interpolated linearly.
Configuration for the localStorage-backed alert store: the storage key the alert list is serialized under and an injectable storage backend for non-browser or test environments.
Market metadata and formatting inputs for the P&L display-mode helpers; pipSize and minTick are required by the pips and ticks modes respectively, and precision controls fraction digits.
The facts needed to derive unrealized P&L when a broker does not publish it: position side, quantity, average entry price, and current market price.
One session's computed volume profile: the per-row volume ladder plus the derived POC, value area, buy/sell totals, and naked-POC status.
TPO (Time Price Opportunity) / Market Profile — pure engine + data contract. Bars are grouped into sessions (UTC-aligned windows, default one day) and each session into fixed-length letter blocks (default 30 minutes). A bar stamps its block's letter on every price row its low–high range touches. From the stamped rows the engine derives the classic profile read-outs: POC, 70% value area (CBOT two-row expansion), initial balance, single prints, and naked-POC tracking across sessions. Lives in the lib layer (like LiquidityHeatmap) so MarketProfileView can compute profiles straight from the chart's own data list; the SDK re-exports everything for host-side use.
Configuration for buildTpoProfiles: the price row size and letter-block length in minutes, plus optional session length (default one UTC day), value-area coverage ratio (default 0.7), and initial-balance block count (default 2).
One session's computed TPO (Market Profile) read-out: the stamped price rows plus the derived POC, value area, initial balance, single prints, and naked-POC status.
One price row of a TPO profile, listing which letter blocks printed on it and how many.
Options for createTradeScriptAlertEvaluator: the injected function that evaluates a TradeScript boolean expression against the latest bar context, wired to the host's language runtime (for example the WASM runtime).
The computed virtualisation window: the row index range to actually render and the spacer heights that keep the scrollbar accurate.
Input to virtualChartDataTableWindow: the table's total row count, the current scroll offset, the viewport and row heights in px, and an optional overscan.
Volume profile — pure engine + data contract for the session-anchored volume profile layer and the visible-range (VPVR) profile. Bars are grouped into sessions (UTC-aligned windows, like the TPO engine) and each bar's volume is spread across the price rows its low–high range touches in proportion to how much of the range each row covers. When bars carry takerBuyVolume the same share of every row is credited as aggressive buying, giving renderers a buy/sell split. From the rows the engine derives the volume POC, the value area (CBOT two-row expansion, volume-weighted), and naked-POC tracking across sessions. Lives in the lib layer (like MarketProfile) so SessionVolumeProfileView and VisibleRangeProfileView can compute straight from the chart's own data list; the SDK re-exports the builders for host-side use.
One price row of a volume profile, carrying the total and aggressive-buy volume attributed to it.

Functions 41

Builds bid/ask footprint bars from a batch of aggressor-tagged trades in one pass, by feeding a fresh FootprintBuilder and materializing its bars. Pure and side-effect free.
One aggregated profile over the given bars — the visible-range (VPVR) read.
Builds one TPO (Market Profile) profile per session from the given bars: bars are grouped into UTC-anchored sessions and letter blocks, each bar's block is stamped on every price row its low-high range touches, and the classic read-outs (POC, value area, initial balance, single prints, cross-session naked-POC status) are derived.
Builds one volume profile per UTC-anchored session from the given bars, spreading each bar's volume across the price rows its low-high range touches in proportion to each row's overlap with that range and deriving the volume POC, value area, buy/sell split (when takerBuyVolume is present), and cross-session naked-POC status.
Money P&L: (price - averagePrice) * direction * quantity. Returns undefined when price or average price is unavailable.
Creates an AlertProvider that evaluates alerts client-side across symbols, even when their chart is not open: it composes a persistence store with per-symbol real-time bar subscriptions and the built-in AlertEvaluator, delegating non-built-in condition kinds to injected evaluators. It declares evaluates: true so the chart's in-chart evaluator stands down and nothing double-fires.
Evict the oldest-written series first, regardless of access.
A browser IndexedDB-backed BarCacheStore: persistent across reloads, with per-interval TTL and a pluggable per-(series,interval) eviction policy (LRU by default). Falls back to an inert no-op store when IndexedDB is unavailable (SSR/node without a polyfill), so it is always safe to construct.
Creates a non-persistent AlertProvider store that keeps alerts in memory, assigns ids and an armed default status on create, and emits created, updated, and removed events so multiple views stay in sync. It only stores alerts; condition evaluation belongs to the chart's built-in evaluator or createClientAlertEvaluator.
A dependency-free in-memory BarCacheStore with per-(series,interval) eviction. Default for the memory policy and a test double for the persistent stores. Enforces TTL on read and a pluggable eviction policy (LRU by default) on write.
Evict the least-frequently-accessed series first (ties broken by recency).
Creates an AlertProvider store persisted as JSON in localStorage (or an injected storage backend) under a configurable key, emitting created, updated, and removed events; storage read or write failures degrade silently so alerts stay session-only. It is the drop-in upgrade path from an app-local localStorage alert engine and never evaluates conditions.
Evict the least-recently-accessed series first (default).
Creates an AlertConditionEvaluator for expression alerts that delegates each check to an injected TradeScript expression runner, keeping the SDK decoupled from the language toolchain and WASM runtime. Alerts without an expression, and evaluator throws, are treated as not triggered.
In-memory controller for the right-hand widget bar rail. Owns rail visibility and active-page state so a host only has to render the page bodies it registers (see WidgetBarApi).
Render pnlInDisplayMode as a signed display string.
Resolve a palette by name; unknown or missing names fall back to thermal.
Validates a built-in indicator's default settings against the native catalog, reporting whether the indicator id is known, the supported input/style ids and style aliases, and diagnostics for unsupported or invalid fields.
Validates a built-in indicator properties patch against the native catalog, reporting whether the indicator id is known, the supported input/style ids and style aliases, and diagnostics for unsupported or invalid patch fields.
Classifies every leaf field of a display-settings object by its native runtime owner, reporting per field whether it is applied, conditional, host-owned, state-only, or unknown, with an explanatory detail.
Projects display settings into the exact native chart-engine style payload and reports each flattened engine field with the display-setting fields that produced it, alongside contract diagnostics for the supplied settings.
Replays an ordered series of chart display-settings snapshots to attribute each effective field to the snapshot source that last changed it, producing per-field change history, runtime ownership classification, the projected chart-engine style payload, and contract diagnostics. Throws a TypeError when any snapshot carries an empty source.
Classifies every leaf field present in a customization state by its native runtime ownership: applied by chart UI or engine wiring, conditionally applied, host-owned, state-only, or unknown. Purely inspects the supplied state; nothing is applied to a chart.
Explains which captured controller state most recently changed each effective customization field. It intentionally does not replay API calls or claim renderer/DOM application; callers supply snapshots from native controller state after each precedence boundary.
Projects the effective customization state resolved from an ordered snapshot series into the exact native chart-engine style payload, attributing each projected style field back to the native customization field, snapshot source, and snapshot index that produced it.
Projects a customization state into the exact native chart-engine style payload for a given chart type, listing every projected engine style field together with the native customization fields that produced its value. Use inspectCustomizationSnapshotStyleProjection instead when snapshot source attribution is needed.
Checks a drawing tool's default style overrides against the native drawing style contract, reporting whether the tool id exists in the drawing-tool catalog, which renderer-backed style and metadata paths it supports, and diagnostics for unsupported or invalid style fields.
Conditions the SDK's built-in evaluator can handle from a raw price stream.
Maps a TPO block index to its profile letter, cycling through A-Z then a-z (52 letters) and wrapping for larger or negative indices.
Map intensity t ∈ [0,1] to an [r,g,b] color along a palette's stops.
Computes the next active grid cell for a keyboard navigation key, clamping movement to the grid bounds; pure and side-effect free, so it can back any grid rendering.
The P&L expressed in the requested display mode: - money — the signed money P&L (quantity-scaled). - pips — favorable price movement in pips: (price - avg) * direction / pipSize. - ticks — favorable price movement in ticks: (price - avg) * direction / minTick. - percentage — favorable price movement as a percent of entry: (price - avg) * direction / avg * 100.
Converts a price to its integer profile row index by flooring price / rowSize, with a tiny epsilon to absorb floating-point error at row boundaries.
Resolves which export fields become table columns, preserving export schema order and remembering each field's original column index for data lookup.
Prefer the adapter-provided unrealizedPnl; otherwise derive it from quotes + average price (the supportPLUpdate: false fallback). price overrides the position's marketPrice.
Converts a profile row index back to its lower-bound price (row * rowSize) — the inverse of priceRow.
Creates a tracker that captures an initial display-settings snapshot from the chart and then records a new snapshot on every display-settings-change event, suppressing events whose payload equals the last captured state. The returned tracker also supports manual capture at host-defined boundaries and must be disposed to stop listening.
Captures provenance from the native customization event stream. The native controller emits a semantic event followed by a duplicate state event, so unchanged snapshots are suppressed while state-only implementations remain observable.
Validates a display-settings object against the native display contract: unknown fields, boolean/string/enum typing, positive-number and percentage ranges, session-visibility shapes, market-event settings, and the metadata bucket. Returns one diagnostic per violation; an empty array means the settings are contract-clean.
Validates a customization state against the native contract, covering top-level buckets, magnet mode, watermark and legend settings, per-tool drawing default styles, per-indicator defaults, and the full chartOverrides and styleOverrides trees. Returns one diagnostic per violation; an empty array means the state is contract-clean.
Computes the virtualised render window for the data table: which row indices to mount for a given scroll position, plus the top and bottom spacer heights (px) that stand in for unmounted rows and preserve total scroll height.

Type aliases 6

The keyboard keys the data grid understands for cell navigation: the four arrow keys, Home, End, PageUp, and PageDown.
Machine-readable code classifying a customization contract violation: an invalid native boolean, enum, number, number array, or object value, or a field unknown to the native contract.
Severity of a customization inspection diagnostic: warning for tolerated issues or error for contract violations.
How the native runtime treats a customization field: applied (always consumed), conditional (consumed when runtime conditions hold), host-owned (the host must act on it), state-only (stored but not applied), or unknown (no registered owner).
Whether a snapshot contribution assigned a value to a field (set) or removed it (cleared).
One aggregated profile with no session identity (visible range / VPVR).

Constants 2

Default map from a requested interval to the smaller source interval synthetic aggregation builds it from when no explicit sourceIntervals rule is supplied — for example 2m/3m from 1m, 2H/4H from 1H, and tick counts like 100T from 50T.
Palette registry: the shipped thermal ramp plus the TradeScript colormap family (matplotlib/seaborn anchor colors). Stops are evenly spaced and interpolated linearly in RGB.
  • Debugging — the bounded diagnostics these utilities support
  • API Catalog — the primary surface to exhaust before reaching here