binbot-charts 0.5.2 → 0.5.4
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/charting_library/charting_library.standalone.js +540 -1
- package/dist/components/datafeed.js +153 -0
- package/dist/components/helpers.js +45 -0
- package/dist/components/streaming.js +106 -0
- package/dist/src/{App.jsx → App.js} +3 -30
- package/dist/src/charting_library/charting_library.standalone.js +510 -94
- package/dist/src/components/{TVChartContainer.jsx → TVChartContainer.js} +5 -26
- package/dist/src/components/datafeed.js +1 -1
- package/dist/src/index.js +2 -1
- package/package.json +2 -2
|
@@ -1,99 +1,515 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TradingView = void 0;
|
|
4
|
+
exports.TradingView = (function (e) {
|
|
2
5
|
"use strict";
|
|
3
|
-
function t(e, i) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
function t(e, i) {
|
|
7
|
+
const n = Object.assign({}, e);
|
|
8
|
+
for (const o in i)
|
|
9
|
+
"object" != typeof e[o] || null === e[o] || Array.isArray(e[o])
|
|
10
|
+
? void 0 !== i[o] && (n[o] = i[o])
|
|
11
|
+
: (n[o] = t(e[o], i[o]));
|
|
12
|
+
return n;
|
|
13
|
+
}
|
|
14
|
+
const i = {
|
|
15
|
+
mobile: {
|
|
16
|
+
disabled_features: [
|
|
17
|
+
"left_toolbar",
|
|
18
|
+
"header_widget",
|
|
19
|
+
"timeframes_toolbar",
|
|
20
|
+
"edit_buttons_in_legend",
|
|
21
|
+
"context_menus",
|
|
22
|
+
"control_bar",
|
|
23
|
+
"border_around_the_chart",
|
|
24
|
+
],
|
|
25
|
+
enabled_features: [],
|
|
26
|
+
},
|
|
27
|
+
}, n = {
|
|
28
|
+
width: 800,
|
|
29
|
+
height: 500,
|
|
30
|
+
interval: "1D",
|
|
31
|
+
timezone: "Etc/UTC",
|
|
32
|
+
container: "",
|
|
33
|
+
library_path: "",
|
|
34
|
+
locale: "en",
|
|
35
|
+
widgetbar: {
|
|
36
|
+
details: !1,
|
|
37
|
+
watchlist: !1,
|
|
38
|
+
watchlist_settings: { default_symbols: [] },
|
|
39
|
+
},
|
|
40
|
+
overrides: { "mainSeriesProperties.showCountdown": !1 },
|
|
41
|
+
studies_overrides: {},
|
|
42
|
+
trading_customization: { position: {}, order: {} },
|
|
43
|
+
brokerConfig: { configFlags: {} },
|
|
44
|
+
fullscreen: !1,
|
|
45
|
+
autosize: !1,
|
|
46
|
+
disabled_features: [],
|
|
47
|
+
enabled_features: [],
|
|
48
|
+
debug: !1,
|
|
49
|
+
logo: {},
|
|
50
|
+
time_frames: [
|
|
51
|
+
{ text: "5y", resolution: "1W" },
|
|
52
|
+
{ text: "1y", resolution: "1W" },
|
|
53
|
+
{ text: "6m", resolution: "120" },
|
|
54
|
+
{ text: "3m", resolution: "60" },
|
|
55
|
+
{ text: "1m", resolution: "30" },
|
|
56
|
+
{ text: "5d", resolution: "5" },
|
|
57
|
+
{ text: "1d", resolution: "1" },
|
|
58
|
+
],
|
|
59
|
+
client_id: "0",
|
|
60
|
+
user_id: "0",
|
|
61
|
+
charts_storage_api_version: "1.0",
|
|
62
|
+
favorites: { intervals: [], chartTypes: [] },
|
|
63
|
+
};
|
|
6
64
|
let o = !1;
|
|
7
|
-
function s() {
|
|
65
|
+
function s() {
|
|
66
|
+
return "CL v21.064 (internal id f0bc1e45 @ 2022-03-17T12:19:26.809Z)";
|
|
67
|
+
}
|
|
8
68
|
const r = class {
|
|
9
|
-
constructor(e) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
loadChartFromServer(e) { this._innerAPI().loadChartFromServer(e); }
|
|
31
|
-
saveChartToServer(e, t, i) { this._innerAPI().saveChartToServer(e, t, i); }
|
|
32
|
-
removeChartFromServer(e, t) { this._innerAPI().removeChartFromServer(e, t); }
|
|
33
|
-
onContextMenu(e) { this._doWhenInnerApiLoaded((t => { t.onContextMenu(e); })); }
|
|
34
|
-
createButton(e) { return this._innerWindow().createButton(e); }
|
|
35
|
-
createDropdown(e) { return this._innerWindow().createDropdown(e); }
|
|
36
|
-
showNoticeDialog(e) { this._doWhenInnerApiLoaded((t => { t.showNoticeDialog(e); })); }
|
|
37
|
-
showConfirmDialog(e) { this._doWhenInnerApiLoaded((t => { t.showConfirmDialog(e); })); }
|
|
38
|
-
showLoadChartDialog() { this._innerAPI().showLoadChartDialog(); }
|
|
39
|
-
showSaveAsChartDialog() { this._innerAPI().showSaveAsChartDialog(); }
|
|
40
|
-
symbolInterval() { return this._innerAPI().getSymbolInterval(); }
|
|
41
|
-
mainSeriesPriceFormatter() { return this._innerAPI().mainSeriesPriceFormatter(); }
|
|
42
|
-
getIntervals() { return this._innerAPI().getIntervals(); }
|
|
43
|
-
getStudiesList() { return this._innerAPI().getStudiesList(); }
|
|
44
|
-
getStudyInputs(e) { return this._innerAPI().getStudyInputs(e); }
|
|
45
|
-
addCustomCSSFile(e) { this._innerWindow().addCustomCSSFile(e); }
|
|
46
|
-
applyOverrides(e) { this._options = t(this._options, { overrides: e }), this._doWhenInnerWindowLoaded((t => { t.applyOverrides(e); })); }
|
|
47
|
-
applyStudiesOverrides(e) { this._doWhenInnerWindowLoaded((t => { t.applyStudiesOverrides(e); })); }
|
|
48
|
-
watchList() { return this._innerAPI().watchlist(); }
|
|
49
|
-
news() { return this._innerAPI().news(); }
|
|
50
|
-
activeChart() { return this._innerAPI().activeChart(); }
|
|
51
|
-
chartsCount() { return this._innerAPI().chartsCount(); }
|
|
52
|
-
layout() { return this._innerAPI().layout(); }
|
|
53
|
-
setLayout(e) { this._innerAPI().setLayout(e); }
|
|
54
|
-
layoutName() { return this._innerAPI().layoutName(); }
|
|
55
|
-
changeTheme(e, t) { return this._innerWindow().changeTheme(e, t); }
|
|
56
|
-
getTheme() { return this._innerWindow().getTheme(); }
|
|
57
|
-
takeScreenshot() { this._doWhenInnerApiLoaded((e => { e.takeScreenshot(); })); }
|
|
58
|
-
lockAllDrawingTools() { return this._innerAPI().lockAllDrawingTools(); }
|
|
59
|
-
hideAllDrawingTools() { return this._innerAPI().hideAllDrawingTools(); }
|
|
60
|
-
drawOnAllCharts(e) { this._innerAPI().drawOnAllCharts(e); }
|
|
61
|
-
magnetEnabled() { return this._innerAPI().magnetEnabled(); }
|
|
62
|
-
magnetMode() { return this._innerAPI().magnetMode(); }
|
|
63
|
-
undoRedoState() { return this._innerAPI().undoRedoState(); }
|
|
64
|
-
setIntervalLinkingEnabled(e) { this._innerAPI().setIntervalLinkingEnabled(e); }
|
|
65
|
-
setTimeFrame(e) { this._innerAPI().setTimeFrame(e); }
|
|
66
|
-
symbolSync() { return this._innerAPI().symbolSync(); }
|
|
67
|
-
intervalSync() { return this._innerAPI().intervalSync(); }
|
|
68
|
-
crosshairSync() { return this._innerAPI().crosshairSync(); }
|
|
69
|
-
timeSync() { return this._innerAPI().timeSync(); }
|
|
70
|
-
getAllFeatures() { return this._innerWindow().getAllFeatures(); }
|
|
71
|
-
clearUndoHistory() { return this._innerAPI().clearUndoHistory(); }
|
|
72
|
-
undo() { return this._innerAPI().undo(); }
|
|
73
|
-
redo() { return this._innerAPI().redo(); }
|
|
74
|
-
startFullscreen() { this._innerAPI().startFullscreen(); }
|
|
75
|
-
exitFullscreen() { this._innerAPI().exitFullscreen(); }
|
|
76
|
-
takeClientScreenshot(e) { return this._innerAPI().takeClientScreenshot(e); }
|
|
77
|
-
navigationButtonsVisibility() { return this._innerWindow().getNavigationButtonsVisibility(); }
|
|
78
|
-
paneButtonsVisibility() { return this._innerWindow().getPaneButtonsVisibility(); }
|
|
79
|
-
dateFormat() { return this._innerWindow().getDateFormat(); }
|
|
80
|
-
_innerAPI() { return this._innerWindow().tradingViewApi; }
|
|
81
|
-
_innerWindow() { return this._iFrame.contentWindow; }
|
|
82
|
-
_doWhenInnerWindowLoaded(e) { this._ready ? e(this._innerWindow()) : this._innerWindowLoaded.then((() => { e(this._innerWindow()); })); }
|
|
83
|
-
_doWhenInnerApiLoaded(e) { this._doWhenInnerWindowLoaded((t => { t.doWhenApiIsReady((() => e(this._innerAPI()))); })); }
|
|
84
|
-
_autoResizeChart() { this._options.fullscreen && (this._iFrame.style.height = window.innerHeight + "px"); }
|
|
85
|
-
_create() { const e = this._render(); this._options.container_id && console.warn("`container_id` is now deprecated. Please use `container` instead to either still pass a string or an `HTMLElement`."); const t = this._options.container_id || this._options.container, i = "string" == typeof t ? document.getElementById(t) : t; if (null === i)
|
|
86
|
-
throw new Error(`There is no such element - #${this._options.container}`); i.innerHTML = e, this._iFrame = i.querySelector(`#${this._id}`); const n = this._iFrame; (this._options.autosize || this._options.fullscreen) && (n.style.width = "100%", this._options.fullscreen || (n.style.height = "100%")), window.addEventListener("resize", this._onWindowResize), this._onWindowResize(), this._innerWindowLoaded = new Promise((e => { const t = () => { n.removeEventListener("load", t, !1), e(); }; n.addEventListener("load", t, !1); })), this._innerWindowLoaded.then((() => { this._innerWindow().widgetReady((() => { this._ready = !0; for (const e of this._readyHandlers)
|
|
87
|
-
try {
|
|
88
|
-
e.call(this);
|
|
69
|
+
constructor(e) {
|
|
70
|
+
if (((this._id = `tradingview_${((1048576 * (1 + Math.random())) | 0)
|
|
71
|
+
.toString(16)
|
|
72
|
+
.substring(1)}`),
|
|
73
|
+
(this._ready = !1),
|
|
74
|
+
(this._readyHandlers = []),
|
|
75
|
+
(this._onWindowResize = this._autoResizeChart.bind(this)),
|
|
76
|
+
!e.datafeed))
|
|
77
|
+
throw new Error("Datafeed is not defined");
|
|
78
|
+
if (((this._options = t(n, e)), e.preset)) {
|
|
79
|
+
const t = i[e.preset];
|
|
80
|
+
t
|
|
81
|
+
? (void 0 !== this._options.disabled_features
|
|
82
|
+
? (this._options.disabled_features =
|
|
83
|
+
this._options.disabled_features.concat(t.disabled_features))
|
|
84
|
+
: (this._options.disabled_features = t.disabled_features),
|
|
85
|
+
void 0 !== this._options.enabled_features
|
|
86
|
+
? (this._options.enabled_features =
|
|
87
|
+
this._options.enabled_features.concat(t.enabled_features))
|
|
88
|
+
: (this._options.enabled_features = t.enabled_features))
|
|
89
|
+
: console.warn("Unknown preset: `" + e.preset + "`");
|
|
89
90
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
"Dark" === this._options.theme &&
|
|
92
|
+
void 0 === this._options.loading_screen &&
|
|
93
|
+
(this._options.loading_screen = { backgroundColor: "#131722" }),
|
|
94
|
+
this._options.debug &&
|
|
95
|
+
(o ||
|
|
96
|
+
((o = !0),
|
|
97
|
+
console.log("Using CL v21.064 (internal id f0bc1e45 @ 2022-03-17T12:19:26.809Z)"))),
|
|
98
|
+
this._create();
|
|
99
|
+
}
|
|
100
|
+
onChartReady(e) {
|
|
101
|
+
this._ready ? e.call(this) : this._readyHandlers.push(e);
|
|
102
|
+
}
|
|
103
|
+
headerReady() {
|
|
104
|
+
return this._innerWindowLoaded.then(() => this._innerWindow().headerReady());
|
|
105
|
+
}
|
|
106
|
+
onGrayedObjectClicked(e) {
|
|
107
|
+
this._doWhenInnerApiLoaded((t) => {
|
|
108
|
+
t.onGrayedObjectClicked(e);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
onShortcut(e, t) {
|
|
112
|
+
this._doWhenInnerWindowLoaded((i) => {
|
|
113
|
+
i.createShortcutAction(e, t);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
subscribe(e, t) {
|
|
117
|
+
this._doWhenInnerApiLoaded((i) => {
|
|
118
|
+
i.subscribe(e, t);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
unsubscribe(e, t) {
|
|
122
|
+
this._doWhenInnerApiLoaded((i) => {
|
|
123
|
+
i.unsubscribe(e, t);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
chart(e) {
|
|
127
|
+
return this._innerAPI().chart(e);
|
|
128
|
+
}
|
|
129
|
+
getLanguage() {
|
|
130
|
+
return this._options.locale;
|
|
131
|
+
}
|
|
132
|
+
setSymbol(e, t, i) {
|
|
133
|
+
this._innerAPI().changeSymbol(e, t, i);
|
|
134
|
+
}
|
|
135
|
+
remove() {
|
|
136
|
+
window.removeEventListener("resize", this._onWindowResize),
|
|
137
|
+
this._readyHandlers.splice(0, this._readyHandlers.length),
|
|
138
|
+
delete window[this._id],
|
|
139
|
+
this._iFrame.parentNode &&
|
|
140
|
+
this._iFrame.parentNode.removeChild(this._iFrame);
|
|
141
|
+
}
|
|
142
|
+
closePopupsAndDialogs() {
|
|
143
|
+
this._doWhenInnerApiLoaded((e) => {
|
|
144
|
+
e.closePopupsAndDialogs();
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
selectLineTool(e) {
|
|
148
|
+
this._innerAPI().selectLineTool(e);
|
|
149
|
+
}
|
|
150
|
+
selectedLineTool() {
|
|
151
|
+
return this._innerAPI().selectedLineTool();
|
|
152
|
+
}
|
|
153
|
+
save(e) {
|
|
154
|
+
this._innerAPI().saveChart(e);
|
|
155
|
+
}
|
|
156
|
+
load(e, t) {
|
|
157
|
+
this._innerAPI().loadChart({ json: e, extendedData: t });
|
|
158
|
+
}
|
|
159
|
+
getSavedCharts(e) {
|
|
160
|
+
this._innerAPI().getSavedCharts(e);
|
|
161
|
+
}
|
|
162
|
+
loadChartFromServer(e) {
|
|
163
|
+
this._innerAPI().loadChartFromServer(e);
|
|
164
|
+
}
|
|
165
|
+
saveChartToServer(e, t, i) {
|
|
166
|
+
this._innerAPI().saveChartToServer(e, t, i);
|
|
167
|
+
}
|
|
168
|
+
removeChartFromServer(e, t) {
|
|
169
|
+
this._innerAPI().removeChartFromServer(e, t);
|
|
170
|
+
}
|
|
171
|
+
onContextMenu(e) {
|
|
172
|
+
this._doWhenInnerApiLoaded((t) => {
|
|
173
|
+
t.onContextMenu(e);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
createButton(e) {
|
|
177
|
+
return this._innerWindow().createButton(e);
|
|
178
|
+
}
|
|
179
|
+
createDropdown(e) {
|
|
180
|
+
return this._innerWindow().createDropdown(e);
|
|
181
|
+
}
|
|
182
|
+
showNoticeDialog(e) {
|
|
183
|
+
this._doWhenInnerApiLoaded((t) => {
|
|
184
|
+
t.showNoticeDialog(e);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
showConfirmDialog(e) {
|
|
188
|
+
this._doWhenInnerApiLoaded((t) => {
|
|
189
|
+
t.showConfirmDialog(e);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
showLoadChartDialog() {
|
|
193
|
+
this._innerAPI().showLoadChartDialog();
|
|
194
|
+
}
|
|
195
|
+
showSaveAsChartDialog() {
|
|
196
|
+
this._innerAPI().showSaveAsChartDialog();
|
|
197
|
+
}
|
|
198
|
+
symbolInterval() {
|
|
199
|
+
return this._innerAPI().getSymbolInterval();
|
|
200
|
+
}
|
|
201
|
+
mainSeriesPriceFormatter() {
|
|
202
|
+
return this._innerAPI().mainSeriesPriceFormatter();
|
|
203
|
+
}
|
|
204
|
+
getIntervals() {
|
|
205
|
+
return this._innerAPI().getIntervals();
|
|
206
|
+
}
|
|
207
|
+
getStudiesList() {
|
|
208
|
+
return this._innerAPI().getStudiesList();
|
|
209
|
+
}
|
|
210
|
+
getStudyInputs(e) {
|
|
211
|
+
return this._innerAPI().getStudyInputs(e);
|
|
212
|
+
}
|
|
213
|
+
addCustomCSSFile(e) {
|
|
214
|
+
this._innerWindow().addCustomCSSFile(e);
|
|
215
|
+
}
|
|
216
|
+
applyOverrides(e) {
|
|
217
|
+
(this._options = t(this._options, { overrides: e })),
|
|
218
|
+
this._doWhenInnerWindowLoaded((t) => {
|
|
219
|
+
t.applyOverrides(e);
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
applyStudiesOverrides(e) {
|
|
223
|
+
this._doWhenInnerWindowLoaded((t) => {
|
|
224
|
+
t.applyStudiesOverrides(e);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
watchList() {
|
|
228
|
+
return this._innerAPI().watchlist();
|
|
229
|
+
}
|
|
230
|
+
news() {
|
|
231
|
+
return this._innerAPI().news();
|
|
232
|
+
}
|
|
233
|
+
activeChart() {
|
|
234
|
+
return this._innerAPI().activeChart();
|
|
235
|
+
}
|
|
236
|
+
chartsCount() {
|
|
237
|
+
return this._innerAPI().chartsCount();
|
|
238
|
+
}
|
|
239
|
+
layout() {
|
|
240
|
+
return this._innerAPI().layout();
|
|
241
|
+
}
|
|
242
|
+
setLayout(e) {
|
|
243
|
+
this._innerAPI().setLayout(e);
|
|
244
|
+
}
|
|
245
|
+
layoutName() {
|
|
246
|
+
return this._innerAPI().layoutName();
|
|
247
|
+
}
|
|
248
|
+
changeTheme(e, t) {
|
|
249
|
+
return this._innerWindow().changeTheme(e, t);
|
|
250
|
+
}
|
|
251
|
+
getTheme() {
|
|
252
|
+
return this._innerWindow().getTheme();
|
|
253
|
+
}
|
|
254
|
+
takeScreenshot() {
|
|
255
|
+
this._doWhenInnerApiLoaded((e) => {
|
|
256
|
+
e.takeScreenshot();
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
lockAllDrawingTools() {
|
|
260
|
+
return this._innerAPI().lockAllDrawingTools();
|
|
261
|
+
}
|
|
262
|
+
hideAllDrawingTools() {
|
|
263
|
+
return this._innerAPI().hideAllDrawingTools();
|
|
264
|
+
}
|
|
265
|
+
drawOnAllCharts(e) {
|
|
266
|
+
this._innerAPI().drawOnAllCharts(e);
|
|
267
|
+
}
|
|
268
|
+
magnetEnabled() {
|
|
269
|
+
return this._innerAPI().magnetEnabled();
|
|
270
|
+
}
|
|
271
|
+
magnetMode() {
|
|
272
|
+
return this._innerAPI().magnetMode();
|
|
273
|
+
}
|
|
274
|
+
undoRedoState() {
|
|
275
|
+
return this._innerAPI().undoRedoState();
|
|
276
|
+
}
|
|
277
|
+
setIntervalLinkingEnabled(e) {
|
|
278
|
+
this._innerAPI().setIntervalLinkingEnabled(e);
|
|
279
|
+
}
|
|
280
|
+
setTimeFrame(e) {
|
|
281
|
+
this._innerAPI().setTimeFrame(e);
|
|
282
|
+
}
|
|
283
|
+
symbolSync() {
|
|
284
|
+
return this._innerAPI().symbolSync();
|
|
285
|
+
}
|
|
286
|
+
intervalSync() {
|
|
287
|
+
return this._innerAPI().intervalSync();
|
|
288
|
+
}
|
|
289
|
+
crosshairSync() {
|
|
290
|
+
return this._innerAPI().crosshairSync();
|
|
291
|
+
}
|
|
292
|
+
timeSync() {
|
|
293
|
+
return this._innerAPI().timeSync();
|
|
294
|
+
}
|
|
295
|
+
getAllFeatures() {
|
|
296
|
+
return this._innerWindow().getAllFeatures();
|
|
297
|
+
}
|
|
298
|
+
clearUndoHistory() {
|
|
299
|
+
return this._innerAPI().clearUndoHistory();
|
|
300
|
+
}
|
|
301
|
+
undo() {
|
|
302
|
+
return this._innerAPI().undo();
|
|
303
|
+
}
|
|
304
|
+
redo() {
|
|
305
|
+
return this._innerAPI().redo();
|
|
306
|
+
}
|
|
307
|
+
startFullscreen() {
|
|
308
|
+
this._innerAPI().startFullscreen();
|
|
309
|
+
}
|
|
310
|
+
exitFullscreen() {
|
|
311
|
+
this._innerAPI().exitFullscreen();
|
|
312
|
+
}
|
|
313
|
+
takeClientScreenshot(e) {
|
|
314
|
+
return this._innerAPI().takeClientScreenshot(e);
|
|
315
|
+
}
|
|
316
|
+
navigationButtonsVisibility() {
|
|
317
|
+
return this._innerWindow().getNavigationButtonsVisibility();
|
|
318
|
+
}
|
|
319
|
+
paneButtonsVisibility() {
|
|
320
|
+
return this._innerWindow().getPaneButtonsVisibility();
|
|
321
|
+
}
|
|
322
|
+
dateFormat() {
|
|
323
|
+
return this._innerWindow().getDateFormat();
|
|
324
|
+
}
|
|
325
|
+
_innerAPI() {
|
|
326
|
+
return this._innerWindow().tradingViewApi;
|
|
327
|
+
}
|
|
328
|
+
_innerWindow() {
|
|
329
|
+
return this._iFrame.contentWindow;
|
|
330
|
+
}
|
|
331
|
+
_doWhenInnerWindowLoaded(e) {
|
|
332
|
+
this._ready
|
|
333
|
+
? e(this._innerWindow())
|
|
334
|
+
: this._innerWindowLoaded.then(() => {
|
|
335
|
+
e(this._innerWindow());
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
_doWhenInnerApiLoaded(e) {
|
|
339
|
+
this._doWhenInnerWindowLoaded((t) => {
|
|
340
|
+
t.doWhenApiIsReady(() => e(this._innerAPI()));
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
_autoResizeChart() {
|
|
344
|
+
this._options.fullscreen &&
|
|
345
|
+
(this._iFrame.style.height = window.innerHeight + "px");
|
|
346
|
+
}
|
|
347
|
+
_create() {
|
|
348
|
+
const e = this._render();
|
|
349
|
+
this._options.container_id &&
|
|
350
|
+
console.warn("`container_id` is now deprecated. Please use `container` instead to either still pass a string or an `HTMLElement`.");
|
|
351
|
+
const t = this._options.container_id || this._options.container, i = "string" == typeof t ? document.getElementById(t) : t;
|
|
352
|
+
if (null === i)
|
|
353
|
+
throw new Error(`There is no such element - #${this._options.container}`);
|
|
354
|
+
(i.innerHTML = e), (this._iFrame = i.querySelector(`#${this._id}`));
|
|
355
|
+
const n = this._iFrame;
|
|
356
|
+
(this._options.autosize || this._options.fullscreen) &&
|
|
357
|
+
((n.style.width = "100%"),
|
|
358
|
+
this._options.fullscreen || (n.style.height = "100%")),
|
|
359
|
+
window.addEventListener("resize", this._onWindowResize),
|
|
360
|
+
this._onWindowResize(),
|
|
361
|
+
(this._innerWindowLoaded = new Promise((e) => {
|
|
362
|
+
const t = () => {
|
|
363
|
+
n.removeEventListener("load", t, !1), e();
|
|
364
|
+
};
|
|
365
|
+
n.addEventListener("load", t, !1);
|
|
366
|
+
})),
|
|
367
|
+
this._innerWindowLoaded.then(() => {
|
|
368
|
+
this._innerWindow().widgetReady(() => {
|
|
369
|
+
this._ready = !0;
|
|
370
|
+
for (const e of this._readyHandlers)
|
|
371
|
+
try {
|
|
372
|
+
e.call(this);
|
|
373
|
+
}
|
|
374
|
+
catch (e) {
|
|
375
|
+
console.error(e);
|
|
376
|
+
}
|
|
377
|
+
this._innerWindow().initializationFinished();
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
_render() {
|
|
382
|
+
const e = window;
|
|
383
|
+
if (((e[this._id] = {
|
|
384
|
+
datafeed: this._options.datafeed,
|
|
385
|
+
customFormatters: this._options.custom_formatters || this._options.customFormatters,
|
|
386
|
+
brokerFactory: this._options.broker_factory || this._options.brokerFactory,
|
|
387
|
+
overrides: this._options.overrides,
|
|
388
|
+
studiesOverrides: this._options.studies_overrides,
|
|
389
|
+
tradingCustomization: this._options.trading_customization,
|
|
390
|
+
disabledFeatures: this._options.disabled_features,
|
|
391
|
+
enabledFeatures: this._options.enabled_features,
|
|
392
|
+
brokerConfig: this._options.broker_config || this._options.brokerConfig,
|
|
393
|
+
restConfig: this._options.restConfig,
|
|
394
|
+
favorites: this._options.favorites,
|
|
395
|
+
logo: this._options.logo,
|
|
396
|
+
numeric_formatting: this._options.numeric_formatting,
|
|
397
|
+
rss_news_feed: this._options.rss_news_feed,
|
|
398
|
+
newsProvider: this._options.news_provider,
|
|
399
|
+
loadLastChart: this._options.load_last_chart,
|
|
400
|
+
saveLoadAdapter: this._options.save_load_adapter,
|
|
401
|
+
loading_screen: this._options.loading_screen,
|
|
402
|
+
settingsAdapter: this._options.settings_adapter,
|
|
403
|
+
getCustomIndicators: this._options.custom_indicators_getter,
|
|
404
|
+
additionalSymbolInfoFields: this._options.additional_symbol_info_fields,
|
|
405
|
+
headerWidgetButtonsMode: this._options.header_widget_buttons_mode,
|
|
406
|
+
symbolSearchComplete: this._options.symbol_search_complete,
|
|
407
|
+
}),
|
|
408
|
+
this._options.saved_data))
|
|
409
|
+
(e[this._id].chartContent = { json: this._options.saved_data }),
|
|
410
|
+
this._options.saved_data_meta_info &&
|
|
411
|
+
(e[this._id].chartContentExtendedData =
|
|
412
|
+
this._options.saved_data_meta_info);
|
|
413
|
+
else if (!this._options.load_last_chart && !this._options.symbol)
|
|
414
|
+
throw new Error("Symbol is not defined: either 'symbol' or 'load_last_chart' option must be set");
|
|
415
|
+
const t = (this._options.library_path || "") +
|
|
416
|
+
`${encodeURIComponent(this._options.locale)}-tv-chart.f0bc1e45.html#symbol=` +
|
|
417
|
+
encodeURIComponent(this._options.symbol || "") +
|
|
418
|
+
"&interval=" +
|
|
419
|
+
encodeURIComponent(this._options.interval) +
|
|
420
|
+
(this._options.timeframe
|
|
421
|
+
? "&timeframe=" + encodeURIComponent(this._options.timeframe)
|
|
422
|
+
: "") +
|
|
423
|
+
(this._options.toolbar_bg
|
|
424
|
+
? "&toolbarbg=" +
|
|
425
|
+
encodeURIComponent(this._options.toolbar_bg.replace("#", ""))
|
|
426
|
+
: "") +
|
|
427
|
+
(this._options.studies_access
|
|
428
|
+
? "&studiesAccess=" +
|
|
429
|
+
encodeURIComponent(JSON.stringify(this._options.studies_access))
|
|
430
|
+
: "") +
|
|
431
|
+
"&widgetbar=" +
|
|
432
|
+
encodeURIComponent(JSON.stringify(this._options.widgetbar)) +
|
|
433
|
+
(this._options.drawings_access
|
|
434
|
+
? "&drawingsAccess=" +
|
|
435
|
+
encodeURIComponent(JSON.stringify(this._options.drawings_access))
|
|
436
|
+
: "") +
|
|
437
|
+
"&timeFrames=" +
|
|
438
|
+
encodeURIComponent(JSON.stringify(this._options.time_frames)) +
|
|
439
|
+
"&locale=" +
|
|
440
|
+
encodeURIComponent(this._options.locale) +
|
|
441
|
+
"&uid=" +
|
|
442
|
+
encodeURIComponent(this._id) +
|
|
443
|
+
"&clientId=" +
|
|
444
|
+
encodeURIComponent(String(this._options.client_id)) +
|
|
445
|
+
"&userId=" +
|
|
446
|
+
encodeURIComponent(String(this._options.user_id)) +
|
|
447
|
+
(this._options.charts_storage_url
|
|
448
|
+
? "&chartsStorageUrl=" +
|
|
449
|
+
encodeURIComponent(this._options.charts_storage_url)
|
|
450
|
+
: "") +
|
|
451
|
+
(this._options.charts_storage_api_version
|
|
452
|
+
? "&chartsStorageVer=" +
|
|
453
|
+
encodeURIComponent(this._options.charts_storage_api_version)
|
|
454
|
+
: "") +
|
|
455
|
+
(this._options.custom_css_url
|
|
456
|
+
? "&customCSS=" + encodeURIComponent(this._options.custom_css_url)
|
|
457
|
+
: "") +
|
|
458
|
+
(this._options.auto_save_delay
|
|
459
|
+
? "&autoSaveDelay=" +
|
|
460
|
+
encodeURIComponent(String(this._options.auto_save_delay))
|
|
461
|
+
: "") +
|
|
462
|
+
"&debug=" +
|
|
463
|
+
encodeURIComponent(String(this._options.debug)) +
|
|
464
|
+
(this._options.snapshot_url
|
|
465
|
+
? "&snapshotUrl=" + encodeURIComponent(this._options.snapshot_url)
|
|
466
|
+
: "") +
|
|
467
|
+
(this._options.timezone
|
|
468
|
+
? "&timezone=" + encodeURIComponent(this._options.timezone)
|
|
469
|
+
: "") +
|
|
470
|
+
(this._options.study_count_limit
|
|
471
|
+
? "&studyCountLimit=" +
|
|
472
|
+
encodeURIComponent(String(this._options.study_count_limit))
|
|
473
|
+
: "") +
|
|
474
|
+
(this._options.symbol_search_request_delay
|
|
475
|
+
? "&ssreqdelay=" +
|
|
476
|
+
encodeURIComponent(String(this._options.symbol_search_request_delay))
|
|
477
|
+
: "") +
|
|
478
|
+
(this._options.compare_symbols
|
|
479
|
+
? "&compareSymbols=" +
|
|
480
|
+
encodeURIComponent(JSON.stringify(this._options.compare_symbols))
|
|
481
|
+
: "") +
|
|
482
|
+
(this._options.theme
|
|
483
|
+
? "&theme=" + encodeURIComponent(String(this._options.theme))
|
|
484
|
+
: "") +
|
|
485
|
+
(this._options.header_widget_buttons_mode
|
|
486
|
+
? "&header_widget_buttons_mode=" +
|
|
487
|
+
encodeURIComponent(String(this._options.header_widget_buttons_mode))
|
|
488
|
+
: "") +
|
|
489
|
+
(this._options.time_scale
|
|
490
|
+
? "&time_scale=" +
|
|
491
|
+
encodeURIComponent(JSON.stringify(this._options.time_scale))
|
|
492
|
+
: "");
|
|
493
|
+
return ('<iframe id="' +
|
|
494
|
+
this._id +
|
|
495
|
+
'" name="' +
|
|
496
|
+
this._id +
|
|
497
|
+
'" src="' +
|
|
498
|
+
t +
|
|
499
|
+
'"' +
|
|
500
|
+
(this._options.autosize || this._options.fullscreen
|
|
501
|
+
? ""
|
|
502
|
+
: ' width="' +
|
|
503
|
+
this._options.width +
|
|
504
|
+
'" height="' +
|
|
505
|
+
this._options.height +
|
|
506
|
+
'"') +
|
|
507
|
+
' title="Financial Chart" frameborder="0" allowTransparency="true" scrolling="no" allowfullscreen style="display:block;"></iframe>');
|
|
508
|
+
}
|
|
97
509
|
};
|
|
98
|
-
return window.TradingView = window.TradingView || {},
|
|
99
|
-
|
|
510
|
+
return ((window.TradingView = window.TradingView || {}),
|
|
511
|
+
(window.TradingView.version = s),
|
|
512
|
+
(e.version = s),
|
|
513
|
+
(e.widget = r),
|
|
514
|
+
e);
|
|
515
|
+
})({});
|