@tradecanvas/chart 0.9.0 → 1.0.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/dist/Chart.d.ts +148 -5
- package/dist/Chart.d.ts.map +1 -1
- package/dist/{DragDropImporter-6QOjnfSj.js → DragDropImporter-C4x09P7e.js} +446 -112
- package/dist/DragDropImporter-C4x09P7e.js.map +1 -0
- package/dist/DragDropImporter-DeXlngof.cjs +2 -0
- package/dist/DragDropImporter-DeXlngof.cjs.map +1 -0
- package/dist/charts/ChartTypeStrategy.d.ts +13 -0
- package/dist/charts/ChartTypeStrategy.d.ts.map +1 -1
- package/dist/finance/PerformanceDashboard.d.ts +43 -0
- package/dist/finance/PerformanceDashboard.d.ts.map +1 -0
- package/dist/finance/index.d.ts +4 -0
- package/dist/finance/index.d.ts.map +1 -1
- package/dist/finance/performanceData.d.ts +39 -0
- package/dist/finance/performanceData.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +293 -36
- package/dist/index.js.map +1 -1
- package/dist/io/index.d.ts +2 -0
- package/dist/io/index.d.ts.map +1 -1
- package/dist/io/resampleOHLCV.d.ts +29 -0
- package/dist/io/resampleOHLCV.d.ts.map +1 -0
- package/dist/plugins/PluginManager.d.ts +27 -1
- package/dist/plugins/PluginManager.d.ts.map +1 -1
- package/dist/plugins/contracts.d.ts +54 -0
- package/dist/plugins/contracts.d.ts.map +1 -0
- package/dist/plugins/index.d.ts +4 -0
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/registry.d.ts +10 -0
- package/dist/plugins/registry.d.ts.map +1 -0
- package/dist/trading/wireExecution.d.ts +26 -0
- package/dist/trading/wireExecution.d.ts.map +1 -0
- package/dist/widget/AlertNotifier.d.ts +32 -0
- package/dist/widget/AlertNotifier.d.ts.map +1 -0
- package/dist/widget/ChartWidget.d.ts +54 -1
- package/dist/widget/ChartWidget.d.ts.map +1 -1
- package/dist/widget/DrawingFavoritesStore.d.ts +22 -0
- package/dist/widget/DrawingFavoritesStore.d.ts.map +1 -0
- package/dist/widget/DrawingTemplateStore.d.ts +29 -0
- package/dist/widget/DrawingTemplateStore.d.ts.map +1 -0
- package/dist/widget/WidgetAlertsPanel.d.ts +58 -0
- package/dist/widget/WidgetAlertsPanel.d.ts.map +1 -0
- package/dist/widget/WidgetBracketBar.d.ts +21 -0
- package/dist/widget/WidgetBracketBar.d.ts.map +1 -0
- package/dist/widget/WidgetDataWindow.d.ts +41 -0
- package/dist/widget/WidgetDataWindow.d.ts.map +1 -0
- package/dist/widget/WidgetDepthLadder.d.ts +29 -0
- package/dist/widget/WidgetDepthLadder.d.ts.map +1 -0
- package/dist/widget/WidgetDrawingSidebar.d.ts +6 -0
- package/dist/widget/WidgetDrawingSidebar.d.ts.map +1 -1
- package/dist/widget/WidgetDrawingStyle.d.ts +36 -0
- package/dist/widget/WidgetDrawingStyle.d.ts.map +1 -0
- package/dist/widget/WidgetHotkeySheet.d.ts.map +1 -1
- package/dist/widget/WidgetIndicatorSettings.d.ts +42 -0
- package/dist/widget/WidgetIndicatorSettings.d.ts.map +1 -0
- package/dist/widget/WidgetObjectTree.d.ts +59 -0
- package/dist/widget/WidgetObjectTree.d.ts.map +1 -0
- package/dist/widget/WidgetReplayBar.d.ts +1 -1
- package/dist/widget/WidgetSettings.d.ts +1 -0
- package/dist/widget/WidgetSettings.d.ts.map +1 -1
- package/dist/widget/WidgetSymbolSearch.d.ts +3 -1
- package/dist/widget/WidgetSymbolSearch.d.ts.map +1 -1
- package/dist/widget/WidgetToolbar.d.ts.map +1 -1
- package/dist/widget/icons.d.ts.map +1 -1
- package/dist/widget/index.cjs +947 -15
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.js +1826 -159
- package/dist/widget/index.js.map +1 -1
- package/dist/widget/ladderRows.d.ts +21 -0
- package/dist/widget/ladderRows.d.ts.map +1 -0
- package/dist/widget/types.d.ts +72 -1
- package/dist/widget/types.d.ts.map +1 -1
- package/dist/widget/widgetConfig.d.ts.map +1 -1
- package/dist/widget/widgetShareState.d.ts +26 -0
- package/dist/widget/widgetShareState.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/DragDropImporter-6QOjnfSj.js.map +0 -1
- package/dist/DragDropImporter-CQ3EarQn.cjs +0 -2
- package/dist/DragDropImporter-CQ3EarQn.cjs.map +0 -1
|
@@ -1,57 +1,66 @@
|
|
|
1
1
|
import { DARK_THEME as e, DEFAULT_PANEL_HEIGHT as t, LIGHT_THEME as n, LayerType as r, MIN_PANEL_HEIGHT as i, PRICE_AXIS_WIDTH as a, TIME_AXIS_HEIGHT as o, computePriceLimits as s, mergeBar as c, setLocale as l, timeframeToMs as u } from "@tradecanvas/commons";
|
|
2
|
-
import {
|
|
2
|
+
import { AlertDragHandler as d, AlertManager as f, Animator as p, AreaRenderer as m, AxisDragHandler as ee, BarCountdown as te, BarRenderer as h, BaselineRenderer as ne, CandlestickRenderer as g, ChartLegend as re, ChartStateManager as _, CompareRenderer as ie, CrosshairHandler as ae, CrosshairTooltip as oe, CurrentPriceLine as se, DataExporter as v, DepthHeatmapRenderer as ce, DrawingManager as le, DrawingRenderer as ue, EquivolumeRenderer as de, EventBus as fe, GridRenderer as pe, HLCAreaRenderer as me, HollowCandleRenderer as he, IndicatorEngine as y, InteractionManager as ge, KagiRenderer as _e, KeyboardHandler as ve, LineRenderer as ye, LineWithMarkersRenderer as be, MarketProfileRenderer as xe, MeasureOverlay as Se, PanHandler as Ce, PaneResizeHandler as we, PeriodLevelsRenderer as Te, PinnedTooltip as Ee, PivotMarkersRenderer as De, PointAndFigureRenderer as Oe, PriceAxis as ke, RenderEngine as Ae, RenkoRenderer as b, ReplayManager as x, Screenshot as S, SessionBreaks as C, SessionShading as je, SignalMarkerManager as Me, StepLineRenderer as Ne, StreamManager as Pe, TimeAxis as Fe, TradeZoneManager as Ie, TradingManager as Le, TradingRenderer as Re, UndoRedoManager as ze, Viewport as Be, VolumeCandleRenderer as Ve, VolumeProfileRenderer as He, VolumeRenderer as Ue, Watermark as We, ZoomHandler as Ge, findDominantSwing as Ke, registerBuiltInDrawingTools as qe, registerBuiltInIndicators as w, toHeikinAshi as Je, toKagi as Ye, toLineBreak as Xe, toPointAndFigure as Ze, toRangeBars as Qe, toRenko as T, xToBarIndex as $e } from "@tradecanvas/core";
|
|
3
3
|
//#region src/charts/ChartTypeStrategy.ts
|
|
4
|
-
function
|
|
4
|
+
function et(e) {
|
|
5
5
|
switch (e) {
|
|
6
6
|
case "candlestick":
|
|
7
7
|
case "heikinAshi":
|
|
8
8
|
case "lineBreak":
|
|
9
|
-
case "rangeBars": return new
|
|
10
|
-
case "line": return new
|
|
11
|
-
case "area": return new
|
|
12
|
-
case "bar": return new
|
|
13
|
-
case "hollowCandle": return new
|
|
9
|
+
case "rangeBars": return new g();
|
|
10
|
+
case "line": return new ye();
|
|
11
|
+
case "area": return new m();
|
|
12
|
+
case "bar": return new h();
|
|
13
|
+
case "hollowCandle": return new he();
|
|
14
14
|
case "baseline": return new ne();
|
|
15
|
-
case "renko": return new
|
|
16
|
-
case "kagi": return new
|
|
17
|
-
case "pointAndFigure": return new
|
|
18
|
-
case "volumeCandles": return new
|
|
19
|
-
case "equivolume": return new
|
|
20
|
-
case "hlcArea": return new
|
|
21
|
-
case "stepLine": return new
|
|
22
|
-
case "lineWithMarkers": return new
|
|
23
|
-
default: return new
|
|
15
|
+
case "renko": return new b();
|
|
16
|
+
case "kagi": return new _e();
|
|
17
|
+
case "pointAndFigure": return new Oe();
|
|
18
|
+
case "volumeCandles": return new Ve();
|
|
19
|
+
case "equivolume": return new de();
|
|
20
|
+
case "hlcArea": return new me();
|
|
21
|
+
case "stepLine": return new Ne();
|
|
22
|
+
case "lineWithMarkers": return new be();
|
|
23
|
+
default: return new g();
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function tt(e, t) {
|
|
27
27
|
if (t.length === 0) return t;
|
|
28
28
|
switch (e) {
|
|
29
|
-
case "heikinAshi": return
|
|
30
|
-
case "renko": return
|
|
29
|
+
case "heikinAshi": return Je(t);
|
|
30
|
+
case "renko": return T(t, {
|
|
31
31
|
brickSize: 0,
|
|
32
32
|
useATR: !0,
|
|
33
33
|
atrPeriod: 14
|
|
34
34
|
});
|
|
35
|
-
case "lineBreak": return
|
|
36
|
-
case "kagi": return
|
|
37
|
-
case "pointAndFigure": return
|
|
38
|
-
case "rangeBars": return
|
|
35
|
+
case "lineBreak": return Xe(t, 3);
|
|
36
|
+
case "kagi": return Ye(t, 4);
|
|
37
|
+
case "pointAndFigure": return Ze(t, E(t) * .01, 3);
|
|
38
|
+
case "rangeBars": return Qe(t, { rangeSize: E(t) * .005 });
|
|
39
39
|
default: return t;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function E(e) {
|
|
43
43
|
let t = 0;
|
|
44
44
|
for (let n of e) t += n.close;
|
|
45
45
|
return t / e.length;
|
|
46
46
|
}
|
|
47
|
+
function nt(e, t) {
|
|
48
|
+
let n = t?.(e);
|
|
49
|
+
return n ? n.createRenderer() : et(e);
|
|
50
|
+
}
|
|
51
|
+
function rt(e, t, n) {
|
|
52
|
+
if (t.length === 0) return t;
|
|
53
|
+
let r = n?.(e);
|
|
54
|
+
return r?.transform ? r.transform(t) : tt(e, t);
|
|
55
|
+
}
|
|
47
56
|
//#endregion
|
|
48
57
|
//#region src/charts/IndicatorPriceRange.ts
|
|
49
|
-
var
|
|
58
|
+
var D = {
|
|
50
59
|
min: 0,
|
|
51
60
|
max: 100
|
|
52
|
-
},
|
|
53
|
-
function
|
|
54
|
-
if (!e) return { ...
|
|
61
|
+
}, O = .1;
|
|
62
|
+
function it(e, t, n) {
|
|
63
|
+
if (!e) return { ...D };
|
|
55
64
|
let r = Infinity, i = -Infinity, a = 0;
|
|
56
65
|
for (let [, o] of e.values) {
|
|
57
66
|
if (a >= t && a <= n) for (let e in o) {
|
|
@@ -60,16 +69,16 @@ function Ue(e, t, n) {
|
|
|
60
69
|
}
|
|
61
70
|
a++;
|
|
62
71
|
}
|
|
63
|
-
if (r === Infinity) return { ...
|
|
72
|
+
if (r === Infinity) return { ...D };
|
|
64
73
|
let o = i - r || 1;
|
|
65
74
|
return {
|
|
66
|
-
min: r - o *
|
|
67
|
-
max: i + o *
|
|
75
|
+
min: r - o * O,
|
|
76
|
+
max: i + o * O
|
|
68
77
|
};
|
|
69
78
|
}
|
|
70
79
|
//#endregion
|
|
71
80
|
//#region src/state/AutoSaveScheduler.ts
|
|
72
|
-
var
|
|
81
|
+
var at = class {
|
|
73
82
|
timer = null;
|
|
74
83
|
delayMs = 0;
|
|
75
84
|
key = null;
|
|
@@ -99,12 +108,12 @@ var We = class {
|
|
|
99
108
|
};
|
|
100
109
|
//#endregion
|
|
101
110
|
//#region src/DataManager.ts
|
|
102
|
-
function
|
|
111
|
+
function k(e) {
|
|
103
112
|
if (!e || typeof e.time != "number") return !1;
|
|
104
113
|
let { open: t, high: n, low: r, close: i } = e;
|
|
105
114
|
return !(!isFinite(t) || !isFinite(n) || !isFinite(r) || !isFinite(i) || t < 0 || n < 0 || r < 0 || i < 0 || n < r || e.volume !== void 0 && (!isFinite(e.volume) || e.volume < 0));
|
|
106
115
|
}
|
|
107
|
-
function
|
|
116
|
+
function A(e) {
|
|
108
117
|
return {
|
|
109
118
|
...e,
|
|
110
119
|
high: Math.max(e.open, e.high, e.low, e.close),
|
|
@@ -112,20 +121,20 @@ function P(e) {
|
|
|
112
121
|
volume: e.volume === void 0 ? 0 : Math.max(0, e.volume)
|
|
113
122
|
};
|
|
114
123
|
}
|
|
115
|
-
var
|
|
124
|
+
var j = class {
|
|
116
125
|
data = [];
|
|
117
126
|
getData() {
|
|
118
127
|
return this.data;
|
|
119
128
|
}
|
|
120
129
|
setData(e) {
|
|
121
|
-
this.data = e.filter(
|
|
130
|
+
this.data = e.filter(k).map(A);
|
|
122
131
|
}
|
|
123
132
|
appendBar(e) {
|
|
124
|
-
|
|
133
|
+
k(e) && this.data.push(A(e));
|
|
125
134
|
}
|
|
126
135
|
updateLastBar(e) {
|
|
127
|
-
if (!
|
|
128
|
-
let t =
|
|
136
|
+
if (!k(e)) return;
|
|
137
|
+
let t = A(e);
|
|
129
138
|
if (this.data.length === 0) {
|
|
130
139
|
this.data.push(t);
|
|
131
140
|
return;
|
|
@@ -141,7 +150,7 @@ var F = class {
|
|
|
141
150
|
clear() {
|
|
142
151
|
this.data = [];
|
|
143
152
|
}
|
|
144
|
-
},
|
|
153
|
+
}, M = class {
|
|
145
154
|
theme;
|
|
146
155
|
constructor(t) {
|
|
147
156
|
!t || t === "dark" ? this.theme = { ...e } : t === "light" ? this.theme = { ...n } : this.theme = { ...t };
|
|
@@ -152,7 +161,7 @@ var F = class {
|
|
|
152
161
|
setTheme(t) {
|
|
153
162
|
t === "dark" ? this.theme = { ...e } : t === "light" ? this.theme = { ...n } : this.theme = { ...t };
|
|
154
163
|
}
|
|
155
|
-
},
|
|
164
|
+
}, N = 200, P = 80, F = class {
|
|
156
165
|
panels = [];
|
|
157
166
|
containerWidth = 0;
|
|
158
167
|
containerHeight = 0;
|
|
@@ -164,8 +173,8 @@ var F = class {
|
|
|
164
173
|
this.panels.push({
|
|
165
174
|
id: e,
|
|
166
175
|
position: n,
|
|
167
|
-
size: r ?? (a ?
|
|
168
|
-
minSize: a ?
|
|
176
|
+
size: r ?? (a ? N : t),
|
|
177
|
+
minSize: a ? P : i,
|
|
169
178
|
content: {
|
|
170
179
|
type: "indicator",
|
|
171
180
|
indicatorInstanceId: e
|
|
@@ -179,7 +188,7 @@ var F = class {
|
|
|
179
188
|
let r = this.panels.find((t) => t.id === e);
|
|
180
189
|
if (r) {
|
|
181
190
|
let e = r.position === "left" || r.position === "right", a = n === "left" || n === "right";
|
|
182
|
-
r.position = n, e !== a && (r.size = a ?
|
|
191
|
+
r.position = n, e !== a && (r.size = a ? N : t, r.minSize = a ? P : i);
|
|
183
192
|
}
|
|
184
193
|
}
|
|
185
194
|
setPanelSize(e, t) {
|
|
@@ -280,15 +289,95 @@ var F = class {
|
|
|
280
289
|
getMainChartRect() {
|
|
281
290
|
return this.resolve().mainChartRect;
|
|
282
291
|
}
|
|
283
|
-
},
|
|
284
|
-
|
|
285
|
-
|
|
292
|
+
}, ot = 1;
|
|
293
|
+
function I(e, t) {
|
|
294
|
+
return e.filter((e) => (e.descriptor.layer ?? "overlay") === t);
|
|
295
|
+
}
|
|
296
|
+
function L(e) {
|
|
297
|
+
switch (e.kind) {
|
|
298
|
+
case "indicator": return `indicator:${e.plugin.descriptor.id}`;
|
|
299
|
+
case "drawing": return `drawing:${e.plugin.descriptor.type}`;
|
|
300
|
+
case "chartType": return `chartType:${e.plugin.descriptor.type}`;
|
|
301
|
+
case "overlay": return `overlay:${e.plugin.descriptor.id}`;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
//#endregion
|
|
305
|
+
//#region src/plugins/registry.ts
|
|
306
|
+
var R = /* @__PURE__ */ new Map();
|
|
307
|
+
function st(e) {
|
|
308
|
+
R.set(L(e), e);
|
|
309
|
+
}
|
|
310
|
+
function ct(e) {
|
|
311
|
+
return R.delete(e);
|
|
312
|
+
}
|
|
313
|
+
function z() {
|
|
314
|
+
return [...R.values()];
|
|
315
|
+
}
|
|
316
|
+
function lt() {
|
|
317
|
+
R.clear();
|
|
318
|
+
}
|
|
319
|
+
//#endregion
|
|
320
|
+
//#region src/plugins/PluginManager.ts
|
|
321
|
+
var B = class {
|
|
322
|
+
plugins = /* @__PURE__ */ new Map();
|
|
323
|
+
constructor(e, t = {}) {
|
|
324
|
+
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of z()) this.add(e);
|
|
325
|
+
for (let e of t.plugins ?? []) this.add(e);
|
|
326
|
+
}
|
|
327
|
+
register(e) {
|
|
328
|
+
this.add(e);
|
|
329
|
+
}
|
|
330
|
+
unregister(e) {
|
|
331
|
+
return this.plugins.delete(e);
|
|
332
|
+
}
|
|
333
|
+
list() {
|
|
334
|
+
return [...this.plugins.values()];
|
|
286
335
|
}
|
|
287
336
|
registerIndicator(e) {
|
|
288
|
-
this.
|
|
337
|
+
this.add({
|
|
338
|
+
kind: "indicator",
|
|
339
|
+
plugin: e
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
getChartType(e) {
|
|
343
|
+
let t = this.plugins.get(`chartType:${e}`);
|
|
344
|
+
return t?.kind === "chartType" ? t.plugin : void 0;
|
|
345
|
+
}
|
|
346
|
+
getOverlays() {
|
|
347
|
+
let e = [];
|
|
348
|
+
for (let t of this.plugins.values()) t.kind === "overlay" && e.push(t.plugin);
|
|
349
|
+
return e;
|
|
289
350
|
}
|
|
290
|
-
|
|
291
|
-
|
|
351
|
+
add(e) {
|
|
352
|
+
this.plugins.set(L(e), e), e.kind === "indicator" && this.indicatorEngine.register(e.plugin);
|
|
353
|
+
}
|
|
354
|
+
}, V = {
|
|
355
|
+
orderPlace: (e, t) => e.placeOrder(t),
|
|
356
|
+
orderModify: (e, t) => e.modifyOrder(t),
|
|
357
|
+
orderCancel: (e, t) => e.cancelOrder(t),
|
|
358
|
+
positionModify: (e, t) => e.modifyPosition(t),
|
|
359
|
+
positionClose: (e, t) => e.closePosition(t)
|
|
360
|
+
};
|
|
361
|
+
function ut(e, t) {
|
|
362
|
+
let n = [], r = (e) => t.setOrders(e.data ?? []), i = (e) => t.setPositions(e.data ?? []), a = (e) => t.onError(e.data ?? { message: "Execution error" });
|
|
363
|
+
e.on("orders", r), e.on("positions", i), e.on("error", a), n.push(() => e.off("orders", r), () => e.off("positions", i), () => e.off("error", a));
|
|
364
|
+
for (let r of Object.keys(V)) {
|
|
365
|
+
let i = V[r], a = t.onIntent(r, (n) => {
|
|
366
|
+
Promise.resolve(i(e, n)).catch((e) => t.onError({
|
|
367
|
+
message: `Execution command failed: ${r}`,
|
|
368
|
+
cause: e
|
|
369
|
+
}));
|
|
370
|
+
});
|
|
371
|
+
n.push(a);
|
|
372
|
+
}
|
|
373
|
+
return () => {
|
|
374
|
+
for (let e of n) e();
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
//#endregion
|
|
378
|
+
//#region src/Chart.ts
|
|
379
|
+
var dt = class {
|
|
380
|
+
static version = "1.0.0";
|
|
292
381
|
engine;
|
|
293
382
|
viewport;
|
|
294
383
|
dataManager;
|
|
@@ -302,6 +391,8 @@ var F = class {
|
|
|
302
391
|
tradingRenderer;
|
|
303
392
|
eventBus;
|
|
304
393
|
streamManager = null;
|
|
394
|
+
executionAdapter = null;
|
|
395
|
+
execTeardown = null;
|
|
305
396
|
autoScrollOnNewBar = !0;
|
|
306
397
|
displayDataCache = null;
|
|
307
398
|
resolvedLayoutCache = null;
|
|
@@ -313,17 +404,22 @@ var F = class {
|
|
|
313
404
|
watermark;
|
|
314
405
|
barCountdown;
|
|
315
406
|
sessionBreaks;
|
|
407
|
+
sessionShading;
|
|
316
408
|
compareRenderer;
|
|
317
409
|
countdownInterval = null;
|
|
318
410
|
volumeRenderer;
|
|
319
411
|
volumeProfile;
|
|
412
|
+
marketProfile;
|
|
413
|
+
depthHeatmap;
|
|
414
|
+
periodLevels;
|
|
415
|
+
pivotMarkers;
|
|
320
416
|
alertManager;
|
|
321
417
|
signalMarkerManager;
|
|
322
418
|
tradeZoneManager;
|
|
323
419
|
measureOverlay;
|
|
324
420
|
replayManager;
|
|
325
421
|
undoRedoManager;
|
|
326
|
-
autoSaveScheduler = new
|
|
422
|
+
autoSaveScheduler = new at((e) => this.saveState(e));
|
|
327
423
|
animator;
|
|
328
424
|
crosshairTooltip;
|
|
329
425
|
pinnedTooltip;
|
|
@@ -375,22 +471,22 @@ var F = class {
|
|
|
375
471
|
logScale: n.logScale ?? !0,
|
|
376
472
|
timeframes: n.timeframes ?? [],
|
|
377
473
|
defaultTimeframeFavorites: n.defaultTimeframeFavorites ?? []
|
|
378
|
-
}, e.style.position = "relative", e.style.overflow = "hidden", e.tabIndex = 0, e.style.outline = "none", this.dataManager = new
|
|
474
|
+
}, e.style.position = "relative", e.style.overflow = "hidden", e.tabIndex = 0, e.style.outline = "none", this.dataManager = new j(), this.themeManager = new M(t.theme), this.layoutManager = new F(), this.indicatorEngine = new y(), this.pluginManager = new B(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new fe(), w(this.indicatorEngine), this.drawingManager = new le(), qe(this.drawingManager), this.drawingRenderer = new ue(this.drawingManager), this.drawingManager.setRequestRender(() => {
|
|
379
475
|
this.syncRenderContext(), this.engine.requestRender(r.Overlay), this.scheduleAutoSave();
|
|
380
476
|
}), this.drawingManager.setEventCallback((e, t) => {
|
|
381
477
|
this.eventBus.emit(e, t);
|
|
382
|
-
}), this.undoRedoManager = new
|
|
478
|
+
}), this.undoRedoManager = new ze(), this.drawingManager.setUndoRedoManager(this.undoRedoManager), this.drawingManager.setDataGetter(() => this.dataManager.getData()), this.drawingManager.setDisplayDataGetter(() => this.getDisplayData()), t.crosshair?.mode === "magnet" && this.drawingManager.setMagnetMode("magnet"), this.tradingManager = new Le({
|
|
383
479
|
enabled: this.features.trading,
|
|
384
480
|
contextMenu: { enabled: this.features.tradingContextMenu }
|
|
385
|
-
}), this.tradingRenderer = new
|
|
481
|
+
}), this.tradingRenderer = new Re(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradingManager.setEventCallback((e, t) => {
|
|
386
482
|
this.eventBus.emit(e, t);
|
|
387
|
-
}), this.engine = new
|
|
483
|
+
}), this.engine = new Ae(e);
|
|
388
484
|
let i = this.engine.dprManager.getContainerSize();
|
|
389
|
-
if (this.viewport = new
|
|
485
|
+
if (this.viewport = new Be(i.width, i.height, t.minBarSpacing ?? 2, t.maxBarSpacing ?? 30, t.rightMargin ?? 5), this.layoutManager.resize(i.width, i.height), this.engine.onContainerResize = (e) => {
|
|
390
486
|
if (e.width <= 0 || e.height <= 0) return;
|
|
391
487
|
let t = this.viewport.isAtEnd();
|
|
392
488
|
this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(t);
|
|
393
|
-
}, this.chartRenderer = this.createChartRenderer(t.chartType), this.gridRenderer = new
|
|
489
|
+
}, this.chartRenderer = this.createChartRenderer(t.chartType), this.gridRenderer = new pe(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new ke(), this.priceAxis.setLocale(this.numberLocale), this.timeAxis = new Fe(), this.crosshairHandler = new ae(), this.crosshairHandler.setLocale(this.numberLocale), t.crosshair?.mode && this.crosshairHandler.setMode(t.crosshair.mode), this.crosshairHandler.setCallback((e, t) => {
|
|
394
490
|
if (e !== null && t) {
|
|
395
491
|
let n = this.dataManager.getData(), r = e < n.length ? n[e] : void 0;
|
|
396
492
|
this.chartLegend.setHoverBar(r ?? null), r && this.crosshairTooltip.show(t, r, this.themeManager.getTheme(), this.cachedContainerSize()), this.pinnedTooltip.isPinned() && this.pinnedTooltip.reposition(this.viewport.getState(), r ?? null, e, this.themeManager.getTheme()), this.eventBus.emit("crosshairMove", {
|
|
@@ -399,12 +495,12 @@ var F = class {
|
|
|
399
495
|
barIndex: e
|
|
400
496
|
});
|
|
401
497
|
} else this.crosshairTooltip.hide(), this.chartLegend.setHoverBar(null);
|
|
402
|
-
}), this.chartLegend = new
|
|
498
|
+
}), this.chartLegend = new re(), this.chartLegend.setChartType(t.chartType), this.watermark = new We(), t.watermark && this.watermark.setConfig(t.watermark), this.volumeRenderer = new Ue(), this.volumeProfile = new He(), this.marketProfile = new xe(), this.depthHeatmap = new ce(), this.periodLevels = new Te(), this.pivotMarkers = new De(), this.barCountdown = new te(), this.sessionBreaks = new C(), this.sessionShading = new je(), this.compareRenderer = new ie(), t.sessionBreaks ? this.sessionBreaks.setConfig({
|
|
403
499
|
visible: t.sessionBreaks.visible ?? !0,
|
|
404
500
|
color: t.sessionBreaks.color,
|
|
405
501
|
lineStyle: t.sessionBreaks.lineStyle,
|
|
406
502
|
lineWidth: t.sessionBreaks.lineWidth
|
|
407
|
-
}) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.viewport.setLogScale(!0), this.animator = new
|
|
503
|
+
}) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.viewport.setLogScale(!0), this.animator = new p(), this.crosshairTooltip = new oe(), this.crosshairTooltip.create(e), this.pinnedTooltip = new Ee(), this.pinnedTooltip.create(e), this.keyboardHandler = new ve({
|
|
408
504
|
scrollBars: (e) => {
|
|
409
505
|
let t = this.viewport.getState().barWidth + this.viewport.getState().barSpacing;
|
|
410
506
|
this.viewport.scrollBy(e * t), this.updateViewportAndRender();
|
|
@@ -424,14 +520,39 @@ var F = class {
|
|
|
424
520
|
if (!this.keyboardHandler) return;
|
|
425
521
|
let t = document.activeElement;
|
|
426
522
|
t && t !== this.container && !this.container.contains(t) || t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.isContentEditable) || this.keyboardHandler.handleKey(e) && e.preventDefault();
|
|
427
|
-
}, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new
|
|
428
|
-
|
|
523
|
+
}, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new se(), this.alertManager = new f(), this.alertManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.alertManager.on("triggered", (e) => {
|
|
524
|
+
let t = {
|
|
525
|
+
id: e.id,
|
|
526
|
+
price: e.price,
|
|
527
|
+
condition: e.condition,
|
|
528
|
+
message: e.message,
|
|
529
|
+
triggered: e.triggered
|
|
530
|
+
};
|
|
531
|
+
this.eventBus.emit("alertTriggered", t), this.eventBus.emit("dataUpdate", {
|
|
429
532
|
alert: "triggered",
|
|
430
533
|
alertId: e.id,
|
|
431
534
|
price: e.price,
|
|
432
535
|
message: e.message
|
|
433
536
|
});
|
|
434
|
-
}), this.
|
|
537
|
+
}), this.alertManager.on("added", (e) => {
|
|
538
|
+
this.eventBus.emit("alertAdd", {
|
|
539
|
+
id: e.id,
|
|
540
|
+
price: e.price,
|
|
541
|
+
condition: e.condition,
|
|
542
|
+
message: e.message,
|
|
543
|
+
triggered: e.triggered
|
|
544
|
+
});
|
|
545
|
+
}), this.alertManager.on("removed", (e) => {
|
|
546
|
+
this.eventBus.emit("alertRemove", { id: e });
|
|
547
|
+
}), this.alertManager.on("updated", (e) => {
|
|
548
|
+
this.eventBus.emit("alertUpdate", {
|
|
549
|
+
id: e.id,
|
|
550
|
+
price: e.price,
|
|
551
|
+
condition: e.condition,
|
|
552
|
+
message: e.message,
|
|
553
|
+
triggered: e.triggered
|
|
554
|
+
});
|
|
555
|
+
}), this.signalMarkerManager = new Me(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.signalMarkerManager.setDataGetter(() => this.dataManager.getData()), this.signalMarkerManager.on("added", (e) => {
|
|
435
556
|
this.eventBus.emit("signalMarkerAdd", {
|
|
436
557
|
id: e.id,
|
|
437
558
|
source: e.source,
|
|
@@ -439,20 +560,20 @@ var F = class {
|
|
|
439
560
|
});
|
|
440
561
|
}), this.signalMarkerManager.on("removed", (e) => {
|
|
441
562
|
this.eventBus.emit("signalMarkerRemove", { id: e });
|
|
442
|
-
}), this.tradeZoneManager = new
|
|
563
|
+
}), this.tradeZoneManager = new Ie(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradeZoneManager.setDataGetter(() => this.dataManager.getData()), this.tradeZoneManager.on("added", (e) => {
|
|
443
564
|
this.eventBus.emit("tradeZoneAdd", {
|
|
444
565
|
id: e.id,
|
|
445
566
|
direction: e.direction
|
|
446
567
|
});
|
|
447
568
|
}), this.tradeZoneManager.on("removed", (e) => {
|
|
448
569
|
this.eventBus.emit("tradeZoneRemove", { id: e });
|
|
449
|
-
}), this.replayManager = new
|
|
570
|
+
}), this.replayManager = new x(), this.measureOverlay = new Se(), this.interactionManager = new ge(e), this.features.panning && this.interactionManager.setPanHandler(new Ce((e) => {
|
|
450
571
|
this.viewport.scrollBy(e), this.updateViewportAndRender();
|
|
451
572
|
})), this.features.zooming) {
|
|
452
|
-
this.interactionManager.setZoomHandler(new
|
|
573
|
+
this.interactionManager.setZoomHandler(new Ge((e, t) => {
|
|
453
574
|
this.viewport.zoom(e, t), this.updateViewportAndRender();
|
|
454
575
|
}));
|
|
455
|
-
let e = new
|
|
576
|
+
let e = new ee((e) => {
|
|
456
577
|
this.options.autoScale = !1, this.viewport.scalePriceRange(e), this.syncRenderContext(), this.engine.requestRender();
|
|
457
578
|
}, (e) => {
|
|
458
579
|
let t = this.viewport.getState().chartRect.width;
|
|
@@ -462,20 +583,41 @@ var F = class {
|
|
|
462
583
|
e === "price" ? (this.options.autoScale = !0, this.updateViewportAndRender()) : this.fitContent();
|
|
463
584
|
});
|
|
464
585
|
}
|
|
465
|
-
this.features.crosshair && this.interactionManager.setCrosshairHandler(this.crosshairHandler), this.features.drawings && this.interactionManager.setDrawingManager(this.drawingManager, () => ({
|
|
586
|
+
if (this.features.crosshair && this.interactionManager.setCrosshairHandler(this.crosshairHandler), this.features.drawings && this.interactionManager.setDrawingManager(this.drawingManager, () => ({
|
|
466
587
|
...this.viewport.getState(),
|
|
467
588
|
data: this.getDisplayData()
|
|
468
589
|
})), this.features.trading && this.interactionManager.setTradingManager(this.tradingManager, () => ({
|
|
469
590
|
...this.viewport.getState(),
|
|
470
591
|
data: this.getDisplayData()
|
|
471
|
-
})), this.
|
|
592
|
+
})), this.features.alerts) {
|
|
593
|
+
let e = new d(this.alertManager, () => this.viewport.getState());
|
|
594
|
+
this.interactionManager.setAlertDragHandler(e);
|
|
595
|
+
}
|
|
596
|
+
let a = new we();
|
|
597
|
+
a.configure(() => this.getResolvedLayout(), (e, t) => this.setPanelSize(e, t)), this.interactionManager.setPaneResizeHandler(a), this.interactionManager.setAltClickHandler((e) => {
|
|
472
598
|
let t = this.getDisplayData();
|
|
473
599
|
if (t.length === 0) return;
|
|
474
600
|
let n = this.viewport.getState(), i = n.barWidth + n.barSpacing, a = Math.round((n.offset + e.x) / i);
|
|
475
601
|
a < 0 || a >= t.length || (this.pinnedTooltip.isPinned() && this.pinnedTooltip.getPinnedIndex() === a ? this.pinnedTooltip.unpin() : this.pinnedTooltip.pin(t[a], a, this.themeManager.getTheme()), this.pinnedTooltip.reposition(this.viewport.getState(), this.dataManager.getData()[a] ?? null, a, this.themeManager.getTheme()), this.engine.requestRender(r.Overlay));
|
|
602
|
+
}), this.interactionManager.setClickHandler((e) => {
|
|
603
|
+
let t = this.getDisplayData();
|
|
604
|
+
if (this.eventBus.emit("click", {
|
|
605
|
+
x: e.x,
|
|
606
|
+
y: e.y
|
|
607
|
+
}), t.length === 0) return;
|
|
608
|
+
let n = $e(e.x, this.viewport.getState());
|
|
609
|
+
n < 0 || n >= t.length || this.eventBus.emit("barClick", {
|
|
610
|
+
bar: t[n],
|
|
611
|
+
barIndex: n,
|
|
612
|
+
point: e
|
|
613
|
+
});
|
|
476
614
|
}), this.interactionManager.setEscapeHandler(() => {
|
|
615
|
+
if (this.features.trading && this.tradingManager.isBracketActive()) {
|
|
616
|
+
this.tradingManager.cancelBracket(), this.eventBus.emit("dataUpdate", { bracket: "cancelled" });
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
477
619
|
this.pinnedTooltip.isPinned() && (this.pinnedTooltip.unpin(), this.engine.requestRender(r.Overlay));
|
|
478
|
-
}), this.interactionManager.setMeasureHandlers({
|
|
620
|
+
}), this.interactionManager.setConfirmHandler(() => this.features.trading && this.tradingManager.isBracketActive() ? (this.tradingManager.confirmBracket(), !0) : !1), this.interactionManager.setMeasureHandlers({
|
|
479
621
|
begin: (e) => {
|
|
480
622
|
this.measureOverlay.begin(e, this.viewport.getState(), this.getDisplayData());
|
|
481
623
|
},
|
|
@@ -490,7 +632,7 @@ var F = class {
|
|
|
490
632
|
}), this.interactionManager.attach(), this.syncRenderContext(), this.engine.start();
|
|
491
633
|
}
|
|
492
634
|
setData(e) {
|
|
493
|
-
this.dataManager.setData(e), this.crosshairHandler.setData(this.dataManager.getData()), this.displayDataCache = null, this.sessionBreaks.invalidateCache(), this.indicatorEngine.recalculateAll(this.dataManager.getData()), e.length > 0 && this.currentPriceLine.setPrice(e[e.length - 1].close), this.updateViewportAndRender(!0), this.eventBus.emit("dataUpdate", { length: e.length });
|
|
635
|
+
this.dataManager.setData(e), this.crosshairHandler.setData(this.dataManager.getData()), this.displayDataCache = null, this.sessionBreaks.invalidateCache(), this.alertManager.clearLastValues(), this.indicatorEngine.recalculateAll(this.dataManager.getData()), e.length > 0 && this.currentPriceLine.setPrice(e[e.length - 1].close), this.updateViewportAndRender(!0), this.eventBus.emit("dataUpdate", { length: e.length });
|
|
494
636
|
}
|
|
495
637
|
appendBar(e) {
|
|
496
638
|
this.dataManager.appendBar(e), this.crosshairHandler.setData(this.dataManager.getData()), this.displayDataCache = null, this.autoScrollOnNewBar && this.viewport.scrollToEnd(), this.indicatorEngine.recalculateAll(this.dataManager.getData()), this.updateViewportAndRender();
|
|
@@ -531,15 +673,18 @@ var F = class {
|
|
|
531
673
|
registerIndicator(e) {
|
|
532
674
|
this.pluginManager.registerIndicator(e);
|
|
533
675
|
}
|
|
676
|
+
get plugins() {
|
|
677
|
+
return this.pluginManager;
|
|
678
|
+
}
|
|
534
679
|
static indicators() {
|
|
535
680
|
let e = new y();
|
|
536
|
-
return
|
|
681
|
+
return w(e), e.getAvailableIndicators();
|
|
537
682
|
}
|
|
538
683
|
setPanelPosition(e, t) {
|
|
539
684
|
this.layoutManager.setPanelPosition(e, t), this.engine.requestRender();
|
|
540
685
|
}
|
|
541
686
|
setPanelSize(e, t) {
|
|
542
|
-
this.layoutManager.setPanelSize(e, t), this.
|
|
687
|
+
this.layoutManager.setPanelSize(e, t), this.updateViewportAndRender();
|
|
543
688
|
}
|
|
544
689
|
setDrawingTool(e) {
|
|
545
690
|
this.features.drawings && (e && this.features.drawingTools.length > 0 && !this.features.drawingTools.includes(e) || this.drawingManager.setActiveTool(e));
|
|
@@ -550,15 +695,43 @@ var F = class {
|
|
|
550
695
|
setDrawingStyle(e) {
|
|
551
696
|
this.drawingManager.setStyle(e);
|
|
552
697
|
}
|
|
698
|
+
getDrawingStyle() {
|
|
699
|
+
return this.drawingManager.getActiveStyle();
|
|
700
|
+
}
|
|
701
|
+
getSelectedDrawingId() {
|
|
702
|
+
return this.drawingManager.getSelectedDrawingId();
|
|
703
|
+
}
|
|
704
|
+
setSelectedDrawingStyle(e, t) {
|
|
705
|
+
return this.drawingManager.setSelectedDrawingStyle(e, t);
|
|
706
|
+
}
|
|
553
707
|
getDrawings() {
|
|
554
708
|
return this.drawingManager.getDrawings();
|
|
555
709
|
}
|
|
556
710
|
setDrawings(e) {
|
|
557
711
|
this.drawingManager.setDrawings(e);
|
|
558
712
|
}
|
|
713
|
+
addDrawing(e) {
|
|
714
|
+
if (!this.features.drawings) return null;
|
|
715
|
+
let t = this.drawingManager.addDrawing(e);
|
|
716
|
+
return this.scheduleAutoSave(), t;
|
|
717
|
+
}
|
|
718
|
+
autoFib() {
|
|
719
|
+
if (!this.features.drawings) return null;
|
|
720
|
+
let e = this.getDisplayData(), t = this.viewport.getState(), n = Ke(e, t.visibleRange.from, t.visibleRange.to);
|
|
721
|
+
return n ? this.addDrawing({
|
|
722
|
+
type: "fibRetracement",
|
|
723
|
+
anchors: [n[0], n[1]]
|
|
724
|
+
}) : null;
|
|
725
|
+
}
|
|
559
726
|
removeDrawing(e) {
|
|
560
727
|
this.drawingManager.removeDrawing(e);
|
|
561
728
|
}
|
|
729
|
+
setDrawingVisible(e, t) {
|
|
730
|
+
this.drawingManager.setDrawingVisible(e, t);
|
|
731
|
+
}
|
|
732
|
+
setDrawingLocked(e, t) {
|
|
733
|
+
this.drawingManager.setDrawingLocked(e, t);
|
|
734
|
+
}
|
|
562
735
|
clearDrawings() {
|
|
563
736
|
this.drawingManager.clearDrawings();
|
|
564
737
|
}
|
|
@@ -638,6 +811,9 @@ var F = class {
|
|
|
638
811
|
getActiveIndicators() {
|
|
639
812
|
return this.indicatorEngine.getActiveIndicators();
|
|
640
813
|
}
|
|
814
|
+
setIndicatorVisible(e, t) {
|
|
815
|
+
this.indicatorEngine.setVisible(e, t) !== null && this.updateViewportAndRender();
|
|
816
|
+
}
|
|
641
817
|
getIndicatorConfig(e) {
|
|
642
818
|
let t = this.indicatorEngine.getIndicatorConfig(e);
|
|
643
819
|
return t ? {
|
|
@@ -651,6 +827,37 @@ var F = class {
|
|
|
651
827
|
setOrders(e) {
|
|
652
828
|
this.features.trading && this.tradingManager.setOrders(e);
|
|
653
829
|
}
|
|
830
|
+
startBracket(e, t) {
|
|
831
|
+
if (!this.features.trading) return !1;
|
|
832
|
+
let n = this.dataManager.getData(), r = t ?? (n.length > 0 ? n[n.length - 1].close : null);
|
|
833
|
+
return r === null ? !1 : (this.tradingManager.startBracket(e, r), !0);
|
|
834
|
+
}
|
|
835
|
+
cancelBracket() {
|
|
836
|
+
this.features.trading && this.tradingManager.cancelBracket();
|
|
837
|
+
}
|
|
838
|
+
confirmBracket() {
|
|
839
|
+
return this.features.trading ? this.tradingManager.confirmBracket() : !1;
|
|
840
|
+
}
|
|
841
|
+
isBracketActive() {
|
|
842
|
+
return this.features.trading && this.tradingManager.isBracketActive();
|
|
843
|
+
}
|
|
844
|
+
startOrderDraft(e, t) {
|
|
845
|
+
if (!this.features.trading) return !1;
|
|
846
|
+
let n = this.dataManager.getData(), r = t ?? (n.length > 0 ? n[n.length - 1].close : null);
|
|
847
|
+
return r === null ? !1 : (this.tradingManager.startOrderDraft(e, r), !0);
|
|
848
|
+
}
|
|
849
|
+
cancelOrderDraft() {
|
|
850
|
+
this.features.trading && this.tradingManager.cancelOrderDraft();
|
|
851
|
+
}
|
|
852
|
+
confirmOrderDraft() {
|
|
853
|
+
return this.features.trading ? this.tradingManager.confirmOrderDraft() : !1;
|
|
854
|
+
}
|
|
855
|
+
isOrderDraftActive() {
|
|
856
|
+
return this.features.trading && this.tradingManager.isOrderDraftActive();
|
|
857
|
+
}
|
|
858
|
+
placeOrderIntent(e) {
|
|
859
|
+
this.features.trading && this.eventBus.emit("orderPlace", e);
|
|
860
|
+
}
|
|
654
861
|
setPositions(e) {
|
|
655
862
|
this.features.trading && this.tradingManager.setPositions(e);
|
|
656
863
|
}
|
|
@@ -658,13 +865,26 @@ var F = class {
|
|
|
658
865
|
this.features.trading && this.tradingManager.setDepthData(e);
|
|
659
866
|
}
|
|
660
867
|
setCurrentPrice(e, t) {
|
|
661
|
-
this.tradingManager.setCurrentPrice(e), this.currentPriceLine.setPrice(e), this.scheduleRender(), this.features.alerts && this.alertManager.checkPrice(e);
|
|
868
|
+
this.tradingManager.setCurrentPrice(e), this.currentPriceLine.setPrice(e), this.scheduleRender(), this.features.alerts && (this.alertManager.checkPrice(e), this.feedIndicatorAlerts());
|
|
869
|
+
}
|
|
870
|
+
feedIndicatorAlerts() {
|
|
871
|
+
let e = this.alertManager.getAlerts(), t = this.dataManager.getData();
|
|
872
|
+
if (t.length === 0) return;
|
|
873
|
+
let n = t.length - 1, r = /* @__PURE__ */ new Set();
|
|
874
|
+
for (let t of e) {
|
|
875
|
+
if (t.channel === "price" || r.has(t.channel)) continue;
|
|
876
|
+
r.add(t.channel);
|
|
877
|
+
let e = t.channel.indexOf(":");
|
|
878
|
+
if (e < 0) continue;
|
|
879
|
+
let i = t.channel.slice(0, e), a = t.channel.slice(e + 1), o = this.indicatorEngine.getOutput(i)?.series?.[n]?.[a];
|
|
880
|
+
typeof o == "number" && Number.isFinite(o) && this.alertManager.checkChannel(t.channel, o);
|
|
881
|
+
}
|
|
662
882
|
}
|
|
663
883
|
setTradingConfig(e) {
|
|
664
884
|
this.features.trading && this.tradingManager.setConfig(e);
|
|
665
885
|
}
|
|
666
886
|
async connect(e) {
|
|
667
|
-
this.disconnectStream(), this.streamManager = new
|
|
887
|
+
this.disconnectStream(), this.streamManager = new Pe(), this.streamManager.on("snapshot", (e) => {
|
|
668
888
|
this.setData(e);
|
|
669
889
|
}), this.streamManager.on("barClose", (e) => {
|
|
670
890
|
this.dataManager.appendBar(e), this.crosshairHandler.setData(this.dataManager.getData()), this.autoScrollOnNewBar && this.viewport.scrollToEnd(), this.indicatorEngine.recalculateAll(this.dataManager.getData()), this.updateViewportAndRender();
|
|
@@ -692,6 +912,27 @@ var F = class {
|
|
|
692
912
|
disconnectStream() {
|
|
693
913
|
this.streamManager &&= (this.streamManager.dispose(), null);
|
|
694
914
|
}
|
|
915
|
+
connectExecution(e, t = {}) {
|
|
916
|
+
if (!this.features.trading) throw Error("connectExecution requires features.trading to be enabled");
|
|
917
|
+
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = ut(e, {
|
|
918
|
+
onIntent: (e, t) => {
|
|
919
|
+
let n = (e) => t(e.payload);
|
|
920
|
+
return this.eventBus.on(e, n), () => this.eventBus.off(e, n);
|
|
921
|
+
},
|
|
922
|
+
setOrders: (e) => this.setOrders(e),
|
|
923
|
+
setPositions: (e) => this.setPositions(e),
|
|
924
|
+
onError: (e) => this.eventBus.emit("executionError", e)
|
|
925
|
+
}), Promise.resolve(e.connect(t)).catch((e) => this.eventBus.emit("executionError", {
|
|
926
|
+
message: "Execution connect failed",
|
|
927
|
+
cause: e
|
|
928
|
+
}));
|
|
929
|
+
}
|
|
930
|
+
disconnectExecution() {
|
|
931
|
+
this.execTeardown &&= (this.execTeardown(), null), this.executionAdapter &&= (this.executionAdapter.disconnect(), null);
|
|
932
|
+
}
|
|
933
|
+
getExecutionAdapter() {
|
|
934
|
+
return this.executionAdapter;
|
|
935
|
+
}
|
|
695
936
|
setBarCountdownVisible(e) {
|
|
696
937
|
this.barCountdown.setVisible(e), this.engine.requestRender(r.UI);
|
|
697
938
|
}
|
|
@@ -725,6 +966,12 @@ var F = class {
|
|
|
725
966
|
isLogScale() {
|
|
726
967
|
return this.viewport.isLogScale();
|
|
727
968
|
}
|
|
969
|
+
setScaleMode(e) {
|
|
970
|
+
this.viewport.setScaleMode(e), this.updateViewportAndRender();
|
|
971
|
+
}
|
|
972
|
+
getScaleMode() {
|
|
973
|
+
return this.viewport.getScaleMode();
|
|
974
|
+
}
|
|
728
975
|
setSessionBreaksConfig(e) {
|
|
729
976
|
this.sessionBreaks.setConfig(e), this.engine.requestRender(r.Background);
|
|
730
977
|
}
|
|
@@ -840,6 +1087,64 @@ var F = class {
|
|
|
840
1087
|
setVolumeProfileConfig(e) {
|
|
841
1088
|
e.buckets !== void 0 && this.volumeProfile.setBuckets(e.buckets), e.widthRatio !== void 0 && this.volumeProfile.setWidthRatio(e.widthRatio), e.opacity !== void 0 && this.volumeProfile.setOpacity(e.opacity), e.highlightPoC !== void 0 && this.volumeProfile.setHighlightPoC(e.highlightPoC), this.engine.requestRender(r.Main);
|
|
842
1089
|
}
|
|
1090
|
+
setMarketProfileVisible(e) {
|
|
1091
|
+
this.marketProfile.setVisible(e), this.engine.requestRender(r.Main);
|
|
1092
|
+
}
|
|
1093
|
+
isMarketProfileVisible() {
|
|
1094
|
+
return this.marketProfile.isVisible();
|
|
1095
|
+
}
|
|
1096
|
+
setMarketProfileConfig(e) {
|
|
1097
|
+
e.buckets !== void 0 && this.marketProfile.setBuckets(e.buckets), e.widthRatio !== void 0 && this.marketProfile.setWidthRatio(e.widthRatio), e.opacity !== void 0 && this.marketProfile.setOpacity(e.opacity), e.valueAreaPct !== void 0 && this.marketProfile.setValueAreaPct(e.valueAreaPct), e.highlightPoC !== void 0 && this.marketProfile.setHighlightPoC(e.highlightPoC), e.showStats !== void 0 && this.marketProfile.setShowStats(e.showStats), e.splitBySession !== void 0 && this.marketProfile.setSplitBySession(e.splitBySession), e.letters !== void 0 && this.marketProfile.setLetters(e.letters), this.engine.requestRender(r.Main);
|
|
1098
|
+
}
|
|
1099
|
+
getMarketProfileStats() {
|
|
1100
|
+
return this.marketProfile.getStats();
|
|
1101
|
+
}
|
|
1102
|
+
setDepthHeatmapVisible(e) {
|
|
1103
|
+
this.depthHeatmap.setVisible(e), this.engine.requestRender(r.Main);
|
|
1104
|
+
}
|
|
1105
|
+
isDepthHeatmapVisible() {
|
|
1106
|
+
return this.depthHeatmap.isVisible();
|
|
1107
|
+
}
|
|
1108
|
+
setDepthHeatmapConfig(e) {
|
|
1109
|
+
e.opacity !== void 0 && this.depthHeatmap.setOpacity(e.opacity), e.capacity !== void 0 && this.depthHeatmap.setCapacity(e.capacity), this.engine.requestRender(r.Main);
|
|
1110
|
+
}
|
|
1111
|
+
pushDepthSnapshot(e) {
|
|
1112
|
+
let t = this.dataManager.getData();
|
|
1113
|
+
t.length !== 0 && (this.depthHeatmap.push(t[t.length - 1].time, e), this.depthHeatmap.isVisible() && this.engine.requestRender(r.Main));
|
|
1114
|
+
}
|
|
1115
|
+
clearDepthHeatmap() {
|
|
1116
|
+
this.depthHeatmap.clear(), this.engine.requestRender(r.Main);
|
|
1117
|
+
}
|
|
1118
|
+
setPeriodLevelsVisible(e) {
|
|
1119
|
+
this.periodLevels.setVisible(e), this.engine.requestRender(r.Main);
|
|
1120
|
+
}
|
|
1121
|
+
isPeriodLevelsVisible() {
|
|
1122
|
+
return this.periodLevels.isVisible();
|
|
1123
|
+
}
|
|
1124
|
+
setPeriodLevelsPeriod(e) {
|
|
1125
|
+
this.periodLevels.setPeriod(e), this.engine.requestRender(r.Main);
|
|
1126
|
+
}
|
|
1127
|
+
setTimezoneOffset(e) {
|
|
1128
|
+
this.timeAxis.setTimezoneOffset(e), this.crosshairHandler.setTimezoneOffset(e), this.engine.requestRender(r.UI), this.engine.requestRender(r.Overlay);
|
|
1129
|
+
}
|
|
1130
|
+
setPivotMarkersVisible(e) {
|
|
1131
|
+
this.pivotMarkers.setVisible(e), this.engine.requestRender(r.Overlay);
|
|
1132
|
+
}
|
|
1133
|
+
isPivotMarkersVisible() {
|
|
1134
|
+
return this.pivotMarkers.isVisible();
|
|
1135
|
+
}
|
|
1136
|
+
setPivotMarkersConfig(e) {
|
|
1137
|
+
(e.left !== void 0 || e.right !== void 0) && this.pivotMarkers.setStrength(e.left ?? 5, e.right ?? e.left ?? 5), e.showLabels !== void 0 && this.pivotMarkers.setShowLabels(e.showLabels), e.structureLabels !== void 0 && this.pivotMarkers.setStructureLabels(e.structureLabels), this.engine.requestRender(r.Overlay);
|
|
1138
|
+
}
|
|
1139
|
+
setSessionShadingVisible(e) {
|
|
1140
|
+
this.sessionShading.setVisible(e), this.engine.requestRender(r.Background);
|
|
1141
|
+
}
|
|
1142
|
+
isSessionShadingVisible() {
|
|
1143
|
+
return this.sessionShading.isVisible();
|
|
1144
|
+
}
|
|
1145
|
+
setSessionShadingConfig(e) {
|
|
1146
|
+
this.sessionShading.setConfig(e), this.engine.requestRender(r.Background);
|
|
1147
|
+
}
|
|
843
1148
|
setTooltipVisible(e) {
|
|
844
1149
|
e || this.crosshairTooltip.hide();
|
|
845
1150
|
}
|
|
@@ -853,18 +1158,27 @@ var F = class {
|
|
|
853
1158
|
this.chartLegend.setStatusText(e), this.engine.requestRender(r.UI);
|
|
854
1159
|
}
|
|
855
1160
|
screenshot(e) {
|
|
856
|
-
this.features.screenshot &&
|
|
1161
|
+
this.features.screenshot && S.download(this.container, e, this.themeManager.getTheme().background);
|
|
1162
|
+
}
|
|
1163
|
+
async copyScreenshot() {
|
|
1164
|
+
if (!this.features.screenshot) return !1;
|
|
1165
|
+
try {
|
|
1166
|
+
let e = await S.toBlob(this.container, this.themeManager.getTheme().background), t = globalThis.ClipboardItem;
|
|
1167
|
+
return !e || !navigator.clipboard?.write || !t ? !1 : (await navigator.clipboard.write([new t({ "image/png": e })]), !0);
|
|
1168
|
+
} catch {
|
|
1169
|
+
return !1;
|
|
1170
|
+
}
|
|
857
1171
|
}
|
|
858
1172
|
screenshotDataURL() {
|
|
859
|
-
return this.features.screenshot ?
|
|
1173
|
+
return this.features.screenshot ? S.toDataURL(this.container, this.themeManager.getTheme().background) : null;
|
|
860
1174
|
}
|
|
861
1175
|
async screenshotBlob() {
|
|
862
|
-
return this.features.screenshot ?
|
|
1176
|
+
return this.features.screenshot ? S.toBlob(this.container, this.themeManager.getTheme().background) : null;
|
|
863
1177
|
}
|
|
864
|
-
addAlert(e, t = "crossing", n) {
|
|
1178
|
+
addAlert(e, t = "crossing", n, r = "price", i) {
|
|
865
1179
|
if (!this.features.alerts) return null;
|
|
866
|
-
let
|
|
867
|
-
return this.scheduleAutoSave(),
|
|
1180
|
+
let a = this.alertManager.addAlert(e, t, n, !1, r, i);
|
|
1181
|
+
return this.scheduleAutoSave(), a;
|
|
868
1182
|
}
|
|
869
1183
|
removeAlert(e) {
|
|
870
1184
|
this.alertManager.removeAlert(e), this.scheduleAutoSave();
|
|
@@ -920,7 +1234,7 @@ var F = class {
|
|
|
920
1234
|
setTradeZoneStyle(e) {
|
|
921
1235
|
this.tradeZoneManager.setStyle(e);
|
|
922
1236
|
}
|
|
923
|
-
|
|
1237
|
+
replayStart(e) {
|
|
924
1238
|
if (!this.features.replay) return;
|
|
925
1239
|
let t = this.dataManager.getData();
|
|
926
1240
|
this.replayManager.load(t), this.replayManager.on("bar", ({ bar: e, index: n }) => {
|
|
@@ -1034,16 +1348,16 @@ var F = class {
|
|
|
1034
1348
|
this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(n), this.eventBus.emit("resize", e);
|
|
1035
1349
|
}
|
|
1036
1350
|
destroy() {
|
|
1037
|
-
this.countdownInterval && clearInterval(this.countdownInterval), this.disableAutoSave(), this.disconnectStream(), this.onWindowKeyDown &&= (window.removeEventListener("keydown", this.onWindowKeyDown), null), this.keyboardHandler = null, this.interactionManager.detach(), this.tradingManager.destroy(), this.animator.dispose(), this.crosshairTooltip.destroy(), this.pinnedTooltip.destroy(), this.replayManager.dispose(), this.undoRedoManager.clear(), this.engine.destroy(), this.eventBus.destroy(), this.container.innerHTML = "";
|
|
1351
|
+
this.countdownInterval && clearInterval(this.countdownInterval), this.disableAutoSave(), this.disconnectStream(), this.disconnectExecution(), this.onWindowKeyDown &&= (window.removeEventListener("keydown", this.onWindowKeyDown), null), this.keyboardHandler = null, this.interactionManager.detach(), this.tradingManager.destroy(), this.animator.dispose(), this.crosshairTooltip.destroy(), this.pinnedTooltip.destroy(), this.replayManager.dispose(), this.undoRedoManager.clear(), this.engine.destroy(), this.eventBus.destroy(), this.container.innerHTML = "";
|
|
1038
1352
|
}
|
|
1039
1353
|
createChartRenderer(e) {
|
|
1040
|
-
return
|
|
1354
|
+
return nt(e, (e) => this.pluginManager.getChartType(e));
|
|
1041
1355
|
}
|
|
1042
1356
|
getDisplayData() {
|
|
1043
1357
|
if (this.displayDataCache) return this.displayDataCache;
|
|
1044
1358
|
let e = this.dataManager.getData();
|
|
1045
1359
|
if (e.length === 0) return e;
|
|
1046
|
-
let t =
|
|
1360
|
+
let t = rt(this.options.chartType, e, (e) => this.pluginManager.getChartType(e));
|
|
1047
1361
|
return this.displayDataCache = t, t;
|
|
1048
1362
|
}
|
|
1049
1363
|
scheduleRender() {
|
|
@@ -1058,7 +1372,11 @@ var F = class {
|
|
|
1058
1372
|
let t = this.getResolvedLayout();
|
|
1059
1373
|
this.viewport.setChartRect(t.mainChartRect);
|
|
1060
1374
|
let n = this.getDisplayData();
|
|
1061
|
-
if (this.viewport.updateData(n, this.options.autoScale !== !1),
|
|
1375
|
+
if (this.viewport.updateData(n, this.options.autoScale !== !1), n.length > 0) {
|
|
1376
|
+
let e = this.viewport.getState(), t = Math.max(0, Math.min(e.visibleRange.from, n.length - 1));
|
|
1377
|
+
this.viewport.setScaleBaseline(n[t]?.close);
|
|
1378
|
+
}
|
|
1379
|
+
if (this.options.autoScale !== !1) {
|
|
1062
1380
|
let e = this.viewport.getState(), t = this.indicatorEngine.getOverlayPriceRange(e.visibleRange.from, Math.min(e.visibleRange.to, n.length - 1));
|
|
1063
1381
|
if (t) {
|
|
1064
1382
|
let n = e.priceRange, r = Math.min(n.min, t.min), i = Math.max(n.max, t.max);
|
|
@@ -1080,7 +1398,7 @@ var F = class {
|
|
|
1080
1398
|
buildPanelRenderInfos() {
|
|
1081
1399
|
if (this.panelInfoCache) return this.panelInfoCache;
|
|
1082
1400
|
let e = this.getResolvedLayout(), t = this.viewport.getState(), { from: n, to: r } = t.visibleRange, i = e.panels.map((e) => {
|
|
1083
|
-
let i =
|
|
1401
|
+
let i = it(this.indicatorEngine.getOutput(e.config.id), n, r), a = {
|
|
1084
1402
|
x: e.rect.x,
|
|
1085
1403
|
y: e.rect.y + 20,
|
|
1086
1404
|
width: e.rect.width,
|
|
@@ -1114,9 +1432,14 @@ var F = class {
|
|
|
1114
1432
|
chartLegend: this.features.legend ? this.chartLegend : null,
|
|
1115
1433
|
volumeRenderer: this.features.volume ? this.volumeRenderer : null,
|
|
1116
1434
|
volumeProfile: this.volumeProfile,
|
|
1435
|
+
marketProfile: this.marketProfile,
|
|
1436
|
+
depthHeatmap: this.depthHeatmap,
|
|
1437
|
+
periodLevels: this.periodLevels,
|
|
1438
|
+
pivotMarkers: this.pivotMarkers,
|
|
1117
1439
|
watermark: this.features.watermark ? this.watermark : null,
|
|
1118
1440
|
barCountdown: this.barCountdown,
|
|
1119
1441
|
sessionBreaks: this.sessionBreaks,
|
|
1442
|
+
sessionShading: this.sessionShading,
|
|
1120
1443
|
compareRenderer: this.compareRenderer,
|
|
1121
1444
|
alertManager: this.features.alerts ? this.alertManager : null,
|
|
1122
1445
|
measureOverlay: this.measureOverlay,
|
|
@@ -1131,9 +1454,20 @@ var F = class {
|
|
|
1131
1454
|
},
|
|
1132
1455
|
theme: this.themeManager.getTheme(),
|
|
1133
1456
|
data: i,
|
|
1134
|
-
numberLocale: this.numberLocale
|
|
1457
|
+
numberLocale: this.numberLocale,
|
|
1458
|
+
renderOverlayPlugins: (e, t) => this.drawOverlayPlugins(e, t)
|
|
1135
1459
|
});
|
|
1136
1460
|
}
|
|
1461
|
+
drawOverlayPlugins(e, t) {
|
|
1462
|
+
let n = I(this.pluginManager.getOverlays(), t);
|
|
1463
|
+
if (n.length === 0) return;
|
|
1464
|
+
let r = {
|
|
1465
|
+
viewport: this.viewport.getState(),
|
|
1466
|
+
data: this.getDisplayData(),
|
|
1467
|
+
theme: this.themeManager.getTheme()
|
|
1468
|
+
};
|
|
1469
|
+
for (let t of n) t.render(e, r);
|
|
1470
|
+
}
|
|
1137
1471
|
buildPriceLimits() {
|
|
1138
1472
|
if (!this.marketConfig?.priceLimits?.enabled || !this.marketConfig.priceLimits.referencePrice) return null;
|
|
1139
1473
|
let e = s(this.marketConfig.priceLimits.referencePrice, this.marketConfig);
|
|
@@ -1146,26 +1480,26 @@ var F = class {
|
|
|
1146
1480
|
} : void 0
|
|
1147
1481
|
} : null;
|
|
1148
1482
|
}
|
|
1149
|
-
},
|
|
1483
|
+
}, H = [
|
|
1150
1484
|
"time",
|
|
1151
1485
|
"timestamp",
|
|
1152
1486
|
"date",
|
|
1153
1487
|
"datetime",
|
|
1154
1488
|
"t"
|
|
1155
|
-
],
|
|
1489
|
+
], U = ["open", "o"], W = ["high", "h"], G = ["low", "l"], K = ["close", "c"], q = [
|
|
1156
1490
|
"volume",
|
|
1157
1491
|
"vol",
|
|
1158
1492
|
"v"
|
|
1159
1493
|
];
|
|
1160
|
-
function
|
|
1494
|
+
function J(e) {
|
|
1161
1495
|
let t = e.trim();
|
|
1162
|
-
return t ? t[0] === "[" || t[0] === "{" ?
|
|
1496
|
+
return t ? t[0] === "[" || t[0] === "{" ? ft(t) : pt(t) : {
|
|
1163
1497
|
data: [],
|
|
1164
1498
|
rowCount: 0,
|
|
1165
1499
|
skipped: 0
|
|
1166
1500
|
};
|
|
1167
1501
|
}
|
|
1168
|
-
function
|
|
1502
|
+
function ft(e) {
|
|
1169
1503
|
let t;
|
|
1170
1504
|
try {
|
|
1171
1505
|
t = JSON.parse(e);
|
|
@@ -1175,19 +1509,19 @@ function Ke(e) {
|
|
|
1175
1509
|
if (!Array.isArray(t)) throw Error("Expected a JSON array of OHLCV rows");
|
|
1176
1510
|
let n = [], r = 0;
|
|
1177
1511
|
for (let e of t) {
|
|
1178
|
-
let t = Array.isArray(e) ?
|
|
1512
|
+
let t = Array.isArray(e) ? _t(e) : gt(e);
|
|
1179
1513
|
t ? n.push(t) : r++;
|
|
1180
1514
|
}
|
|
1181
1515
|
return Q(n, t.length, r);
|
|
1182
1516
|
}
|
|
1183
|
-
function
|
|
1517
|
+
function pt(e) {
|
|
1184
1518
|
let t = e.split(/\r?\n/).filter((e) => e.trim().length > 0);
|
|
1185
1519
|
if (t.length === 0) return {
|
|
1186
1520
|
data: [],
|
|
1187
1521
|
rowCount: 0,
|
|
1188
1522
|
skipped: 0
|
|
1189
1523
|
};
|
|
1190
|
-
let n =
|
|
1524
|
+
let n = mt(t[0]), r = Y(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? ht(r) : {
|
|
1191
1525
|
time: 0,
|
|
1192
1526
|
open: 1,
|
|
1193
1527
|
high: 2,
|
|
@@ -1198,7 +1532,7 @@ function qe(e) {
|
|
|
1198
1532
|
if (a.time < 0 || a.open < 0 || a.high < 0 || a.low < 0 || a.close < 0) throw Error("CSV is missing required column(s): time, open, high, low, close");
|
|
1199
1533
|
let o = [], s = 0;
|
|
1200
1534
|
for (let e = +!!i; e < t.length; e++) {
|
|
1201
|
-
let r =
|
|
1535
|
+
let r = Y(t[e], n), i = Z(r[a.time]), c = X(r[a.open]), l = X(r[a.high]), u = X(r[a.low]), d = X(r[a.close]), f = a.volume >= 0 ? Number(r[a.volume]) : 0;
|
|
1202
1536
|
if (i === null || ![
|
|
1203
1537
|
c,
|
|
1204
1538
|
l,
|
|
@@ -1219,7 +1553,7 @@ function qe(e) {
|
|
|
1219
1553
|
}
|
|
1220
1554
|
return Q(o, t.length - +!!i, s);
|
|
1221
1555
|
}
|
|
1222
|
-
function
|
|
1556
|
+
function mt(e) {
|
|
1223
1557
|
let t = {
|
|
1224
1558
|
",": 0,
|
|
1225
1559
|
";": 0,
|
|
@@ -1231,7 +1565,7 @@ function Je(e) {
|
|
|
1231
1565
|
for (let [e, i] of Object.entries(t)) i > r && (n = e, r = i);
|
|
1232
1566
|
return n;
|
|
1233
1567
|
}
|
|
1234
|
-
function
|
|
1568
|
+
function Y(e, t) {
|
|
1235
1569
|
let n = [], r = "", i = !1;
|
|
1236
1570
|
for (let a = 0; a < e.length; a++) {
|
|
1237
1571
|
let o = e[a];
|
|
@@ -1239,25 +1573,25 @@ function J(e, t) {
|
|
|
1239
1573
|
}
|
|
1240
1574
|
return n.push(r), n;
|
|
1241
1575
|
}
|
|
1242
|
-
function
|
|
1576
|
+
function ht(e) {
|
|
1243
1577
|
let t = (t) => e.findIndex((e) => t.includes(e));
|
|
1244
1578
|
return {
|
|
1245
|
-
time: t(
|
|
1246
|
-
open: t(
|
|
1247
|
-
high: t(
|
|
1248
|
-
low: t(
|
|
1249
|
-
close: t(
|
|
1250
|
-
volume: t(
|
|
1579
|
+
time: t(H),
|
|
1580
|
+
open: t(U),
|
|
1581
|
+
high: t(W),
|
|
1582
|
+
low: t(G),
|
|
1583
|
+
close: t(K),
|
|
1584
|
+
volume: t(q)
|
|
1251
1585
|
};
|
|
1252
1586
|
}
|
|
1253
|
-
function
|
|
1587
|
+
function gt(e) {
|
|
1254
1588
|
let t = (t) => {
|
|
1255
1589
|
for (let n of t) {
|
|
1256
1590
|
if (e[n] !== void 0) return e[n];
|
|
1257
1591
|
let t = n.toUpperCase();
|
|
1258
1592
|
if (e[t] !== void 0) return e[t];
|
|
1259
1593
|
}
|
|
1260
|
-
}, n = Z(String(t(
|
|
1594
|
+
}, n = Z(String(t(H) ?? "")), r = Number(t(U)), i = Number(t(W)), a = Number(t(G)), o = Number(t(K)), s = Number(t(q) ?? 0);
|
|
1261
1595
|
return n === null || ![
|
|
1262
1596
|
r,
|
|
1263
1597
|
i,
|
|
@@ -1272,7 +1606,7 @@ function Ye(e) {
|
|
|
1272
1606
|
volume: Number.isFinite(s) ? s : 0
|
|
1273
1607
|
};
|
|
1274
1608
|
}
|
|
1275
|
-
function
|
|
1609
|
+
function _t(e) {
|
|
1276
1610
|
if (e.length < 5) return null;
|
|
1277
1611
|
let t = Z(String(e[0])), n = Number(e[1]), r = Number(e[2]), i = Number(e[3]), a = Number(e[4]), o = e.length >= 6 ? Number(e[5]) : 0;
|
|
1278
1612
|
return t === null || ![
|
|
@@ -1312,7 +1646,7 @@ function Q(e, t, n) {
|
|
|
1312
1646
|
}
|
|
1313
1647
|
//#endregion
|
|
1314
1648
|
//#region src/io/DragDropImporter.ts
|
|
1315
|
-
var
|
|
1649
|
+
var vt = class {
|
|
1316
1650
|
host;
|
|
1317
1651
|
overlay = null;
|
|
1318
1652
|
callbacks;
|
|
@@ -1345,7 +1679,7 @@ var Ze = class {
|
|
|
1345
1679
|
e.preventDefault(), this.depth = 0, this.hideOverlay();
|
|
1346
1680
|
let t = e.dataTransfer?.files?.[0];
|
|
1347
1681
|
if (t) try {
|
|
1348
|
-
let e =
|
|
1682
|
+
let e = J(await t.text());
|
|
1349
1683
|
if (e.data.length === 0) throw Error(`No valid OHLCV rows found in "${t.name}"`);
|
|
1350
1684
|
this.callbacks.onData(e.data, e, t);
|
|
1351
1685
|
} catch (e) {
|
|
@@ -1380,6 +1714,6 @@ function $(e) {
|
|
|
1380
1714
|
return e.dataTransfer?.types?.includes("Files") ?? !1;
|
|
1381
1715
|
}
|
|
1382
1716
|
//#endregion
|
|
1383
|
-
export {
|
|
1717
|
+
export { lt as a, ct as c, L as d, F as f, B as i, ot as l, j as m, J as n, z as o, M as p, dt as r, st as s, vt as t, I as u };
|
|
1384
1718
|
|
|
1385
|
-
//# sourceMappingURL=DragDropImporter-
|
|
1719
|
+
//# sourceMappingURL=DragDropImporter-C4x09P7e.js.map
|