imxeno/tradingview-scraper

is setInterval to listen to the ticker mandatory?

Closed this issue · 4 comments

Hi,

Thanks for this great tool.
I was just wandering if I need to listen to the ticker changes with new setInterval like:

const TradingViewAPI = require('tradingview-scraper');
const tv = new TradingViewAPI();

setInterval(() => tv.getTicker('EURUSD').then(result => {
  console.log(result)
}), 1000);

Or I'm doing it wrong? because firing the tv.getTicker(ticker) is returning only one response.

Hey,

Thanks for your interest in my project.

As this tool was made because I needed just the current ticker data there's no event support, but actually, since I was going to update the library soon (the codebase is really dirty), I may implement it in next version. I'll leave this issue open as a feature request. If anyone wants to implement this feature faster than me and submit a PR, you're more than welcome.

So answering your question: yes, that's the only way at the moment.

Best regards,
Piotr Adamczyk

@chang96 a new, experimental version that implements event emitter functionality is available on develop branch - cb82a53. If you've got some time check it out and let me know what do you think. It is not available on NPM at the moment.

The new version was made available on NPM, so I'm closing this as it's no longer relevant.