imxeno / tradingview-scraper

A gateway to TradingView's data for your Node.js application!
ISC License
263 stars 60 forks source link

is setInterval to listen to the ticker mandatory? #7

Closed slashvortal closed 1 year ago

slashvortal commented 4 years ago

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.

imxeno commented 4 years ago

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 commented 4 years ago

Ok thanks!

On Saturday, November 30, 2019, Piotr Adamczyk notifications@github.com wrote:

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 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

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/imxeno/tradingview-scraper/issues/7?email_source=notifications&email_token=AGSW6E3C7FNHVBEIZ3HUU3LQWKAY3A5CNFSM4JTGNE32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFQKRLI#issuecomment-559982765, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGSW6EYCQCRD2VZNBGLBSUTQWKAY3ANCNFSM4JTGNE3Q .

imxeno commented 4 years ago

@chang96 a new, experimental version that implements event emitter functionality is available on develop branch - cb82a5327a72010e8038eb684ae1b42dea3daa80. 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.

imxeno commented 1 year ago

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