@tradecanvas/chart 1.4.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +910 -858
- package/dist/Chart.d.ts +606 -23
- package/dist/Chart.d.ts.map +1 -1
- package/dist/DataManager.d.ts +5 -0
- package/dist/DataManager.d.ts.map +1 -1
- package/dist/HistoryPager.d.ts +58 -0
- package/dist/HistoryPager.d.ts.map +1 -0
- package/dist/LayoutSession-CTZB90NX.cjs +2 -0
- package/dist/LayoutSession-CTZB90NX.cjs.map +1 -0
- package/dist/LayoutSession-CWn3sdbs.js +3967 -0
- package/dist/LayoutSession-CWn3sdbs.js.map +1 -0
- package/dist/ThemeManager.d.ts +5 -1
- package/dist/ThemeManager.d.ts.map +1 -1
- package/dist/chartA11y.d.ts +59 -0
- package/dist/chartA11y.d.ts.map +1 -0
- package/dist/charts/ChartTypeStrategy.d.ts +5 -4
- package/dist/charts/ChartTypeStrategy.d.ts.map +1 -1
- package/dist/grid/ChartGrid.d.ts +6 -1
- package/dist/grid/ChartGrid.d.ts.map +1 -1
- package/dist/i18n-CiQ8EDVs.js +1469 -0
- package/dist/i18n-CiQ8EDVs.js.map +1 -0
- package/dist/i18n-WsLA9SmD.cjs +2 -0
- package/dist/i18n-WsLA9SmD.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +22 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -31
- package/dist/index.js.map +1 -1
- package/dist/indicatorLabel.d.ts +7 -0
- package/dist/indicatorLabel.d.ts.map +1 -0
- package/dist/layout/LayoutManager.d.ts +50 -0
- package/dist/layout/LayoutManager.d.ts.map +1 -1
- package/dist/layout/priceAxisWidth.d.ts +2 -0
- package/dist/layout/priceAxisWidth.d.ts.map +1 -1
- package/dist/regularHours.d.ts +10 -0
- package/dist/regularHours.d.ts.map +1 -0
- package/dist/state/LayoutSession.d.ts +101 -0
- package/dist/state/LayoutSession.d.ts.map +1 -0
- package/dist/state/layoutStorage.d.ts +46 -0
- package/dist/state/layoutStorage.d.ts.map +1 -0
- package/dist/trading/wireExecution.d.ts +7 -3
- package/dist/trading/wireExecution.d.ts.map +1 -1
- package/dist/widget/ChartWidget.d.ts +219 -10
- package/dist/widget/ChartWidget.d.ts.map +1 -1
- package/dist/widget/ChartWidgetGrid.d.ts +166 -0
- package/dist/widget/ChartWidgetGrid.d.ts.map +1 -0
- package/dist/widget/DrawingTemplateStore.d.ts +29 -8
- package/dist/widget/DrawingTemplateStore.d.ts.map +1 -1
- package/dist/widget/WatchlistStore.d.ts +65 -0
- package/dist/widget/WatchlistStore.d.ts.map +1 -0
- package/dist/widget/WidgetAccountPanel.d.ts +72 -0
- package/dist/widget/WidgetAccountPanel.d.ts.map +1 -0
- package/dist/widget/WidgetAlertsPanel.d.ts +50 -3
- package/dist/widget/WidgetAlertsPanel.d.ts.map +1 -1
- package/dist/widget/WidgetBracketBar.d.ts +3 -1
- package/dist/widget/WidgetBracketBar.d.ts.map +1 -1
- package/dist/widget/WidgetChartNav.d.ts +36 -0
- package/dist/widget/WidgetChartNav.d.ts.map +1 -0
- package/dist/widget/WidgetCommandPalette.d.ts +3 -1
- package/dist/widget/WidgetCommandPalette.d.ts.map +1 -1
- package/dist/widget/WidgetContextMenu.d.ts +40 -0
- package/dist/widget/WidgetContextMenu.d.ts.map +1 -0
- package/dist/widget/WidgetDataWindow.d.ts +3 -1
- package/dist/widget/WidgetDataWindow.d.ts.map +1 -1
- package/dist/widget/WidgetDepthLadder.d.ts +3 -1
- package/dist/widget/WidgetDepthLadder.d.ts.map +1 -1
- package/dist/widget/WidgetDrawingSettings.d.ts +108 -0
- package/dist/widget/WidgetDrawingSettings.d.ts.map +1 -0
- package/dist/widget/WidgetDrawingSidebar.d.ts +14 -1
- package/dist/widget/WidgetDrawingSidebar.d.ts.map +1 -1
- package/dist/widget/WidgetDrawingStyle.d.ts +3 -1
- package/dist/widget/WidgetDrawingStyle.d.ts.map +1 -1
- package/dist/widget/WidgetDropdown.d.ts.map +1 -1
- package/dist/widget/WidgetGoToDate.d.ts +5 -4
- package/dist/widget/WidgetGoToDate.d.ts.map +1 -1
- package/dist/widget/WidgetHistoryPill.d.ts +23 -0
- package/dist/widget/WidgetHistoryPill.d.ts.map +1 -0
- package/dist/widget/WidgetHotkeySheet.d.ts.map +1 -1
- package/dist/widget/WidgetIndicatorLegend.d.ts +31 -1
- package/dist/widget/WidgetIndicatorLegend.d.ts.map +1 -1
- package/dist/widget/WidgetIndicatorSettings.d.ts +62 -7
- package/dist/widget/WidgetIndicatorSettings.d.ts.map +1 -1
- package/dist/widget/WidgetIntervalInput.d.ts +34 -0
- package/dist/widget/WidgetIntervalInput.d.ts.map +1 -0
- package/dist/widget/WidgetLayoutsDialog.d.ts +39 -0
- package/dist/widget/WidgetLayoutsDialog.d.ts.map +1 -0
- package/dist/widget/WidgetLayoutsUI.d.ts +37 -0
- package/dist/widget/WidgetLayoutsUI.d.ts.map +1 -0
- package/dist/widget/WidgetNamePrompt.d.ts +31 -0
- package/dist/widget/WidgetNamePrompt.d.ts.map +1 -0
- package/dist/widget/WidgetObjectTree.d.ts +21 -3
- package/dist/widget/WidgetObjectTree.d.ts.map +1 -1
- package/dist/widget/WidgetOrderTicket.d.ts +49 -0
- package/dist/widget/WidgetOrderTicket.d.ts.map +1 -0
- package/dist/widget/WidgetReplayBar.d.ts +15 -0
- package/dist/widget/WidgetReplayBar.d.ts.map +1 -1
- package/dist/widget/WidgetSettings.d.ts +13 -1
- package/dist/widget/WidgetSettings.d.ts.map +1 -1
- package/dist/widget/WidgetStatusBar.d.ts +3 -0
- package/dist/widget/WidgetStatusBar.d.ts.map +1 -1
- package/dist/widget/WidgetStyles.d.ts +3 -1
- package/dist/widget/WidgetStyles.d.ts.map +1 -1
- package/dist/widget/WidgetSymbolInfo.d.ts +64 -0
- package/dist/widget/WidgetSymbolInfo.d.ts.map +1 -0
- package/dist/widget/WidgetSymbolSearch.d.ts +26 -5
- package/dist/widget/WidgetSymbolSearch.d.ts.map +1 -1
- package/dist/widget/WidgetToolbar.d.ts +30 -1
- package/dist/widget/WidgetToolbar.d.ts.map +1 -1
- package/dist/widget/WidgetWatchlist.d.ts +53 -13
- package/dist/widget/WidgetWatchlist.d.ts.map +1 -1
- package/dist/widget/chartMenu.d.ts +40 -0
- package/dist/widget/chartMenu.d.ts.map +1 -0
- package/dist/widget/drawingMenu.d.ts +21 -0
- package/dist/widget/drawingMenu.d.ts.map +1 -0
- package/dist/widget/focusTrap.d.ts +8 -0
- package/dist/widget/focusTrap.d.ts.map +1 -0
- package/dist/widget/i18n.d.ts +20 -89
- package/dist/widget/i18n.d.ts.map +1 -1
- package/dist/widget/iconSet.d.ts.map +1 -1
- package/dist/widget/index.cjs +4294 -3028
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.d.ts +15 -1
- package/dist/widget/index.d.ts.map +1 -1
- package/dist/widget/index.js +6326 -1185
- package/dist/widget/index.js.map +1 -1
- package/dist/widget/indicatorTemplates.d.ts +24 -0
- package/dist/widget/indicatorTemplates.d.ts.map +1 -0
- package/dist/widget/keyTarget.d.ts +11 -0
- package/dist/widget/keyTarget.d.ts.map +1 -0
- package/dist/widget/legendValues.d.ts +11 -6
- package/dist/widget/legendValues.d.ts.map +1 -1
- package/dist/widget/locales/ar.d.ts +4 -0
- package/dist/widget/locales/ar.d.ts.map +1 -0
- package/dist/widget/locales/de.d.ts +4 -0
- package/dist/widget/locales/de.d.ts.map +1 -0
- package/dist/widget/locales/en.d.ts +722 -0
- package/dist/widget/locales/en.d.ts.map +1 -0
- package/dist/widget/locales/es.d.ts +4 -0
- package/dist/widget/locales/es.d.ts.map +1 -0
- package/dist/widget/locales/fr.d.ts +4 -0
- package/dist/widget/locales/fr.d.ts.map +1 -0
- package/dist/widget/locales/he.d.ts +4 -0
- package/dist/widget/locales/he.d.ts.map +1 -0
- package/dist/widget/locales/id.d.ts +4 -0
- package/dist/widget/locales/id.d.ts.map +1 -0
- package/dist/widget/locales/index.cjs +2 -0
- package/dist/widget/locales/index.cjs.map +1 -0
- package/dist/widget/locales/index.d.ts +33 -0
- package/dist/widget/locales/index.d.ts.map +1 -0
- package/dist/widget/locales/index.js +10089 -0
- package/dist/widget/locales/index.js.map +1 -0
- package/dist/widget/locales/ja.d.ts +4 -0
- package/dist/widget/locales/ja.d.ts.map +1 -0
- package/dist/widget/locales/ko.d.ts +4 -0
- package/dist/widget/locales/ko.d.ts.map +1 -0
- package/dist/widget/locales/pt.d.ts +4 -0
- package/dist/widget/locales/pt.d.ts.map +1 -0
- package/dist/widget/locales/ru.d.ts +4 -0
- package/dist/widget/locales/ru.d.ts.map +1 -0
- package/dist/widget/locales/th.d.ts +4 -0
- package/dist/widget/locales/th.d.ts.map +1 -0
- package/dist/widget/locales/tr.d.ts +4 -0
- package/dist/widget/locales/tr.d.ts.map +1 -0
- package/dist/widget/locales/vi.d.ts +4 -0
- package/dist/widget/locales/vi.d.ts.map +1 -0
- package/dist/widget/locales/zh.d.ts +4 -0
- package/dist/widget/locales/zh.d.ts.map +1 -0
- package/dist/widget/locales/zhHant.d.ts +4 -0
- package/dist/widget/locales/zhHant.d.ts.map +1 -0
- package/dist/widget/orderTicket.d.ts +27 -0
- package/dist/widget/orderTicket.d.ts.map +1 -0
- package/dist/widget/settingsControls.d.ts +24 -0
- package/dist/widget/settingsControls.d.ts.map +1 -0
- package/dist/widget/types.d.ts +182 -6
- package/dist/widget/types.d.ts.map +1 -1
- package/dist/widget/widgetConfig.d.ts.map +1 -1
- package/dist/widget/widgetLayout.d.ts +22 -0
- package/dist/widget/widgetLayout.d.ts.map +1 -0
- package/dist/widget/widgetLocales.d.ts +17 -0
- package/dist/widget/widgetLocales.d.ts.map +1 -0
- package/dist/widget/widgetTimeframes.d.ts +8 -0
- package/dist/widget/widgetTimeframes.d.ts.map +1 -1
- package/dist/widget/widgetTimezones.d.ts +32 -0
- package/dist/widget/widgetTimezones.d.ts.map +1 -0
- package/dist/widget/widgetUI.d.ts +126 -0
- package/dist/widget/widgetUI.d.ts.map +1 -0
- package/package.json +8 -3
- package/dist/DragDropImporter-C5kgfbET.cjs +0 -2
- package/dist/DragDropImporter-C5kgfbET.cjs.map +0 -1
- package/dist/DragDropImporter-Dd9Mud5J.js +0 -2099
- package/dist/DragDropImporter-Dd9Mud5J.js.map +0 -1
- package/dist/charts/IndicatorPriceRange.d.ts +0 -20
- package/dist/charts/IndicatorPriceRange.d.ts.map +0 -1
package/dist/Chart.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { ChartOptions, ChartType, OHLCBar, DataSeries, Theme, ThemeName, ChartEventType, ChartEvent, ChartEventMap, TauriBridgeOptions, IndicatorPlugin, IndicatorDescriptor, IndicatorOutput, ResolvedIndicatorStyle, DrawingToolType, DrawingState, DrawingStyle, DrawingPlugin, PanelPosition, TradingOrder, TradingPosition, DepthData, TradingConfig, MarketConfig, Locale, StreamConfig, ConnectionState, ConnectionInfo, TimeFrame, FeaturesConfig, ExecutionAdapter, ExecutionConfig } from '@tradecanvas/commons';
|
|
2
|
-
import { RangePreset } from '@tradecanvas/core';
|
|
1
|
+
import { ChartOptions, ChartType, OHLCBar, DataSeries, Theme, ThemeName, ChartEventType, ChartEvent, ChartEventMap, TauriBridgeOptions, IndicatorPlugin, IndicatorDescriptor, IndicatorOutput, ResolvedIndicatorStyle, DrawingToolType, DrawingState, DrawingStyle, DrawingOptions, DrawingOptionDefs, DrawingDescriptor, DrawingPlugin, PanelPosition, TradingOrder, TradingPosition, DepthData, TradingConfig, MarketConfig, Locale, StreamConfig, ConnectionState, ConnectionInfo, TimeFrame, TimeZoneSetting, SymbolInfo, OverlayScale, FeaturesConfig, ExecutionAdapter, ExecutionConfig, ChartTypeOptions, PriceFormatter, PriceFraction, ShapeConfig, TimeFormatter } from '@tradecanvas/commons';
|
|
2
|
+
import { BidAsk, ExportColumn, RangePreset, SessionHoursConfig, DrawingPatch, DrawingOrderMove } from '@tradecanvas/core';
|
|
3
|
+
import { HistoryLoader } from './HistoryPager.js';
|
|
3
4
|
import { PluginManager } from './plugins/PluginManager.js';
|
|
4
5
|
import { ChartPlugin } from './plugins/contracts.js';
|
|
6
|
+
/** `setTimezone(EXCHANGE_TIMEZONE)` shows the time zone of the symbol's exchange. */
|
|
7
|
+
export declare const EXCHANGE_TIMEZONE = "exchange";
|
|
5
8
|
export declare class Chart {
|
|
6
9
|
static version: string;
|
|
7
10
|
private engine;
|
|
@@ -43,10 +46,27 @@ export declare class Chart {
|
|
|
43
46
|
* the layout again doesn't drop them.
|
|
44
47
|
*/
|
|
45
48
|
private unrestoredIndicators;
|
|
49
|
+
/** Above 0 while indicators change as a whole (a layout, an undo): no undo steps are recorded. */
|
|
50
|
+
private indicatorHistoryDepth;
|
|
51
|
+
/** Alerts of deleted drawings, put back if an undo brings the drawing back. */
|
|
52
|
+
private removedDrawingAlerts;
|
|
53
|
+
/** The zoom-area tool is waiting for its box. */
|
|
54
|
+
private zoomAreaMode;
|
|
55
|
+
/** The "+" by the price axis. */
|
|
56
|
+
private priceAxisAddButton;
|
|
46
57
|
/** Display timezone, minutes east of UTC; null = the browser's. */
|
|
47
|
-
|
|
58
|
+
/** The time zone shown: the setting, with 'exchange' resolved to the symbol's zone. */
|
|
59
|
+
private displayTz;
|
|
60
|
+
/** What `setTimezone` was given; 'exchange' follows the symbol. */
|
|
61
|
+
private timezoneSetting;
|
|
62
|
+
/** What the feed (or host) said about the symbol on the chart. */
|
|
63
|
+
private symbolInfo;
|
|
64
|
+
/** Bumped per symbol asked about: an answer about a symbol the chart left is dropped. */
|
|
65
|
+
private symbolInfoSeq;
|
|
48
66
|
private sessionBreaks;
|
|
49
67
|
private sessionShading;
|
|
68
|
+
/** The session hours the host set (or the default); a symbol's own hours show over them. */
|
|
69
|
+
private hostSessionHours;
|
|
50
70
|
private compareRenderer;
|
|
51
71
|
private countdownInterval;
|
|
52
72
|
private volumeRenderer;
|
|
@@ -70,6 +90,9 @@ export declare class Chart {
|
|
|
70
90
|
* back on `replayStop()`. `price` is the latest live tick.
|
|
71
91
|
*/
|
|
72
92
|
private replaySession;
|
|
93
|
+
/** During a replay in finer steps: the steps, and the series they build. */
|
|
94
|
+
private replayStepsSeries;
|
|
95
|
+
private replayCoarse;
|
|
73
96
|
private undoRedoManager;
|
|
74
97
|
private autoSaveScheduler;
|
|
75
98
|
private animator;
|
|
@@ -78,8 +101,29 @@ export declare class Chart {
|
|
|
78
101
|
private interactionManager;
|
|
79
102
|
private crosshairHandler;
|
|
80
103
|
private chartRenderer;
|
|
104
|
+
/** Settings of the chart types that build their own bars. */
|
|
105
|
+
private chartTypeOptions;
|
|
106
|
+
private mainSeriesVisible;
|
|
107
|
+
/** The visible high and low, the bid and the ask. */
|
|
108
|
+
private priceLines;
|
|
109
|
+
/** Other symbols' bars, for the indicators that compare with them. */
|
|
110
|
+
private symbolSeries;
|
|
111
|
+
/** Bars outside the symbol's regular hours shown. */
|
|
112
|
+
private extendedHours;
|
|
113
|
+
/** A replay being restarted (or the chart going): its stop is not reported. */
|
|
114
|
+
private replayRestarting;
|
|
115
|
+
/** While they are hidden: the whole series, theirs included (the data manager has the rest). */
|
|
116
|
+
private fullSeries;
|
|
117
|
+
/** Symbols asked for (`symbolSeriesRequest`) and not given yet. */
|
|
118
|
+
private requestedSymbols;
|
|
81
119
|
private gridRenderer;
|
|
82
120
|
private priceAxis;
|
|
121
|
+
/** The left price scale: overlays put on it, else a mirror of the price scale. */
|
|
122
|
+
private leftPriceAxis;
|
|
123
|
+
private leftScaleRequested;
|
|
124
|
+
private leftAxisWidth;
|
|
125
|
+
/** The left scale's viewport this frame; null while it is hidden. */
|
|
126
|
+
private leftViewport;
|
|
83
127
|
private timeAxis;
|
|
84
128
|
private options;
|
|
85
129
|
private features;
|
|
@@ -89,6 +133,10 @@ export declare class Chart {
|
|
|
89
133
|
private numberLocale;
|
|
90
134
|
/** The market's price precision, when set: otherwise it follows the visible range. */
|
|
91
135
|
private marketPricePrecision;
|
|
136
|
+
/** The chart's price format (`priceFormat`), or null for decimals. */
|
|
137
|
+
private priceFormatter;
|
|
138
|
+
/** A fraction format's smallest step (a 32nd), or null. */
|
|
139
|
+
private priceUnit;
|
|
92
140
|
private paneTitles;
|
|
93
141
|
/**
|
|
94
142
|
* The `autoScale` the chart was constructed with — distinct from
|
|
@@ -98,12 +146,68 @@ export declare class Chart {
|
|
|
98
146
|
*/
|
|
99
147
|
private defaultAutoScale;
|
|
100
148
|
private keyboardHandler;
|
|
149
|
+
private a11y;
|
|
101
150
|
private onWindowKeyDown;
|
|
102
151
|
private currentSymbol;
|
|
152
|
+
/** Timeframe and adapter of the connected stream, for paging its history. */
|
|
153
|
+
private streamTimeframe;
|
|
154
|
+
/** The symbol and timeframe last told (symbolChange, timeframeChange). */
|
|
155
|
+
private announcedSymbol;
|
|
156
|
+
private announcedTimeframe;
|
|
157
|
+
private streamAdapter;
|
|
158
|
+
/** Pages older bars in as the view nears the oldest one. */
|
|
159
|
+
private history;
|
|
160
|
+
/** Whether the history loader is the connected stream's (and goes with it). */
|
|
161
|
+
private historyFromStream;
|
|
162
|
+
/** Whether the host set a loader of its own: the stream's never replaces it. */
|
|
163
|
+
private hostHistoryLoader;
|
|
164
|
+
/** Symbol and timeframe of the series the last stream snapshot loaded. */
|
|
165
|
+
private snapshotKey;
|
|
166
|
+
private historyCheckQueued;
|
|
103
167
|
constructor(container: HTMLElement, options: ChartOptions & {
|
|
104
168
|
plugins?: ChartPlugin[];
|
|
105
169
|
});
|
|
106
170
|
setData(data: DataSeries): void;
|
|
171
|
+
/**
|
|
172
|
+
* `setData`; `restoring` puts the live series back after a replay, which
|
|
173
|
+
* goes on as it was for alerts (their bars and last values stay).
|
|
174
|
+
*/
|
|
175
|
+
private loadSeries;
|
|
176
|
+
/**
|
|
177
|
+
* Add older bars in front of the data — e.g. a page of history loaded as
|
|
178
|
+
* the user scrolls back. Bars at or after the first loaded bar are skipped.
|
|
179
|
+
* The same bars stay on screen. Ignored during a replay. Returns how many
|
|
180
|
+
* bars were added.
|
|
181
|
+
*/
|
|
182
|
+
prependBars(bars: OHLCBar[]): number;
|
|
183
|
+
/**
|
|
184
|
+
* A stream snapshot for the series already on the chart (a reconnect): keep
|
|
185
|
+
* the older bars paged in and the view, replace the rest.
|
|
186
|
+
*/
|
|
187
|
+
private mergeSnapshot;
|
|
188
|
+
/**
|
|
189
|
+
* Load older bars as the user scrolls back: `loader(before, limit)` gets the
|
|
190
|
+
* oldest loaded bar's time and returns up to `limit` older bars (an empty
|
|
191
|
+
* array once the history starts). A connected stream whose adapter has
|
|
192
|
+
* `fetchHistoryBefore` sets this up by itself. Pass null to stop.
|
|
193
|
+
*/
|
|
194
|
+
setHistoryLoader(loader: HistoryLoader | null, options?: {
|
|
195
|
+
pageSize?: number;
|
|
196
|
+
}): void;
|
|
197
|
+
/** Load one page of older bars now. Resolves to the number of bars added. */
|
|
198
|
+
loadMoreHistory(): Promise<number>;
|
|
199
|
+
/** Whether older bars can still be loaded (a loader is set and the start wasn't reached). */
|
|
200
|
+
hasMoreHistory(): boolean;
|
|
201
|
+
isLoadingHistory(): boolean;
|
|
202
|
+
/**
|
|
203
|
+
* Page older bars in when less than a screen of them is left of the view —
|
|
204
|
+
* after the current update, so a page that just landed reports itself
|
|
205
|
+
* before the next one starts. Not for chart types that reshape the bars
|
|
206
|
+
* (Renko, Kagi…): a handful of bricks can stand for a whole page.
|
|
207
|
+
*/
|
|
208
|
+
private checkHistory;
|
|
209
|
+
/** Page the connected stream's history through its adapter, if it can. */
|
|
210
|
+
private useStreamHistory;
|
|
107
211
|
appendBar(bar: OHLCBar): void;
|
|
108
212
|
/**
|
|
109
213
|
* Append multiple bars at once (e.g., catch-up after reconnect).
|
|
@@ -119,9 +223,138 @@ export declare class Chart {
|
|
|
119
223
|
time: number;
|
|
120
224
|
}): void;
|
|
121
225
|
setChartType(type: ChartType | (string & {})): void;
|
|
122
|
-
|
|
226
|
+
/**
|
|
227
|
+
* Settings of Renko, Line Break, Kagi, Point & Figure and range bars, by
|
|
228
|
+
* type: each type given replaces that type's settings (`{}` puts it back
|
|
229
|
+
* to the defaults). Values it can't use are left out.
|
|
230
|
+
*/
|
|
231
|
+
setChartTypeOptions(options: ChartTypeOptions): void;
|
|
232
|
+
getChartTypeOptions(): ChartTypeOptions;
|
|
233
|
+
/**
|
|
234
|
+
* Show or hide the bars outside the symbol's regular hours
|
|
235
|
+
* (`SymbolInfo.sessions`, in its `timezone`): pre- and post-market. Hidden,
|
|
236
|
+
* they are kept aside and come back when shown again. Bars a day or longer,
|
|
237
|
+
* and symbols without hours, are left as they are.
|
|
238
|
+
*/
|
|
239
|
+
setExtendedHours(show: boolean): void;
|
|
240
|
+
isExtendedHoursVisible(): boolean;
|
|
241
|
+
/** Which bar times to show, for bars like `data`'s; null: all of them. */
|
|
242
|
+
private sessionKeep;
|
|
243
|
+
/** The bars of `all` the chart shows (no state kept). */
|
|
244
|
+
private shownBars;
|
|
245
|
+
/** The bars of `all` the chart shows; while some are hidden, `all` is kept as the whole series. */
|
|
246
|
+
private regularOnly;
|
|
247
|
+
/** A new or updated bar into the whole series (while one is kept): whether the chart shows it. */
|
|
248
|
+
/** A stream bar onto the bars shown: the last one again or a new one after it; false for an older one. */
|
|
249
|
+
private placeStreamBar;
|
|
250
|
+
private takeBar;
|
|
251
|
+
/** The bars shown again after the extended hours or the symbol's hours changed. */
|
|
252
|
+
private reapplyExtendedHours;
|
|
253
|
+
/** The price lines for this frame: during a replay without the live bid and ask. */
|
|
254
|
+
private quoteLines;
|
|
255
|
+
/**
|
|
256
|
+
* The shapes the chart draws: `tagRadius` rounds its price tags, axis
|
|
257
|
+
* pills and order badges (0: square, 999: pills). Kept through theme
|
|
258
|
+
* changes.
|
|
259
|
+
*/
|
|
260
|
+
setShapes(shapes: ShapeConfig): void;
|
|
261
|
+
getShapes(): ShapeConfig;
|
|
262
|
+
/** Show or hide the main series (its bars, candles or line); the rest of the chart stays. */
|
|
263
|
+
setMainSeriesVisible(visible: boolean): void;
|
|
264
|
+
isMainSeriesVisible(): boolean;
|
|
265
|
+
/** Mark the highest high and lowest low on screen with a line and a price tag. */
|
|
266
|
+
setHighLowLines(visible: boolean): void;
|
|
267
|
+
isHighLowLinesVisible(): boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Mark the best bid and ask with lines and price tags (null takes them
|
|
270
|
+
* off). A connected feed whose ticks carry `bid` / `ask` keeps them up to date.
|
|
271
|
+
*/
|
|
272
|
+
setBidAsk(quote: BidAsk | null): void;
|
|
273
|
+
getBidAsk(): BidAsk | null;
|
|
274
|
+
/**
|
|
275
|
+
* Add an indicator. Panel indicators get a pane of their own at `position`.
|
|
276
|
+
* `options.pane` draws it in another indicator's pane instead, on that
|
|
277
|
+
* pane's scale; a price-pane indicator computed from a pane indicator's
|
|
278
|
+
* line (`source: 'ind:<instanceId>:<key>'`) goes there by itself.
|
|
279
|
+
*/
|
|
280
|
+
addIndicator(id: string, params?: Record<string, number | string | boolean>, position?: PanelPosition, options?: {
|
|
281
|
+
pane?: string;
|
|
282
|
+
scale?: OverlayScale;
|
|
283
|
+
}): string | null;
|
|
284
|
+
private addIndicatorNow;
|
|
285
|
+
/**
|
|
286
|
+
* Another symbol's bars, for the indicators that read it ('compareSymbol',
|
|
287
|
+
* 'spread'): they line them up with the chart's bars by time. Give them
|
|
288
|
+
* again after a timeframe change; null forgets them.
|
|
289
|
+
*/
|
|
290
|
+
setSymbolSeries(symbol: string, bars: DataSeries | null): void;
|
|
291
|
+
/** A symbol no indicator reads any more may be asked for again later. */
|
|
292
|
+
private forgetUnreadSymbols;
|
|
293
|
+
/** The bars given for `symbol`, or null. */
|
|
294
|
+
getSymbolSeries(symbol: string): DataSeries | null;
|
|
295
|
+
/** The symbols the chart's indicators read, whether their bars are here or not. */
|
|
296
|
+
getRequiredSymbols(): string[];
|
|
297
|
+
/**
|
|
298
|
+
* Ask once for the symbol an indicator just added or changed reads, when
|
|
299
|
+
* the chart hasn't got it (not for symbols other indicators read: one
|
|
300
|
+
* whose fetch failed is asked for again only by an indicator on it).
|
|
301
|
+
*/
|
|
302
|
+
private requestMissingSymbols;
|
|
303
|
+
/**
|
|
304
|
+
* Change an indicator's inputs. A source that would make it read from its
|
|
305
|
+
* own lines (through other indicators) is ignored.
|
|
306
|
+
*/
|
|
123
307
|
updateIndicator(instanceId: string, params: Record<string, number | string | boolean>): void;
|
|
308
|
+
private updateIndicatorNow;
|
|
309
|
+
/**
|
|
310
|
+
* The pane an indicator is drawn in, other than its own: the pane of the
|
|
311
|
+
* instance `requested`, or, for a price-pane indicator computed from a pane
|
|
312
|
+
* indicator's line, that indicator's pane. Null = the price pane (overlays)
|
|
313
|
+
* or a pane of its own (panels).
|
|
314
|
+
*/
|
|
315
|
+
private paneFor;
|
|
316
|
+
/** The instance owning the pane `instanceId` is drawn in; null for the price pane. */
|
|
317
|
+
private paneHostOf;
|
|
318
|
+
/** An indicator's reference levels (RSI 30 / 70): its own, else its indicator's defaults. */
|
|
319
|
+
getIndicatorLevels(instanceId: string): number[];
|
|
320
|
+
/**
|
|
321
|
+
* Put a price-pane overlay on the left price scale (fit to its own values,
|
|
322
|
+
* the scale shows by itself) or back on the price scale. False when the
|
|
323
|
+
* indicator isn't a price-pane overlay.
|
|
324
|
+
*/
|
|
325
|
+
setIndicatorScale(instanceId: string, scale: OverlayScale): boolean;
|
|
326
|
+
private setIndicatorScaleNow;
|
|
327
|
+
getIndicatorScale(instanceId: string): OverlayScale;
|
|
328
|
+
/** Show the left price scale even without overlays on it (it then mirrors the price scale). */
|
|
329
|
+
setLeftPriceScaleVisible(visible: boolean): void;
|
|
330
|
+
/** Whether the left price scale is on screen: asked for, or carrying an overlay. */
|
|
331
|
+
isLeftPriceScaleShown(): boolean;
|
|
332
|
+
/** The left price scale's range on screen, or null while it is hidden. */
|
|
333
|
+
getLeftPriceRange(): {
|
|
334
|
+
min: number;
|
|
335
|
+
max: number;
|
|
336
|
+
} | null;
|
|
337
|
+
/**
|
|
338
|
+
* The left scale's viewport for this frame: fit to the overlays on it over
|
|
339
|
+
* the visible bars (on a plain linear scale), or the price scale's when
|
|
340
|
+
* none is.
|
|
341
|
+
*/
|
|
342
|
+
private computeLeftViewport;
|
|
343
|
+
/** Set an indicator's reference levels; `null` restores its indicator's defaults. */
|
|
344
|
+
setIndicatorLevels(instanceId: string, levels: readonly number[] | null): void;
|
|
345
|
+
private setIndicatorLevelsNow;
|
|
346
|
+
/**
|
|
347
|
+
* Remove an indicator, and the indicators computed from its lines with it.
|
|
348
|
+
* Others drawn in its pane keep the pane (a pane indicator takes it over)
|
|
349
|
+
* or go back to the price pane.
|
|
350
|
+
*/
|
|
124
351
|
removeIndicator(instanceId: string): void;
|
|
352
|
+
private removeIndicatorNow;
|
|
353
|
+
/**
|
|
354
|
+
* Remove one indicator. The first pane indicator drawn in its pane takes the
|
|
355
|
+
* pane over and the others stay in it.
|
|
356
|
+
*/
|
|
357
|
+
private detachIndicator;
|
|
125
358
|
/** The colours, line widths and opacity an indicator draws with (a copy), or null. */
|
|
126
359
|
getIndicatorStyle(instanceId: string): ResolvedIndicatorStyle | null;
|
|
127
360
|
getIndicatorOutput(instanceId: string): IndicatorOutput | null;
|
|
@@ -131,12 +364,60 @@ export declare class Chart {
|
|
|
131
364
|
static indicators(): IndicatorDescriptor[];
|
|
132
365
|
setPanelPosition(instanceId: string, position: PanelPosition): void;
|
|
133
366
|
setPanelSize(instanceId: string, size: number): void;
|
|
367
|
+
/**
|
|
368
|
+
* Move an indicator to another pane: `target` is an indicator drawn there
|
|
369
|
+
* (it joins that pane, on its scale), `'new'` a pane of its own (indicators
|
|
370
|
+
* that draw in a pane), or `'price'` the price pane (overlays). Indicators
|
|
371
|
+
* drawn in its own pane stay there (one of them takes the pane over) or
|
|
372
|
+
* follow it when they read its lines. False when it can't go there.
|
|
373
|
+
*/
|
|
374
|
+
moveIndicatorToPane(instanceId: string, target: string): boolean;
|
|
375
|
+
/** Whether `moveIndicatorToPane(instanceId, target)` would move it. */
|
|
376
|
+
canMoveIndicatorToPane(instanceId: string, target: string): boolean;
|
|
377
|
+
/** Where a move would put the indicator: the pane's host, `null` (its own or the price pane), or `undefined` when it can't go. */
|
|
378
|
+
private paneMoveHost;
|
|
379
|
+
private moveIndicatorToPaneNow;
|
|
380
|
+
/**
|
|
381
|
+
* Fold a pane to its header, or open it again: the pane `instanceId` is
|
|
382
|
+
* drawn in. While a pane is maximised, this puts the panes back first.
|
|
383
|
+
*/
|
|
384
|
+
setPaneCollapsed(instanceId: string, collapsed: boolean): boolean;
|
|
385
|
+
/** Whether the pane `instanceId` is drawn in shows folded (folded, or another pane is maximised). */
|
|
386
|
+
isPaneCollapsed(instanceId: string): boolean;
|
|
387
|
+
/** Let one pane take the room (the others fold, the price pane keeps a strip); `null` puts them back. */
|
|
388
|
+
setMaximizedPane(instanceId: string | null): boolean;
|
|
389
|
+
getMaximizedPane(): string | null;
|
|
390
|
+
/**
|
|
391
|
+
* A pane's value scale: logarithmic (used while all its values are above 0;
|
|
392
|
+
* linear otherwise), upside down. The pane `instanceId` is drawn in.
|
|
393
|
+
*/
|
|
394
|
+
setPaneScale(instanceId: string, scale: {
|
|
395
|
+
log?: boolean;
|
|
396
|
+
invert?: boolean;
|
|
397
|
+
percent?: boolean;
|
|
398
|
+
}): boolean;
|
|
399
|
+
/** The pane's value scale as set (see `setPaneScale`). */
|
|
400
|
+
getPaneScale(instanceId: string): {
|
|
401
|
+
log: boolean;
|
|
402
|
+
invert: boolean;
|
|
403
|
+
percent: boolean;
|
|
404
|
+
};
|
|
405
|
+
/** A pane's first value on screen (its own indicator's first line), the 0% of a percent scale. */
|
|
406
|
+
private paneBaseline;
|
|
407
|
+
/** Move a pane one place up (`-1`) or down (`1`) among the panes on its side. */
|
|
408
|
+
movePane(instanceId: string, delta: -1 | 1): boolean;
|
|
409
|
+
/** Whether `movePane(instanceId, delta)` would move it. */
|
|
410
|
+
canMovePane(instanceId: string, delta: -1 | 1): boolean;
|
|
411
|
+
/** The pane an indicator is drawn in: its own, or the one it shares. */
|
|
412
|
+
private paneOf;
|
|
413
|
+
private paneChange;
|
|
134
414
|
/**
|
|
135
415
|
* Indicator panes, in CSS pixels relative to the container: the whole pane,
|
|
136
416
|
* its 20 px header (where the name is written) included.
|
|
137
417
|
*/
|
|
138
418
|
getIndicatorPanes(): {
|
|
139
419
|
instanceId: string;
|
|
420
|
+
instanceIds: string[];
|
|
140
421
|
rect: {
|
|
141
422
|
x: number;
|
|
142
423
|
y: number;
|
|
@@ -144,6 +425,8 @@ export declare class Chart {
|
|
|
144
425
|
height: number;
|
|
145
426
|
};
|
|
146
427
|
}[];
|
|
428
|
+
/** Tag each indicator line's latest value on its value axis (default on). */
|
|
429
|
+
setIndicatorValueLabelsVisible(visible: boolean): void;
|
|
147
430
|
/** Write each pane's indicator name and hovered values in its header (default); off when you label panes yourself. */
|
|
148
431
|
setPaneTitlesVisible(visible: boolean): void;
|
|
149
432
|
/**
|
|
@@ -157,7 +440,28 @@ export declare class Chart {
|
|
|
157
440
|
* so a bar index on screen is not an index into the data.
|
|
158
441
|
*/
|
|
159
442
|
isTimeAligned(): boolean;
|
|
160
|
-
/**
|
|
443
|
+
/**
|
|
444
|
+
* A price on the market's grid: a multiple of its smallest step (`minTick`),
|
|
445
|
+
* else rounded to its precision, else to the decimals the axis shows.
|
|
446
|
+
*/
|
|
447
|
+
roundPrice(price: number): number;
|
|
448
|
+
/**
|
|
449
|
+
* How prices read on the price scale and everything that prints one: a
|
|
450
|
+
* function of yours, fractions of a point (`{ denominator: 32 }` prints
|
|
451
|
+
* `101'16`), or null for decimals. Indicator panes keep their own numbers.
|
|
452
|
+
*/
|
|
453
|
+
setPriceFormat(format: PriceFormatter | PriceFraction | null): void;
|
|
454
|
+
/** The chart's price format as a function (`priceFormat`), or null for decimals. */
|
|
455
|
+
getPriceFormatter(): PriceFormatter | null;
|
|
456
|
+
private applyPriceFormat;
|
|
457
|
+
/** How times read on the time axis, the crosshair and the tooltip; null for the chart's own. */
|
|
458
|
+
setTimeFormatter(formatter: TimeFormatter | null): void;
|
|
459
|
+
private applyTimeFormatter;
|
|
460
|
+
/**
|
|
461
|
+
* A price as the price axis writes it: in the chart's price format when it
|
|
462
|
+
* has one (`priceFormat`), else at the market's precision or the visible
|
|
463
|
+
* range's, in the number locale.
|
|
464
|
+
*/
|
|
161
465
|
formatPrice(price: number): string;
|
|
162
466
|
setDrawingTool(type: DrawingToolType | null): void;
|
|
163
467
|
getDrawingTool(): DrawingToolType | null;
|
|
@@ -183,6 +487,8 @@ export declare class Chart {
|
|
|
183
487
|
type: import('@tradecanvas/commons').DrawingToolType;
|
|
184
488
|
anchors: import('@tradecanvas/commons').AnchorPoint[];
|
|
185
489
|
style?: Partial<DrawingStyle>;
|
|
490
|
+
/** The tool's own settings (see `getDrawingOptionDefs`); its defaults fill the rest. */
|
|
491
|
+
options?: DrawingOptions;
|
|
186
492
|
visible?: boolean;
|
|
187
493
|
locked?: boolean;
|
|
188
494
|
meta?: Record<string, unknown>;
|
|
@@ -193,46 +499,141 @@ export declare class Chart {
|
|
|
193
499
|
*/
|
|
194
500
|
autoFib(): string | null;
|
|
195
501
|
removeDrawing(id: string): void;
|
|
502
|
+
/** Remove several drawings as one undo step; locked ones stay. Returns how many went. */
|
|
503
|
+
removeDrawings(ids: readonly string[]): number;
|
|
504
|
+
/** A drawing tool's name, anchors, options and style fields; null for an unknown tool. */
|
|
505
|
+
getDrawingToolDescriptor(type: DrawingToolType): DrawingDescriptor | null;
|
|
506
|
+
/** The settings a drawing tool offers beyond the shared style (levels, extend…), with defaults. */
|
|
507
|
+
getDrawingOptionDefs(type: DrawingToolType): DrawingOptionDefs;
|
|
508
|
+
/** Every option of a drawing, its tool's defaults filled in. */
|
|
509
|
+
getDrawingOptions(id: string): DrawingOptions;
|
|
510
|
+
/** Change some of a drawing's options; invalid ones are dropped. False for an unknown drawing. */
|
|
511
|
+
setDrawingOptions(id: string, options: DrawingOptions): boolean;
|
|
512
|
+
/**
|
|
513
|
+
* Change a drawing's anchors (as many as it has), style or options, as one
|
|
514
|
+
* undo step — or as part of the edit begun with `beginDrawingEdit`.
|
|
515
|
+
* Applies to locked drawings too. False for an unknown drawing or wrong anchors.
|
|
516
|
+
*/
|
|
517
|
+
updateDrawing(id: string, patch: DrawingPatch): boolean;
|
|
518
|
+
/** Start an edit (a settings dialog): the `updateDrawing` calls until `endDrawingEdit` are one undo step. */
|
|
519
|
+
beginDrawingEdit(id: string): boolean;
|
|
520
|
+
/** Keep the edit as one undo step, or with `cancel` put the drawing back as it was. */
|
|
521
|
+
endDrawingEdit(id: string, options?: {
|
|
522
|
+
cancel?: boolean;
|
|
523
|
+
}): void;
|
|
524
|
+
/** Options new drawings of `type` start with; null clears them. */
|
|
525
|
+
setDrawingToolDefaults(type: DrawingToolType, options: DrawingOptions | null): void;
|
|
526
|
+
getDrawingToolDefaults(type: DrawingToolType): DrawingOptions;
|
|
196
527
|
setDrawingVisible(id: string, visible: boolean): void;
|
|
197
528
|
setDrawingLocked(id: string, locked: boolean): void;
|
|
529
|
+
/** Show or hide several drawings (a selection, say) as one undo step. */
|
|
530
|
+
setDrawingsVisible(ids: readonly string[], visible: boolean): void;
|
|
531
|
+
/** Lock or unlock several drawings as one undo step. */
|
|
532
|
+
setDrawingsLocked(ids: readonly string[], locked: boolean): void;
|
|
198
533
|
clearDrawings(): void;
|
|
199
534
|
registerDrawingTool(plugin: DrawingPlugin): void;
|
|
200
535
|
undo(): boolean;
|
|
201
536
|
redo(): boolean;
|
|
537
|
+
/** Select a drawing (and the rest of its group); false for one it can't (unknown, hidden). */
|
|
538
|
+
selectDrawing(id: string): boolean;
|
|
202
539
|
getUndoRedoState(): {
|
|
203
540
|
canUndo: boolean;
|
|
204
541
|
canRedo: boolean;
|
|
205
542
|
};
|
|
206
|
-
/**
|
|
543
|
+
/**
|
|
544
|
+
* Put a change of yours in the chart's undo history, with its drawings and
|
|
545
|
+
* indicators: undo (Ctrl/Cmd+Z) calls `undo`, redo calls `redo`. Call it
|
|
546
|
+
* after making the change. Changes about the same `subject` close together
|
|
547
|
+
* merge into one step (a colour dragged across a picker). Ignored when
|
|
548
|
+
* `features.drawingUndoRedo` is off.
|
|
549
|
+
*/
|
|
550
|
+
recordUndo(step: {
|
|
551
|
+
undo: () => void;
|
|
552
|
+
redo: () => void;
|
|
553
|
+
subject?: string;
|
|
554
|
+
}): void;
|
|
555
|
+
/** The weak magnet on or off. Ignored (stays off) when `features.drawingMagnet` is false. */
|
|
207
556
|
setDrawingMagnet(enabled: boolean): void;
|
|
557
|
+
/** Whether a magnet (weak or strong) is on. */
|
|
208
558
|
getDrawingMagnet(): boolean;
|
|
559
|
+
/**
|
|
560
|
+
* Snap new anchors to the bar's open, high, low or close: 'weak' when the
|
|
561
|
+
* pointer is near one, 'strong' always. Stays off when
|
|
562
|
+
* `features.drawingMagnet` is false.
|
|
563
|
+
*/
|
|
564
|
+
setDrawingMagnetMode(mode: 'off' | 'weak' | 'strong'): void;
|
|
565
|
+
getDrawingMagnetMode(): 'off' | 'weak' | 'strong';
|
|
566
|
+
/** The price and bar time at a right-click, as far as its area has them. */
|
|
567
|
+
private contextAt;
|
|
568
|
+
/** Show or hide the "+" by the price axis (`features.priceAxisAddButton`). */
|
|
569
|
+
setPriceAxisAddButton(visible: boolean): void;
|
|
570
|
+
/**
|
|
571
|
+
* The eraser: while on, clicking a drawing removes it (each one undoable).
|
|
572
|
+
* Picking a drawing tool or pressing Escape turns it off. `toolModeChange`
|
|
573
|
+
* reports `{ eraser }`.
|
|
574
|
+
*/
|
|
575
|
+
setEraserMode(on: boolean): void;
|
|
576
|
+
isEraserMode(): boolean;
|
|
577
|
+
/**
|
|
578
|
+
* The zoom-area tool: the next drag draws a box and the chart zooms to its
|
|
579
|
+
* bars; then it turns itself off. `toolModeChange` reports `{ zoomArea }`.
|
|
580
|
+
*/
|
|
581
|
+
setZoomAreaMode(on: boolean): void;
|
|
582
|
+
isZoomAreaMode(): boolean;
|
|
583
|
+
/** Zoom to the bars under a box dragged in zoom-area mode. */
|
|
584
|
+
private zoomToBox;
|
|
209
585
|
lockAllDrawings(): void;
|
|
210
586
|
unlockAllDrawings(): void;
|
|
211
587
|
hideAllDrawings(): void;
|
|
212
588
|
showAllDrawings(): void;
|
|
213
589
|
duplicateDrawing(id?: string): string | null;
|
|
214
590
|
/** Does nothing when `features.dataExport` is false. */
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
591
|
+
/**
|
|
592
|
+
* Download the bars on screen as CSV or JSON, each indicator line in a
|
|
593
|
+
* column of its own (`indicators: false` leaves them out). Does nothing
|
|
594
|
+
* when `features.dataExport` is false.
|
|
595
|
+
*/
|
|
596
|
+
exportVisibleData(format?: 'csv' | 'json', filename?: string, options?: {
|
|
597
|
+
indicators?: boolean;
|
|
598
|
+
}): void;
|
|
599
|
+
/** `exportVisibleData` for every bar loaded. Does nothing when `features.dataExport` is false. */
|
|
600
|
+
exportAllData(format?: 'csv' | 'json', filename?: string, options?: {
|
|
601
|
+
indicators?: boolean;
|
|
602
|
+
}): void;
|
|
603
|
+
/**
|
|
604
|
+
* The bars and their indicator lines, one column per line named as the
|
|
605
|
+
* legend names it ("SMA 20", "MACD 12 26 9 Signal"): every bar loaded, or
|
|
606
|
+
* those on screen (`range: 'visible'`).
|
|
607
|
+
*/
|
|
608
|
+
getExportData(options?: {
|
|
609
|
+
range?: 'all' | 'visible';
|
|
610
|
+
indicators?: boolean;
|
|
611
|
+
}): {
|
|
612
|
+
bars: OHLCBar[];
|
|
613
|
+
columns: ExportColumn[];
|
|
614
|
+
};
|
|
615
|
+
/** `getExportData` as CSV or JSON text. */
|
|
616
|
+
getExportText(format?: 'csv' | 'json', options?: {
|
|
617
|
+
range?: 'all' | 'visible';
|
|
618
|
+
indicators?: boolean;
|
|
619
|
+
}): string;
|
|
620
|
+
private download;
|
|
218
621
|
setAutoSave(key: string, delayMs?: number): void;
|
|
219
622
|
disableAutoSave(): void;
|
|
220
623
|
private scheduleAutoSave;
|
|
624
|
+
/** Something a saved layout holds changed: auto-save it, and say so. */
|
|
625
|
+
private markStateChanged;
|
|
626
|
+
private announceStateChange;
|
|
221
627
|
getAvailableIndicators(): IndicatorDescriptor[];
|
|
222
628
|
getIndicatorInputs(id: string): {
|
|
223
629
|
id: string;
|
|
224
630
|
params: Record<string, unknown>;
|
|
225
631
|
} | null;
|
|
226
632
|
/** Get all active indicator instances with their current params */
|
|
227
|
-
getActiveIndicators():
|
|
228
|
-
instanceId: string;
|
|
229
|
-
id: string;
|
|
230
|
-
params: Record<string, unknown>;
|
|
231
|
-
descriptor: IndicatorDescriptor;
|
|
232
|
-
visible: boolean;
|
|
233
|
-
}[];
|
|
633
|
+
getActiveIndicators(): import('@tradecanvas/core').ActiveIndicatorInfo[];
|
|
234
634
|
/** Show or hide an indicator without removing it. */
|
|
235
635
|
setIndicatorVisible(instanceId: string, visible: boolean): void;
|
|
636
|
+
private setIndicatorVisibleNow;
|
|
236
637
|
/** Get current config for a specific indicator instance */
|
|
237
638
|
getIndicatorConfig(instanceId: string): {
|
|
238
639
|
id: string;
|
|
@@ -244,6 +645,7 @@ export declare class Chart {
|
|
|
244
645
|
lineWidths?: number[];
|
|
245
646
|
opacity?: number;
|
|
246
647
|
}): void;
|
|
648
|
+
private updateIndicatorStyleNow;
|
|
247
649
|
setOrders(orders: TradingOrder[]): void;
|
|
248
650
|
/**
|
|
249
651
|
* Begin placing a draggable bracket order (entry + stop-loss + take-profit).
|
|
@@ -273,17 +675,50 @@ export declare class Chart {
|
|
|
273
675
|
*/
|
|
274
676
|
placeOrderIntent(intent: import('@tradecanvas/commons').OrderPlaceIntent): void;
|
|
275
677
|
setPositions(positions: TradingPosition[]): void;
|
|
678
|
+
/** The working orders on the chart (`setOrders`, or the execution adapter's). */
|
|
679
|
+
getOrders(): TradingOrder[];
|
|
680
|
+
/** The open positions on the chart (`setPositions`, or the execution adapter's). */
|
|
681
|
+
getPositions(): TradingPosition[];
|
|
682
|
+
/** Fills marked on the chart, oldest first: the execution adapter's, or `addFill`'s. */
|
|
683
|
+
getFills(): import('@tradecanvas/commons').FillEvent[];
|
|
684
|
+
/** The P&L the fills realised since the last `clearFills`, all of them (the marks keep the latest 1000). */
|
|
685
|
+
getRealisedPnl(): number;
|
|
686
|
+
/** Mark a fill on the chart (without an execution adapter, a host reports its own). */
|
|
687
|
+
addFill(fill: import('@tradecanvas/commons').FillEvent): void;
|
|
688
|
+
clearFills(): void;
|
|
689
|
+
/**
|
|
690
|
+
* Ask for an order to be cancelled: emits `orderCancel`, which an execution
|
|
691
|
+
* adapter carries out (as the × on the order's line does).
|
|
692
|
+
*/
|
|
693
|
+
cancelOrderIntent(orderId: string): void;
|
|
694
|
+
/** Ask for a position to be closed: emits `positionClose`. */
|
|
695
|
+
closePositionIntent(positionId: string): void;
|
|
696
|
+
/** Ask for a position to be reversed (closed, then the same size the other way): emits `positionReverse`. */
|
|
697
|
+
reversePositionIntent(positionId: string): void;
|
|
698
|
+
/** Ask for a position's stop-loss or take-profit to change (null removes it): emits `positionModify`. */
|
|
699
|
+
modifyPositionIntent(intent: import('@tradecanvas/commons').PositionModifyIntent): void;
|
|
276
700
|
setDepthData(depth: DepthData | null): void;
|
|
277
701
|
setCurrentPrice(price: number, _pulseColor?: string): void;
|
|
702
|
+
/** Whether a paper account trades on the replay (it takes a mark price) rather than on the live price. */
|
|
703
|
+
private replayTrades;
|
|
704
|
+
/** The orders and the alerts follow a live price (a paper account in a replay follows the replay). */
|
|
705
|
+
private followLivePrice;
|
|
706
|
+
/**
|
|
707
|
+
* Alerts against a live price, and against the indicator lines they watch,
|
|
708
|
+
* all as of the same moment (a line crossing another compares like with
|
|
709
|
+
* like). During a replay they keep watching the live market: the bars are
|
|
710
|
+
* the live ones, and indicator lines — computed on the replayed bars — wait.
|
|
711
|
+
*/
|
|
712
|
+
private checkAlerts;
|
|
278
713
|
/**
|
|
279
|
-
*
|
|
714
|
+
* The latest values of the indicator lines alerts watch or compare with.
|
|
280
715
|
* Channel format: `<instanceId>:<key>`; instanceIds are `tc_<id>_<n>` and
|
|
281
716
|
* built-in keys are colon-free, so the first colon splits them. Values come
|
|
282
717
|
* from the recalculated series, so indicator alerts evaluate at bar cadence
|
|
283
718
|
* (the live intrabar tick doesn't repaint closed-bar indicator values).
|
|
284
719
|
* Cheap — only walks alerts whose channel isn't `'price'`, usually none.
|
|
285
720
|
*/
|
|
286
|
-
private
|
|
721
|
+
private collectIndicatorValues;
|
|
287
722
|
setTradingConfig(config: Partial<TradingConfig>): void;
|
|
288
723
|
/**
|
|
289
724
|
* Connect to a real-time data source.
|
|
@@ -298,6 +733,8 @@ export declare class Chart {
|
|
|
298
733
|
* });
|
|
299
734
|
*/
|
|
300
735
|
connect(config: StreamConfig): Promise<void>;
|
|
736
|
+
/** The stream's symbol and timeframe, told when they change. */
|
|
737
|
+
private setStreamTarget;
|
|
301
738
|
/**
|
|
302
739
|
* Switch symbol or timeframe on an active stream without full reconnect.
|
|
303
740
|
*/
|
|
@@ -371,6 +808,8 @@ export declare class Chart {
|
|
|
371
808
|
*/
|
|
372
809
|
setVisibleRangePreset(preset: RangePreset): void;
|
|
373
810
|
scrollToEnd(): void;
|
|
811
|
+
/** Scroll by `bars` bars: later for a positive count, earlier for a negative one. */
|
|
812
|
+
scrollBars(bars: number): void;
|
|
374
813
|
/**
|
|
375
814
|
* Show the bars between two timestamps edge to edge. Times past either end
|
|
376
815
|
* of the data are allowed (they map into the empty future / past).
|
|
@@ -455,10 +894,28 @@ export declare class Chart {
|
|
|
455
894
|
isPeriodLevelsVisible(): boolean;
|
|
456
895
|
setPeriodLevelsPeriod(period: import('@tradecanvas/core').LevelPeriod): void;
|
|
457
896
|
/**
|
|
458
|
-
*
|
|
459
|
-
*
|
|
460
|
-
*
|
|
897
|
+
* The timezone for the time axis, crosshair, tooltip, day breaks and range
|
|
898
|
+
* presets: an IANA zone (`'America/New_York'`, daylight saving included), a
|
|
899
|
+
* fixed offset in minutes east of UTC (`-300`, `330`), or null for the
|
|
900
|
+
* browser's. Throws a RangeError for a zone the browser doesn't know.
|
|
461
901
|
*/
|
|
902
|
+
setTimezone(tz: TimeZoneSetting): void;
|
|
903
|
+
/** What `setTimezone` was given — `'exchange'` included. */
|
|
904
|
+
getTimezone(): TimeZoneSetting;
|
|
905
|
+
/** The zone the chart shows: `'exchange'` resolved to the symbol's zone (UTC when unknown). */
|
|
906
|
+
getEffectiveTimezone(): TimeZoneSetting;
|
|
907
|
+
private applyTimezone;
|
|
908
|
+
/**
|
|
909
|
+
* What is known about the symbol on the chart — usually from the stream's
|
|
910
|
+
* adapter (`resolveSymbol`), which a connected chart asks by itself. Its
|
|
911
|
+
* price precision applies unless `setMarket` set one; its zone backs
|
|
912
|
+
* `setTimezone('exchange')`; its hours feed the session shading.
|
|
913
|
+
*/
|
|
914
|
+
setSymbolInfo(info: SymbolInfo | null): void;
|
|
915
|
+
getSymbolInfo(): SymbolInfo | null;
|
|
916
|
+
/** Ask the stream's adapter about `symbol`, if it can tell; a late answer about another symbol is dropped. */
|
|
917
|
+
private resolveStreamSymbol;
|
|
918
|
+
/** `setTimezone` with a fixed offset in minutes east of UTC, or null for the browser's zone. */
|
|
462
919
|
setTimezoneOffset(minutes: number | null): void;
|
|
463
920
|
setPivotMarkersVisible(visible: boolean): void;
|
|
464
921
|
isPivotMarkersVisible(): boolean;
|
|
@@ -475,7 +932,7 @@ export declare class Chart {
|
|
|
475
932
|
* `windows` for a split session — a market with a midday recess (e.g. SET's
|
|
476
933
|
* 10:00–12:30 and 14:30–16:30) — so the lunch break dims like pre-/post-market.
|
|
477
934
|
*/
|
|
478
|
-
setSessionShadingConfig(config: Partial<
|
|
935
|
+
setSessionShadingConfig(config: Partial<SessionHoursConfig>): void;
|
|
479
936
|
setTooltipVisible(visible: boolean): void;
|
|
480
937
|
setLegend(config: Partial<import('@tradecanvas/core').LegendConfig>): void;
|
|
481
938
|
setSymbolName(symbol: string): void;
|
|
@@ -489,11 +946,61 @@ export declare class Chart {
|
|
|
489
946
|
copyScreenshot(): Promise<boolean>;
|
|
490
947
|
screenshotDataURL(): string | null;
|
|
491
948
|
screenshotBlob(): Promise<Blob | null>;
|
|
492
|
-
|
|
949
|
+
/**
|
|
950
|
+
* Add an alert on `channel` (`'price'`, or an indicator line
|
|
951
|
+
* `'<instanceId>:<key>'`) at `price`. `options` compare with another line
|
|
952
|
+
* instead (`target`), measure a move (`movesUp` / `movesDown` with
|
|
953
|
+
* `percent` and `bars`), look only at closed bars (`onBarClose`), or end it
|
|
954
|
+
* (`expiresAt`). Throws a RangeError for options that don't fit together.
|
|
955
|
+
*/
|
|
956
|
+
addAlert(price: number, condition?: import('@tradecanvas/core').AlertCondition, message?: string, channel?: string, label?: string, options?: import('@tradecanvas/core').AlertOptions): string | null;
|
|
493
957
|
removeAlert(id: string): void;
|
|
958
|
+
/** Ids of the selected drawings, the one clicked last first. */
|
|
959
|
+
getSelectedDrawingIds(): string[];
|
|
960
|
+
/** Draw a drawing on top of the others, under them, or one step up or down. False when already there. */
|
|
961
|
+
moveDrawing(id: string, to: DrawingOrderMove): boolean;
|
|
962
|
+
/** Group drawings (two or more): they are then selected, hidden and locked together. Returns the group id. */
|
|
963
|
+
groupDrawings(ids: readonly string[], name?: string): string | null;
|
|
964
|
+
ungroupDrawings(groupId: string): boolean;
|
|
965
|
+
renameDrawingGroup(groupId: string, name: string): boolean;
|
|
966
|
+
setDrawingGroupVisible(groupId: string, visible: boolean): boolean;
|
|
967
|
+
setDrawingGroupLocked(groupId: string, locked: boolean): boolean;
|
|
968
|
+
/** Every drawing group, its drawings bottom to top. */
|
|
969
|
+
getDrawingGroups(): {
|
|
970
|
+
id: string;
|
|
971
|
+
name: string;
|
|
972
|
+
ids: string[];
|
|
973
|
+
}[];
|
|
974
|
+
private afterDrawingChange;
|
|
975
|
+
/** Whether a drawing has lines an alert can cross (trend lines, rays, horizontals, channels). */
|
|
976
|
+
canAddDrawingAlert(drawingId: string): boolean;
|
|
977
|
+
/**
|
|
978
|
+
* Where a drawing's lines are at the latest bar, as drawn on the chart's
|
|
979
|
+
* scale; null when it has none there (a trend line that ends before it).
|
|
980
|
+
*/
|
|
981
|
+
private drawingLevelsNow;
|
|
982
|
+
/**
|
|
983
|
+
* A drawing's alerts go with it, and come back with it when an undo
|
|
984
|
+
* brings the drawing back.
|
|
985
|
+
*/
|
|
986
|
+
private followDrawingAlerts;
|
|
987
|
+
/** Remove alerts on drawings no longer on the chart (drawings replaced or cleared). */
|
|
988
|
+
private dropOrphanDrawingAlerts;
|
|
989
|
+
/**
|
|
990
|
+
* Alert when the price crosses a drawing's line(s): a trend line where it
|
|
991
|
+
* is at the latest bar, any line of a channel. Removed with the drawing.
|
|
992
|
+
* Null when the drawing has no line to cross.
|
|
993
|
+
*/
|
|
994
|
+
addDrawingAlert(drawingId: string, options?: {
|
|
995
|
+
condition?: 'crossing' | 'crossingUp' | 'crossingDown';
|
|
996
|
+
message?: string;
|
|
997
|
+
repeating?: boolean;
|
|
998
|
+
label?: string;
|
|
999
|
+
}): string | null;
|
|
494
1000
|
getAlerts(): import('@tradecanvas/core').PriceAlert[];
|
|
495
1001
|
clearAlerts(): void;
|
|
496
1002
|
saveAlerts(key: string): void;
|
|
1003
|
+
/** Load alerts saved with `saveAlerts`. Alerts on drawings that aren't on the chart are dropped. */
|
|
497
1004
|
loadAlerts(key: string): void;
|
|
498
1005
|
addSignalMarker(marker: Omit<import('@tradecanvas/commons').SignalMarker, 'id'> & {
|
|
499
1006
|
id?: string;
|
|
@@ -518,8 +1025,32 @@ export declare class Chart {
|
|
|
518
1025
|
* aside (orders still track the live price), the price line shows the
|
|
519
1026
|
* replayed close, and auto-scale refits every step. `replayStop()` brings
|
|
520
1027
|
* back the live series, including everything that arrived meanwhile.
|
|
1028
|
+
*
|
|
1029
|
+
* With `steps` (finer bars), each step grows the forming bar from them.
|
|
1030
|
+
* A connected execution adapter that takes a mark price (a paper one)
|
|
1031
|
+
* trades on the replayed price and time.
|
|
521
1032
|
*/
|
|
522
1033
|
replayStart(config?: Partial<import('@tradecanvas/core').ReplayConfig>): void;
|
|
1034
|
+
/** Jump the replay to show the bars (or finer steps) that opened before `time`. */
|
|
1035
|
+
replaySeekToTime(time: number): void;
|
|
1036
|
+
/** A replay step's price to an adapter that takes a mark (a paper account), and to the orders on the chart. */
|
|
1037
|
+
private feedReplayPrice;
|
|
1038
|
+
/** A paper account trading on the replay goes back to the live price (the orders too), and its fills to the clock. */
|
|
1039
|
+
private returnMarkToLive;
|
|
1040
|
+
/**
|
|
1041
|
+
* A paper account trades on the replayed prices and times, forward only:
|
|
1042
|
+
* it gets every step past the latest time it has seen (a jump ahead passes
|
|
1043
|
+
* them all, a long one in chunks), and nothing after a seek back or a
|
|
1044
|
+
* restart from an earlier bar until the replay is past that time again.
|
|
1045
|
+
*/
|
|
1046
|
+
private feedReplaySteps;
|
|
1047
|
+
/**
|
|
1048
|
+
* The bar of the chart's series the replay is on (the forming one), or -1
|
|
1049
|
+
* without a replay.
|
|
1050
|
+
*/
|
|
1051
|
+
getReplayBarIndex(): number;
|
|
1052
|
+
/** Jump the replay to the end of bar `barIndex` of the chart's series (a click on it). */
|
|
1053
|
+
replaySeekToBar(barIndex: number): void;
|
|
523
1054
|
replayPause(): void;
|
|
524
1055
|
replayResume(): void;
|
|
525
1056
|
/** End the replay and return to the live series (with updates that arrived meanwhile). */
|
|
@@ -545,6 +1076,44 @@ export declare class Chart {
|
|
|
545
1076
|
};
|
|
546
1077
|
/** Everything `loadState` restores: chart type, theme, drawings, indicators, alerts. */
|
|
547
1078
|
private captureSnapshot;
|
|
1079
|
+
/**
|
|
1080
|
+
* Put `list` in place of the chart's indicators (a layout, a template, an
|
|
1081
|
+
* undo), with their panes as they were: size, order, fold, maximise.
|
|
1082
|
+
* `keepIds` keeps each instance's id (an undo): the indicators still alike
|
|
1083
|
+
* are changed in place, not taken down and put back. Otherwise the ids are
|
|
1084
|
+
* new and the map says old → new.
|
|
1085
|
+
*/
|
|
1086
|
+
private restoreIndicators;
|
|
1087
|
+
/** An indicator's style, visibility and levels as `ind` has them, changing only what differs. */
|
|
1088
|
+
private restoreLooks;
|
|
1089
|
+
/** The panes as they were: size first (it opens a fold), then fold, order, maximise. */
|
|
1090
|
+
private restorePanes;
|
|
1091
|
+
/**
|
|
1092
|
+
* The chart's indicators as a layout or a template keeps them: inputs,
|
|
1093
|
+
* style, levels, scale and panes (shared, size, order, fold, maximise).
|
|
1094
|
+
*/
|
|
1095
|
+
getIndicatorSetup(): import('@tradecanvas/core').SnapshotIndicator[];
|
|
1096
|
+
/**
|
|
1097
|
+
* Put a set of indicators (from `getIndicatorSetup`, a template) in place
|
|
1098
|
+
* of the chart's, as one undo step.
|
|
1099
|
+
*/
|
|
1100
|
+
applyIndicatorSetup(list: readonly SnapshotIndicator[]): void;
|
|
1101
|
+
/**
|
|
1102
|
+
* Alerts on the lines of indicators that went (`before`: id → kind) move to
|
|
1103
|
+
* the one new indicator of the same kind (`added`), when there is just one;
|
|
1104
|
+
* others stay as they are, as alerts on a removed indicator do.
|
|
1105
|
+
*/
|
|
1106
|
+
private followIndicatorAlerts;
|
|
1107
|
+
/** Run `change` without recording undo steps for the indicators it changes. */
|
|
1108
|
+
private withoutIndicatorHistory;
|
|
1109
|
+
/**
|
|
1110
|
+
* Run an indicator change as one undo step (the indicators before and
|
|
1111
|
+
* after). Quick changes to the same indicator (a colour dragged, a period
|
|
1112
|
+
* typed) merge into one step.
|
|
1113
|
+
*/
|
|
1114
|
+
private recordIndicators;
|
|
1115
|
+
/** Undo or redo an indicator step: the indicators as they were, under their own ids. */
|
|
1116
|
+
private applyIndicatorStep;
|
|
548
1117
|
saveState(key?: string): string | null;
|
|
549
1118
|
loadState(json: string): void;
|
|
550
1119
|
loadStateFromStorage(key: string): boolean;
|
|
@@ -559,6 +1128,8 @@ export declare class Chart {
|
|
|
559
1128
|
setNumberLocale(locale: string): void;
|
|
560
1129
|
getNumberLocale(): string;
|
|
561
1130
|
setMarket(config: MarketConfig): void;
|
|
1131
|
+
/** Prices show `precision` decimals everywhere; null goes back to fitting the price range. */
|
|
1132
|
+
private applyPricePrecision;
|
|
562
1133
|
getMarket(): MarketConfig | null;
|
|
563
1134
|
setPriceLimits(referencePrice: number): void;
|
|
564
1135
|
/** Get the resolved feature configuration */
|
|
@@ -593,6 +1164,14 @@ export declare class Chart {
|
|
|
593
1164
|
private applyDataToViewport;
|
|
594
1165
|
/** Full update: resolve layout, update viewport, sync context, request render. */
|
|
595
1166
|
private updateViewportAndRender;
|
|
1167
|
+
/**
|
|
1168
|
+
* Fit the data to the plot, then size both price scales to their labels. A
|
|
1169
|
+
* scale that changes width changes the plot, so the data is fit again —
|
|
1170
|
+
* before anything reads the layout for this frame.
|
|
1171
|
+
*/
|
|
1172
|
+
private fitDataAndAxes;
|
|
1173
|
+
/** Size the left scale to its widest label; true when the layout changed. */
|
|
1174
|
+
private fitLeftAxisWidth;
|
|
596
1175
|
/**
|
|
597
1176
|
* Size the price axis to its widest label (tick labels, last-price tag,
|
|
598
1177
|
* crosshair pill), as an auto-width scale — so a sub-cent
|
|
@@ -614,9 +1193,13 @@ export declare class Chart {
|
|
|
614
1193
|
/** Cache container size for 500ms to avoid layout thrashing on rapid calls */
|
|
615
1194
|
private cachedContainerSize;
|
|
616
1195
|
private buildPanelRenderInfos;
|
|
1196
|
+
/** Where the time axis starts: below the main chart and every pane under it. */
|
|
1197
|
+
private timeAxisTop;
|
|
617
1198
|
private syncRenderContext;
|
|
618
1199
|
/** Draw registered overlay plugins for a layer (called by the engine). */
|
|
619
1200
|
private drawOverlayPlugins;
|
|
620
1201
|
private buildPriceLimits;
|
|
621
1202
|
}
|
|
1203
|
+
type SnapshotIndicator = import('@tradecanvas/core').SnapshotIndicator;
|
|
1204
|
+
export {};
|
|
622
1205
|
//# sourceMappingURL=Chart.d.ts.map
|