Timestamp 1000ms error with useServerTime = true for long-running script
See original GitHub issueTitle
- bug: useServerTime not working as expected
Short Description:
- Timestamp 1000ms after server time with useServerTime = true after running script for 3 days.
Platform:
- windows
node version:
- 9.11
Long descrption
- Timestamp 1000ms after server time with useServerTime = true after running script for 3 days - is it possible running for a long time slowly desynchronizes over time?
- Error occurred on a signed order request to start a new order after one order had just filled - is it related to doing back-to-back requests, or because I did a request immediately after receiving the ws.executionUpdate packet?
code
binance.options({
APIKEY: '...',
APISECRET: '...',
useServerTime: true,
test: false
});
//... BinanceBroker.js class
openOrder: function(order) {
var that = this;
//... Prepare and track order, do quantity and price filters
var options = {
type: 'LIMIT',
newOrderRespType: 'ACK',
newClientOrderId: order.clientId
};
//... func will equal binance.buy or binance.sell, or throw.
return new Promise((resolve, reject) => {
func(order.pair, amount, price, options, (error, response) => {
if (error) {
var body = JSON.parse(error.body);
console.error('[Binance] ['+order.pair+'] ' + body.msg);
throw error;
}
order.id = response.orderId;
resolve(order);
});
});
},
result
Timestamp 1000ms past server time error.
thank you
- No, thank YOU!
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Binance order: Timestamp for this request was 1000ms ahead ...
It seems that the recvWindow of 60000 is still not sufficient (but it may not exceed 60K). I still get the same error....
Read more >node-binance-api - Github Plus
Timestamp 1000ms error with useServerTime = true for long-running script. Title. bug: useServerTime not working as expected. Short Description: Timestamp ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s been 5 days now and I haven’t gotten the error, so this does seem to be the best workaround to mitigate the issue.
Further protections on my side like gracefully handling this error and repeating my request, on the off-chance it still happens, also has me sleeping sounder at night.
Thanks to jaggedsoft and best of luck.
I think the real solution here is to sync your server time or set your system to auto-sync the time once or twice per day
Here is one easy solution I can think of