Open cynologic opened 2 years ago
Actually it's relevant for all futures calls. Futures mini ticker is working like a charm undortunately other futures api call seems not working ;(
console.info( await binance.futuresPrices() ); ^^^^^
It seems something is missing for async / await. But no chance to find out it ;(
I'm trying this code let balance = await binance.futuresBalance(); console.log(balance)
Try this one instead:
(async () => {
let balance = await binance.futuresBalance();
console.log(balance);
})()
Just a friendly advice: learn js before doing something
Thank you so much Dmitry for your quick comment. I appreciate it. As you advised I need to study ES6 features such async.
[Object: null prototype] { code: -1021, msg: "Timestamp for this request was 1000ms ahead of the server's time." }
I feel like it is a problem related to troubleshooting section: https://github.com/jaggedsoft/node-binance-api#troubleshooting
try to set userServerTime
:
binance.options({
...
useServerTime: true,
...
});
or increase recvWindow
value
Dear Dmitry, Thanks for your answer it's still returning the same error the code as follows. No chance to get the balance and price
const Binance = require('node-binance-api'); const binance = new Binance().options({ APIKEY: '--', APISECRET: '--', useServerTime: true, recvWindow: 30000, });
(async () => { binance.useServerTime() let balance = await binance.futuresBalance(); console.log(balance); })()
Hello again I fixed it syncing time of my local PC.
I want to make this function as follows let bal = (async () => { return await binance.futuresBalance(); })()
and then use the bal variable in other expressions.
Thank you so much in advance.
Hello, I am having an issue with the await. I appreciate if you could help me with this issue
I'm trying this code let balance = await binance.futuresBalance(); console.log(balance)
it's returning an error as follows SyntaxError: await is only valid in async functions and the top level bodies of modules
Same issue for other callback functions such console.info( await binance.futuresAccount() );
Thank you in advance Best regards