TradingView-API
TradingView-API copied to clipboard
why i cant get my private indicators?
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
check your process.argv[*]