tradingview-scraper icon indicating copy to clipboard operation
tradingview-scraper copied to clipboard

TypeError: tv.setup is not a function

Open slashvortal opened this issue 5 years ago • 2 comments

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;
      }
    });
  });
});

slashvortal avatar May 24 '20 20:05 slashvortal

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

imxeno avatar May 24 '20 21:05 imxeno

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

slashvortal avatar May 24 '20 21:05 slashvortal