jaggedsoft / node-binance-api

Node Binance API is an asynchronous node.js library for the Binance API designed to be easy to use.
MIT License
1.58k stars 768 forks source link

error about await binance.futuresPositionRisk() #480

Open vicentxxye opened 4 years ago

vicentxxye commented 4 years ago

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?

byjameson commented 4 years ago

why are u using this function?

vicentxxye commented 4 years ago

to get my order's entryprice do you have any suggest?