jonchurch / tradingview-js-api-tutorial

308 stars 181 forks source link

getBars throwing an error #20

Open anmolbhutada opened 3 years ago

anmolbhutada commented 3 years ago

0: close: 32622.08 high: 32628.64 low: 32565.57 open: 32586.6 time: 1626323160000 volume: 4.13 This is the format in which I am getting data on logging it in console.

historyProvider.getBars(symbolInfo, resolution, from, to, firstDataRequest) .then(bars => { console.log(bars); if (bars.length) { console.log("I have bars"); onHistoryCallback(bars, {noData: false}); } else { console.log("I dont have bars"); onHistoryCallback(bars, {noData: true}); } }).catch(err => { console.log({err}) onErrorCallback(err) })

Here onHistoryCallback(bars, {noData: false}); throws an error and doesn't render the chart.

Error is: {err: TypeError: e.split is not a function at t.GVHu.pe._getStatusTextOnStudyError (http://localhost:…} err: TypeError: e.split is not a function at t.GVHu.pe._getStatusTextOnStudyError (http://localhost:3000/charting_library/bundles/library.8954c29e08b972724a0c.js:260:1395) at t.GVHu.pe._handleStudyError (http://localhost:3000/charting_library/bundles/library.8954c29e08b972724a0c.js:260:1601) at t.GVHu.pe.onData (http://localhost:3000/charting_library/bundles/library.8954c29e08b972724a0c.js:260:1952) at _handler (http://localhost:3000/charting_library/bundles/library.8954c29e08b972724a0c.js:251:2611) at EX27.JSServer.ChartApi._invokeHandler (http://localhost:3000/charting_library/bundles/library.8954c29e08b972724a0c.js:228:2151) at EX27.JSServer.ChartApi._invokeNotificationHandler (http://localhost:3000/charting_library/bundles/library.8954c29e08b972724a0c.js:229:1345) at EX27.JSServer.ChartApi._dispathNotification (http://localhost:3000/charting_library/bundles/library.8954c29e08b972724a0c.js:229:1164) at EX27.JSServer.ChartApi.receiveLocalResponse (http://localhost:3000/charting_library/bundles/library.8954c29e08b972724a0c.js:225:2690) at c.MrEN.c.onStudyError (http://localhost:3000/charting_library/bundles/library.8954c29e08b972724a0c.js:322:2931) at Object.onErrorCallback (http://localhost:3000/charting_library/bundles/library.8954c29e08b972724a0c.js:218:291) From previous event: at Object.getBars (http://localhost:3000/static/js/bundle.js:119576:129) at e._ensureRequestedTo (http://localhost:3000/charting_library/bundles/library.8954c29e08b972724a0c.js:420:2569) at e._processPendingSubscribers (http://localhost:3000/charting_library/bundles/library.8954c29e08b972724a0c.js:419:1961) at http://localhost:3000/charting_library/bundles/library.8954c29e08b972724a0c.js:418:1898 proto: Object

Anyone having any idea on how to fix it. @jonchurch @miky9585