zenbot icon indicating copy to clipboard operation
zenbot copied to clipboard

Unable to live trade: "Timestamp for this request is outside of the recvWindow"

Open hmb104 opened this issue 8 years ago • 5 comments

System information

  • Have I written custom code (as opposed to using zenbot vanilla): NO
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): CentOS 7
  • Zenbot version: 4.0.5
  • NodeJS version: v8.9.3
  • Python version: N/A
  • Exact command to reproduce: binance DELETE https://api.binance.com/api/v3/order binance GET https://api.binance.com/api/v3/order?timestamp=1514502714605&symbol=BNBETH&orderId=9366045&signature=7899c1b16fb849959bf5

It happens every few transactions and the bot never breaks as it continues to run.

Describe the problem

In live trade mode in Binance, sometimes the bot is unable to place orders, get balance or cancel orders.

all the time the message is the same "400 Bad Request {"code":-1021,"msg":"Timestamp for this request is outside of the recvWindow."} (possible reasons: invalid API keys, bad or old nonce, exchange is down or offline, on maintenance, DDoS protection, rate-limiting)"

This way the bot sometime cannot trade efficently as it cannot delete orders or show the balances

Source code / logs

017-12-28 17:10:48 0.0125488 BNB-ETH +1.19% 87 50 + -0.0003 0.0397 selling 4.97248993 BNB 0.12668039 ETH -0.22% -0.41% Binance API is down! unable to call getOrder, retrying in 20s { Error: binance GET https://api.binance.com/api/v3/order?timestamp=1514502689244&symbol=BNBETH&orderId=9366045&signature=f0427f9b3da9be32dcb4f9643ecb4e27933246a1b4c3b6dde812770c15622f17 400 Bad Request {"code":-1021,"msg":"Timestamp for this request is outside of the recvWindow."} (possible reasons: invalid API keys, bad or old nonce, exchange is down or offline, on maintenance, DDoS protection, rate-limiting) at binance.defaultErrorHandler (/home/hmb104/Desktop/zenbot/node_modules/ccxt/js/base/Exchange.js:413:15) at response.text.then.text (/home/hmb104/Desktop/zenbot/node_modules/ccxt/js/base/Exchange.js:426:25) at at process._tickCallback (internal/process/next_tick.js:188:7) constructor: [Function: ExchangeNotAvailable] } [ { order_id: '9366045', product_id: 'BNB-ETH' } ]

Error: binance DELETE https://api.binance.com/api/v3/order 400 Bad Request {"code":-1021,"msg":"Timestamp for this request is outside of the recvWindow."} (possible reasons: invalid API keys, bad or old nonce, exchange is down or offline, on maintenance, DDoS protection, rate-limiting) at binance.defaultErrorHandler (/home/hmb104/Desktop/zenbot/node_modules/ccxt/js/base/Exchange.js:413:15) at response.text.then.text (/home/hmb104/Desktop/zenbot/node_modules/ccxt/js/base/Exchange.js:426:25) at at process._tickCallback (internal/process/next_tick.js:188:7) constructor: [Function: ExchangeNotAvailable] } [ { order_id: '9366738', product_id: 'BNB-ETH' } ]

Any idea? It looks like it is related to CCXT modeul.

Thanks, HMB

hmb104 avatar Dec 28 '17 23:12 hmb104

Solved here by synchronizing time with ntpd very frequently: https://github.com/ccxt/ccxt/issues/936

kroitor avatar Dec 29 '17 21:12 kroitor

I got this error today with current version on windows with vs2017 debugger. I synced my time manual, but still error happen. First restart of zenbot fixed the issue.

trivalik avatar Feb 22 '18 22:02 trivalik

How is this fixed? I get it even if i restart.

Primea1 avatar Feb 24 '18 18:02 Primea1

I synced manual in the date/time dialog. image

trivalik avatar Mar 01 '18 18:03 trivalik

@trivalik enabling that option will not help, it will synchronize time once in a day, which is not enough. You need to set up your registry to synchronize the time more frequently, than it's done by default: https://github.com/ccxt/ccxt/issues/850. Hope it helps.

kroitor avatar Mar 02 '18 01:03 kroitor