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