Open HomeRobot opened 2 years ago
waiting for correction
jaggedsoft commented on 5 Sep 2018
problem is because useServerTime takes a second to kick in sometimes For you this method of serverTime should work, this will allow it to fire on startup
binance.useServerTime(() => binance.balance((error, balances) => { if ( error ) return console.error(error.body); console.log("balances()", balances); if ( typeof balances.BTC !== "undefined" ) console.log("BTC balance: ", balances.BTC.available); if ( typeof balances.ETH !== "undefined" ) console.log("ETH balance: ", balances.ETH.available); }) );
This is an error telling you to reveal your ip connection type. Please find out your ip address type (ipv4, ipv6 etc) (probably ipv4) and try with the parameter I wrote as family.
let binance = new Binance().options({
APIKEY: config.APIKEY,
APISECRET: config.APISECRET,
family: 4,
useServerTime: true,
reconnect: true,
verbose: true,
})
My code is:
API keys are valid, IP added. When I try to run it, I got an error:
[ 'balanceData error', {} ] TypeError [ERR_INVALID_ARG_VALUE]: The property 'options.family' must be one of: 0, 4, 6. Received false at lookup (node:dns:143:7) at node:net:1116:5 at defaultTriggerAsyncIdScope (node:internal/async_hooks:463:18) at lookupAndConnect (node:net:1115:3) at Socket.connect (node:net:1053:5) at Object.connect (node:_tls_wrap:1660:13) at Agent.createConnection (node:https:146:22) at Agent.createSocket (node:_http_agent:343:26) at Agent.addRequest (node:_http_agent:294:10) at new ClientRequest (node:_http_client:319:16) { code: 'ERR_INVALID_ARG_VALUE' } {}