hello, I’m testing the connection with the spot api to see to receive the status of my account and it appears to me that the timestamp is not correct, but as you will see it meets the conditions to pass … I attach my code and the error
const tiempo = new Date().getTime() - 60000
const comprobar = new Spot()
comprobar.time().then(response => {
recvWindow=10000
if (tiempo < (response.data.serverTime + 1000) && (response.data.serverTime - tiempo) <= recvWindow){
const client = new Spot(apiKey, apiSecret , {timestamp: tiempo,timeout: 15000, recvWindow: 10000})
client.accountStatus().then(response => {
console.log(response.data)
}).catch(error => {
console.log(error)
})
} else {
console.log('Timestamp is invalid')
}
})
in console appear :
Error: Request failed with status code 400
at createError (C:\Users\garci\Desktop\Paginas\React ibot\server\node_modules\axios\lib\core\createError.js:16:15)
at settle (C:\Users\garci\Desktop\Paginas\React ibot\server\node_modules\axios\lib\core\settle.js:17:12)
at IncomingMessage.handleStreamEnd (C:\Users\garci\Desktop\Paginas\React ibot\server\node_modules\axios\lib\adapters\http.js:269:11)
at IncomingMessage.emit (node:events:539:35)
at endReadableNT (node:internal/streams/readable:1345:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
config: {
url: '/sapi/v1/account/status?timestamp=1664212185957&signature=ccb19bd80c9b37d',
method: 'get',
headers: {
Accept: 'application/json, text/plain, */*',
'Content-Type': 'application/json',
'X-MBX-APIKEY': '3mxk',
'User-Agent': '@binance/connector-node/1.13.0'
},
baseURL: 'https://api.binance.com',
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
adapter: [Function: httpAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
data: undefined
},
a lot stuff....
and
data: {
code: -1021,
msg: "Timestamp for this request was 1000ms ahead of the server's time."
}
please i need a help ?