i use console.info( await binance.futuresPositionRisk() );
to get the my opened order's entryprice
as below
var entry=0
var position=0
var getposition = async() => {
data = await binance.futuresPositionRisk({ symbol: 'BTCUSDT' })
entry = +data[0].entryPrice
position = +data[0].positionAmt
};
setInterval(() => {
getposition()
console.log('entry='+entry)
}, 3000);
70% time it play well
30% time i get the error below
(node:356452) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'entryPrice' of undefined
at getposition (/home/scut85295858/Desktop/1/sev1vhmaatrstoploss.js:50:23)
at runMicrotasks ()
i use console.info( await binance.futuresPositionRisk() ); to get the my opened order's entryprice
as below
var entry=0 var position=0 var getposition = async() => { data = await binance.futuresPositionRisk({ symbol: 'BTCUSDT' }) entry = +data[0].entryPrice position = +data[0].positionAmt }; setInterval(() => { getposition() console.log('entry='+entry) }, 3000);
70% time it play well
30% time i get the error below
(node:356452) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'entryPrice' of undefined at getposition (/home/scut85295858/Desktop/1/sev1vhmaatrstoploss.js:50:23) at runMicrotasks ()
how can i dowith this error?