bmino / binance-triangle-arbitrage

Detect in-market cryptocurrency arbitrage
MIT License
1.07k stars 337 forks source link

Timestamp for this request was 1000ms ahead of the server's time #51

Closed ghost closed 5 years ago

ghost commented 5 years ago

caseless: Caseless { dict: { 'content-type': 'application/json;charset=utf-8', 'transfer-encoding': 'chunked', connection: 'close', date: 'Sat, 27 Apr 2019 16:04:19 GMT', server: 'nginx', 'x-mbx-used-weight': '5', 'strict-transport-security': 'max-age=31536000; includeSubdomains', 'x-frame-options': 'SAMEORIGIN', 'x-xss-protection': '1; mode=block', 'x-content-type-options': 'nosniff', 'content-security-policy': "default-src 'self'", 'x-content-security-policy': "default-src 'self'", 'x-webkit-csp': "default-src 'self'", 'cache-control': 'no-cache, no-store, must-revalidate', pragma: 'no-cache', expires: '0', 'x-cache': 'Error from cloudfront', via: '1.1 b3229c68bc96ea68371695efdc615317.cloudfront.net (CloudFront)', 'x-amz-cf-id': '6ZN6xzHzS2z0CqYUSoLeymcLKSwx3pEd3xRfZSbcorGHjvTK8daGJg==' } }, body: {"code":-1021,"msg":"Timestamp for this request was 1000ms ahead of the server's time."} }

bmino commented 5 years ago

This is a check put in place from Binance to ensure that an api request doesn't lag too bad. Sync your system clock and it should go away.

If it doesn't, there is an additional option that can be used to sync each request with the api server.

ghost commented 5 years ago

-"Sync your system clock and it should go away."

That was the issue .. Thanks so much for your quick reply! Have a nice time :)

bmino commented 5 years ago

Sure thing!

danielj86 commented 5 years ago

Im having the same problem, my clock is synced. @bmino What is the other otption you mention to sync each request?

bmino commented 5 years ago

My suggestion is to add this fourth config option as a binance argument in the file src/main/Main.js

binance.options({
    APIKEY: CONFIG.KEYS.API,
    APISECRET: CONFIG.KEYS.SECRET,
    test: !CONFIG.TRADING.ENABLED,
    useServerTime: true
});

Even if this fixes the issue, will you please post the error if you can still replicate it? And for reference your operating system as well

danielj86 commented 5 years ago

Im using Windows 10, the problem is was that my the auto-sync with Internet time was off. After enabling it and forcing sync the problem solved.