binbot-charts 0.5.3 → 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
+ })({});
@@ -62,7 +62,7 @@ class Datafeed {
62
62
  timezone: "Etc/UTC",
63
63
  exchange: "Binance",
64
64
  minmov: 100,
65
- pricescale: 100000000,
65
+ pricescale: 100000,
66
66
  has_daily: true,
67
67
  has_intraday: true,
68
68
  has_no_volume: false,
@@ -1,32 +1,10 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
- const react_1 = __importStar(require("react"));
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_1 = require("react");
30
8
  const use_immer_1 = require("use-immer");
31
9
  require("./App.css");
32
10
  const TVChartContainer_1 = __importDefault(require("./components/TVChartContainer"));
@@ -96,11 +74,6 @@ function App() {
96
74
  setSymbolState(e.target.value);
97
75
  }
98
76
  };
99
- return (<>
100
- <h1 style={{ textAlign: "center" }}>Test chart</h1>
101
- <label htmlFor="symbol">Type symbol</label>
102
- <input name="symbol" type="text" onChange={handleChange}/>
103
- <TVChartContainer_1.default symbol={symbolState} interval={"1h"} timescaleMarks={testTimeMarks} orderLines={orderLines} onTick={handleTick} getLatestBar={getLatestBar}/>
104
- </>);
77
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h1", Object.assign({ style: { textAlign: "center" } }, { children: "Test chart" })), (0, jsx_runtime_1.jsx)("label", Object.assign({ htmlFor: "symbol" }, { children: "Type symbol" })), (0, jsx_runtime_1.jsx)("input", { name: "symbol", type: "text", onChange: handleChange }), (0, jsx_runtime_1.jsx)(TVChartContainer_1.default, { symbol: symbolState, interval: "1h", timescaleMarks: testTimeMarks, orderLines: orderLines, onTick: handleTick, getLatestBar: getLatestBar })] }));
105
78
  }
106
79
  exports.default = App;
@@ -1,99 +1,515 @@
1
- var TradingView = function (e) {
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) { const n = Object.assign({}, e); for (const o in i)
4
- "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; }
5
- 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: [] } };
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() { return "CL v21.064 (internal id f0bc1e45 @ 2022-03-17T12:19:26.809Z)"; }
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) { 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)
10
- throw new Error("Datafeed is not defined"); if (this._options = t(n, e), e.preset) {
11
- const t = i[e.preset];
12
- 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 + "`");
13
- } "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(); }
14
- onChartReady(e) { this._ready ? e.call(this) : this._readyHandlers.push(e); }
15
- headerReady() { return this._innerWindowLoaded.then((() => this._innerWindow().headerReady())); }
16
- onGrayedObjectClicked(e) { this._doWhenInnerApiLoaded((t => { t.onGrayedObjectClicked(e); })); }
17
- onShortcut(e, t) { this._doWhenInnerWindowLoaded((i => { i.createShortcutAction(e, t); })); }
18
- subscribe(e, t) { this._doWhenInnerApiLoaded((i => { i.subscribe(e, t); })); }
19
- unsubscribe(e, t) { this._doWhenInnerApiLoaded((i => { i.unsubscribe(e, t); })); }
20
- chart(e) { return this._innerAPI().chart(e); }
21
- getLanguage() { return this._options.locale; }
22
- setSymbol(e, t, i) { this._innerAPI().changeSymbol(e, t, i); }
23
- 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); }
24
- closePopupsAndDialogs() { this._doWhenInnerApiLoaded((e => { e.closePopupsAndDialogs(); })); }
25
- selectLineTool(e) { this._innerAPI().selectLineTool(e); }
26
- selectedLineTool() { return this._innerAPI().selectedLineTool(); }
27
- save(e) { this._innerAPI().saveChart(e); }
28
- load(e, t) { this._innerAPI().loadChart({ json: e, extendedData: t }); }
29
- getSavedCharts(e) { this._innerAPI().getSavedCharts(e); }
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
- catch (e) {
91
- console.error(e);
92
- } this._innerWindow().initializationFinished(); })); })); }
93
- _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)
94
- 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);
95
- else if (!this._options.load_last_chart && !this._options.symbol)
96
- 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>'; }
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 || {}, window.TradingView.version = s, e.version = s, e.widget = r, e;
99
- }({});
510
+ return ((window.TradingView = window.TradingView || {}),
511
+ (window.TradingView.version = s),
512
+ (e.version = s),
513
+ (e.widget = r),
514
+ e);
515
+ })({});
@@ -1,27 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -35,7 +12,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
13
  };
37
14
  Object.defineProperty(exports, "__esModule", { value: true });
38
- const react_1 = __importStar(require("react"));
15
+ const jsx_runtime_1 = require("react/jsx-runtime");
16
+ const react_1 = require("react");
17
+ const charting_library_1 = require("../charting_library/");
39
18
  const datafeed_1 = __importDefault(require("./datafeed"));
40
19
  const use_immer_1 = require("use-immer");
41
20
  const TVChartContainer = ({ symbol = "BTCUSDT", interval = "1h", libraryPath = "/charting_library/", timescaleMarks = [], orderLines = [], height = "calc(100vh - 80px)", onTick, getLatestBar, }) => {
@@ -78,7 +57,7 @@ const TVChartContainer = ({ symbol = "BTCUSDT", interval = "1h", libraryPath = "
78
57
  "mainSeriesProperties.barStyle.dontDrawOpen": false,
79
58
  },
80
59
  };
81
- const tvWidget = new TradingView.widget(widgetOptions);
60
+ const tvWidget = new charting_library_1.widget(widgetOptions);
82
61
  tvWidget.onChartReady(() => {
83
62
  tvWidget.subscribe("onTick", (event) => onTick && onTick(event));
84
63
  setWidgetState(tvWidget);
@@ -138,6 +117,6 @@ const TVChartContainer = ({ symbol = "BTCUSDT", interval = "1h", libraryPath = "
138
117
  }
139
118
  }
140
119
  };
141
- return <div ref={containerRef} style={{ height: height }}/>;
120
+ return (0, jsx_runtime_1.jsx)("div", { ref: containerRef, style: { height: height } });
142
121
  };
143
122
  exports.default = TVChartContainer;
@@ -98,7 +98,7 @@ class Datafeed {
98
98
  timezone: "Etc/UTC",
99
99
  exchange: "Binance",
100
100
  minmov: 100,
101
- pricescale: 100000000,
101
+ pricescale: 100000,
102
102
  has_daily: true,
103
103
  has_intraday: true,
104
104
  has_no_volume: false,
package/dist/src/index.js CHANGED
@@ -3,8 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
7
  const react_1 = __importDefault(require("react"));
7
8
  const react_dom_1 = __importDefault(require("react-dom"));
8
9
  const App_tsx_1 = __importDefault(require("./App.tsx"));
9
10
  require("./index.css");
10
- react_dom_1.default.render(<App_tsx_1.default />, document.getElementById('root'));
11
+ react_dom_1.default.render((0, jsx_runtime_1.jsx)(App_tsx_1.default, {}), document.getElementById('root'));
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.5.3",
2
+ "version": "0.5.4",
3
3
  "name": "binbot-charts",
4
4
  "dependencies": {
5
5
  "react": "^17.0.1",
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "TVChartContainer", {
7
- enumerable: true,
8
- get: function () {
9
- return _TVChartContainer.default;
10
- }
11
- });
12
- var _TVChartContainer = _interopRequireDefault(require("./TVChartContainer"));
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }