imxeno / tradingview-scraper

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

TypeError: tv.setup is not a function #9

Closed slashvortal closed 2 years ago

slashvortal commented 4 years ago

Hello :) Are you still maintaining this library? I would love to contribute.

After recent update, I'm getting: TypeError: tv.setup is not a function

const { TradingViewAPI } = require("tradingview-scraper");

const bitcoinSymbol = "BTCUSD";
const tv = new TradingViewAPI();

process.stdout.write("Loading...");

tv.setup().then(() => {
  tv.getTicker(bitcoinSymbol).then(ticker => {
    let last = 0;
    ticker.on("update", data => {
      if (data.lp && data.lp !== last) {
        process.stdout.clearLine();
        process.stdout.cursorTo(0);
        process.stdout.write(
          "[" +
            bitcoinSymbol +
            "] " +
            (last > data.lp ? "-" : "+") +
            " " +
            data.lp.toFixed(2) +
            " "
        );
        last = data.lp;
      }
    });
  });
});
imxeno commented 4 years ago

Hey @slashvortal,

thanks for your message. I suppose that you are talking about the examples on develop branch, where I started working on a new version of the library, and it is not yet documented.

If you are using the library from npm, please stick to the README on master branch. I'll try to find a while soon to finish the new version.

Best regards, Piotr Adamczyk

slashvortal commented 4 years ago

Oh sorry my bad, I mistakenly pulled the master. Yes I'm on develop branch and works perfectly.