Storage API
ChartStorageAdapter persists chart workspace state. WidgetLayoutStorageAdapter separately persists the outer panel arrangement of a WidgetLayoutContainer or Trading Terminal. Image storage externalizes inline assets before chart JSON records are saved.
Search 77 supported storage 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
ChartStorageAdapter— Host-implemented persistence boundary, supplied as the widgetstorageoption, that the SDK calls for chart layouts, drawings, templates, user settings, and replay state.WidgetLayoutStorageAdapter— Persistence boundary for WidgetLayoutState, intentionally separate from ChartStorageAdapter.ChartLayout— Serializable multi-chart workspace document — the chart-layout unit saved and loaded by chart storage — holding every chart's configuration plus cross-chart sync settings.WidgetLayoutState— Serialized widget panel arrangement.- Storage quickstart
- Choose a backend integration path
- Choose persisted state
Browse the reference
Classes 2
Widget-owned authority for saved workspace layouts. Chart controllers own chart state; this controller is the only layer allowed to persist or apply a complete workspace layout.
Owns the workspace-layout tab lifecycle. It deliberately reuses the normal
ChartLayout and UserSettingsState storage contracts: layouts remain the source of truth for chart state, while the workspace-scoped user-settings bucket stores only tab order and last active tab.Interfaces 57
Options for applying a saved chart template; currently selects how a drawing template merges with existing drawings (
replace, append, or replace-tool, with tool-scoped templates defaulting to replace-tool).Auto-save behavior for a chart: an
enabled switch (off by default for native SDK callers) and the debounce delayMs applied before the autosave-needed event fires.Host storage hook that externalizes inline image data URLs (image drawings) into hosted URLs before chart layouts, drawings, or templates are persisted, and can advertise a host-controlled upload size limit.
Persistence context handed to
ChartImageStorageAdapter.saveImage, extending the general storage context with which persistence flow triggered the save and the drawing or template involved.One image upload request passed to
ChartImageStorageAdapter.saveImage: the inline data URL to externalize, the drawing that references it, and the persistence context.Return value of
ChartImageStorageAdapter.saveImage, carrying the hosted URL that replaces the inline data URL before chart persistence.Serializable multi-chart workspace document — the chart-layout unit saved and loaded by chart storage — holding every chart's configuration plus cross-chart sync settings.
Lightweight listing entry for one saved chart layout, returned by chart storage
list calls so load dialogs and workspace tabs can render without loading full chart-layout documents.Host-implemented persistence boundary, supplied as the widget
storage option, that the SDK calls for chart layouts, drawings, templates, user settings, and replay state. Every method is optional; what the adapter implements is surfaced to hosts through ChartStorageCapabilities.Reports which persistence operations the configured storage adapter supports, grouped by feature area, so hosts can gate save/load affordances without probing the adapter. Returned by
getStorageCapabilities().Identifying context every storage-adapter request extends, letting host backends scope persistence by user, workspace, chart layout, chart, and symbol/interval. All fields are optional; adapters use whichever their backend keys on.
A saved, reusable bundle of chart configuration — a full chart template, an indicator template, or a drawing template — persisted through the storage adapter and applied via the template APIs.
Constructor options for
ChartWorkspaceLayoutController, naming the workspace whose layout is persisted, the optional storage adapter, and how drawings are persisted alongside layouts.Serializable snapshot of the whole widget workspace, returned by
ChartWorkspaceControllerApi.getState() and accepted by setState(). Pairs the chart layout with any multi-chart grid state.Options for
ChartApi.createIndicatorTemplate, which captures the chart's current indicators as a indicator template. Controls the template's identity and whether the current symbol and interval are stored for restore when the template is applied.Request passed to the chart storage adapter's chart-layout delete operation, identifying the saved chart layout to remove within the ambient
ChartStorageContext.Request passed to the chart storage adapter to delete a saved chart, indicator, or drawing template within the ambient
ChartStorageContext.Request passed to the chart storage adapter to delete persisted user settings within the ambient
ChartStorageContext.Conflict details surfaced in
DrawingSharingState when syncing a shared drawing set detects a newer remote revision that clashes with local edits; the host resolves it by reloading the server copy or keeping (force-saving) the local one.Read/write access granted for one drawing sharing scope, as reported by the chart storage adapter.
Request passed to
ChartStorageAdapter.getDrawingSharingPermissions when resolving per-scope drawing access; it carries only the ambient ChartStorageContext fields and adds nothing of its own.Live sync status of the separately stored drawing set for a chart: the active sharing scope, dirty/sync lifecycle state, revision, per-scope permissions, deletion tombstones, and any pending conflict. Surfaced to hosts and shown in storage UI such as the storage menu.
Persisted drawing bucket exchanged with the drawing storage contract: the drawing snapshot plus the identity it is keyed to (chart, chart layout, symbol, interval), deletion tombstones, sharing scope, and the compare-and-swap revision.
Request passed to
ChartStorageAdapter.subscribeDrawings to stream remote drawing-state changes for one sharing scope within the ambient ChartStorageContext.Request passed to the chart storage adapter's chart-layout list operation. Carries only the ambient
ChartStorageContext fields (user, workspace, chart layout, chart, symbol, interval) and adds nothing of its own.Request passed to the chart storage adapter to list saved templates within the ambient
ChartStorageContext, optionally restricted to one template kind.Request passed to the chart storage adapter to load a persisted drawing set, optionally scoped by chart, sharing mode, migration-compatible line-tool partition, or owning indicator/series source.
Object form of the
loadLastChart chart option: restores the newest saved chart layout from the storage adapter before the initial ready event. Extends ChartStorageContext with an enable switch and a flag to keep the constructor symbol when applying the saved chart layout.Request passed to the chart storage adapter and chart-layout APIs to load one saved chart layout by id within the ambient
ChartStorageContext.Request passed to the chart storage adapter to load the persisted bar-replay state. Carries only the ambient
ChartStorageContext fields and adds nothing of its own.Request passed to the chart storage adapter to load one saved template by id within the ambient
ChartStorageContext.Request passed to the chart storage adapter to load persisted user settings. Carries only the ambient
ChartStorageContext fields and adds nothing of its own.Options for
createLocalChartStorageAdapter, which persists chart layouts, drawings, templates, user settings, and replay state as a single JSON blob under one storage key.Imperative control surface for bar replay on a chart — start-bar picking, playback, stepping, jumping, speed, and persisted state — with every action returning the resulting
ReplayState.Object form of the widget
features.replay flag, selecting which parts of bar replay are available; every switch defaults to enabled.Optional presentation intent applied atomically when replay starts.
Snapshot of a bar-replay session — status, cursor position, and speed — returned by every
ReplayControllerApi action, carried on ReplayEvents, and persisted through the storage adapter.Options for
createRestChartStorageAdapter, which persists chart layouts, drawings, templates, user settings, and replay state against a host backend's HTTP endpoints.REST transport configuration for createRestWidgetLayoutStorageAdapter.
Stable chart-layout identity plus the backend record used to persist that chart layout.
Request passed to the chart storage adapter's drawing save, persisting a chart's drawing state — with optional sharing scope and compare-and-swap revision — within the ambient
ChartStorageContext.Result returned by the storage adapter's drawing save, carrying the new revision used as
baseRevision for subsequent compare-and-swap saves.Request passed to the chart storage adapter's chart-layout save, carrying the serialized chart layout plus the explicit create/update intent within the ambient
ChartStorageContext.Normalized result returned by chart-layout save APIs.
Request passed to the chart storage adapter to persist bar-replay state within the ambient
ChartStorageContext.Request passed to the chart storage adapter to persist a chart, indicator, or drawing template within the ambient
ChartStorageContext.Request passed to the chart storage adapter to persist user settings within the ambient
ChartStorageContext.Save request for one complete WidgetLayoutState snapshot.
Persisted per-user settings snapshot exchanged with user-settings storage adapters and the
getUserSettings/setUserSettings accessors, and emitted with the user-settings-change event.Serialized widget panel arrangement. Persist it as JSON and pass it back via
defaultLayout (or loadPanelArrangement on the handle) to rehydrate the layout container.Persistence boundary for WidgetLayoutState, intentionally separate from ChartStorageAdapter.
Stable identity used to persist one WidgetLayoutContainer panel arrangement.
A named saved chart layout open in the built-in workspace tab strip.
Options for
WorkspaceTabsControllerApi.create and duplicate: the new chart layout's identity, name, starting chart arrangement, and persisted metadata.Event delivered to
WorkspaceTabsControllerApi.subscribe listeners after any tab-strip change, carrying the full tab list and the active tab id.Controller behind the built-in workspace tab strip: enumerates open tabs and saved chart layouts, then creates, activates, duplicates, renames, moves, closes, deletes, and saves them.
Construction options for
WorkspaceTabsController, wiring the workspace, optional storage-backed persistence, auto-save policy, and restore/new-layout behavior.Functions 4
Creates the SDK's default chart storage adapter — a localStorage-backed adapter under the default storage key — so layouts, drawings, templates, user settings, and replay state persist without any host backend wiring.
Creates a chart storage adapter that persists layouts, drawings, templates, user settings, and replay state as a single JSON document in localStorage or a host-supplied storage backend.
Creates a chart storage adapter that persists layouts, drawings, templates, user settings, and replay state against a host REST backend. Construction throws when neither
options.fetch nor a global fetch implementation exists.Creates a REST adapter for WidgetLayoutContainer panel arrangements. This storage family is intentionally separate from ChartStorageAdapter because WidgetLayoutState owns panel topology, not chart content.
Type aliases 13
Names which persistence flow triggered an image save: saving a chart layout, the drawings snapshot, or a template.
Alias of
SaveLayoutResult returned by layout save operations, carrying the logical layoutId together with the backend storageId the storage adapter resolved (plus optional timestamp and revision).Migration-compatible line-tool storage partition to request when loading drawings: every line tool, only the main series' line tools, line tools not keyed to a symbol, or indicator-owned line tools.
How a separately-stored drawing set is scoped:
not-shared (per chart+symbol+interval), shared-in-layout (all charts in the chart layout), or globally-shared (every chart showing the symbol).Per-scope access map keyed by
DrawingSharingMode (not-shared, shared-in-layout, globally-shared), with each entry a DrawingSharingPermission describing read/write access for that scope.Lifecycle states for shared drawing sync:
idle, unsaved local edits (dirty), in-flight loading or saving, up-to-date synced, unresolved revision conflict, read-only access, or error.How a drawing template is applied to the chart:
replace swaps out the existing drawings, append adds the template's drawings alongside them, and replace-tool replaces only drawings of the template's tool (the default for tool-scoped templates).Discriminated notification delivered to
ReplayControllerApi.subscribe callbacks; type names the replay transition (picking, start, play/pause, step, jump, speed change, end, exit, save, load) and state carries the resulting ReplayState (null on a loaded event with nothing stored).Phase of a bar-replay session:
idle (replay not active), picking (choosing a start bar), paused, playing, or ended (the cursor reached the final bar).Viewport placement applied once when the replay cursor is initially selected.
Explicit persistence intent of a chart-layout save:
create writes a new backend record, update overwrites the existing record identified by the request's ref.Opaque serialized state owned by the SDK's layout engine. Consumers may persist, clone, and pass this object back to TradeScript, but must not inspect or mutate its engine-specific fields.
Save lifecycle of a workspace tab's chart layout:
'clean' (saved), 'dirty' (unsaved changes), 'saving' (persist in flight), or 'error' (the last save failed).Constants 1
Workspace-scoped user-settings key used only for tab order and last active tab.
Related pages
- Chart storage — choose browser-local, built-in REST, or custom chart storage
- REST chart storage adapter — exact chart-workspace endpoints, payloads, and responses
- Widget layout storage — persist the outer panel arrangement through REST or a custom transport
- Chart workspace layouts — the largest chart-storage record
- Widget panel arrangements — the state and lifecycle of outer panel topology
- Templates — reusable chart, indicator, and drawing presets