TradingView-API icon indicating copy to clipboard operation
TradingView-API copied to clipboard

why i cant get my private indicators?

Open ikulichkov opened this issue 3 years ago • 1 comments

check please my code what i missed?

import TradingView from '@mathieuc/tradingview'

TradingView.loginUser(process.argv[2], process.argv[3], false).then((user) => {
  console.log('User:', user);
  console.log('Sessionid:', user.session);
// if (!process.argv[2]) throw Error('Please specify your \'sessionid\' cookie');

const client = new TradingView.Client({
  token: process.argv[2],
});

const chart = new client.Session.Chart();
chart.setMarket('BINANCE:BTCUSDTPERP', {
  timeframe: 'D',
});

TradingView.getPrivateIndicators(process.argv[2]).then((indicList) => {
  indicList.forEach(async (indic) => {
    const privateIndic = await indic.get();
    console.log('Loading indicator', indic.name, '...');

    const indicator = new chart.Study(privateIndic);

    indicator.onReady(() => {
      console.log('Indicator', indic.name, 'loaded !');
    });

    indicator.onUpdate(() => {
      console.log('Plot values', indicator.periods);
      console.log('Strategy report', indicator.strategyReport);
    });
  });
});
}).catch((err) => {
  console.error('Login error:', err.message);
});

TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received an instance of Object

ikulichkov avatar Oct 18 '22 13:10 ikulichkov

check your process.argv[*]

lumpov avatar Feb 06 '23 17:02 lumpov