Open bmw7 opened 3 years ago
In windows I leave running a .bat as administrator to synchronize the time, then the code.
net stop w32time w32tm /unregister w32tm /register net start w32time w32tm /resync timeout /t 120 /nobreak
:inicio
cls @echo off
echo Esto es un bucle infinito %username% w32tm /config /manualpeerlist:"time.nist.gov time.windows.com time-nw.nist.gov time-a.nist.gov time-b.nist.gov time-a.timefreq.bldrdoc.gov time-b.timefreq.bldrdoc.gov time-c.timefreq.bldrdoc.gov utcnist.colorado.edu" /syncfromflags:manual /update
w32tm /resync /force
timeout /t 120 /nobreak
goto inicio
You can use the following python script (with your environement run in administrator mode) :
from binance.client import Client
client = Client('api_key', 'api_secret')
import time
import win32api
gt = client.get_server_time()
tt=time.gmtime(int((gt["serverTime"])/1000))
win32api.SetSystemTime(tt[0],tt[1],0,tt[2],tt[3],tt[4],tt[5],0)
I've set up windows auto-sync for time. But still I'm randomly getting this error. Is there a definitive solution for this?
Exception has occurred: BinanceAPIException
APIError(code=-1021): Timestamp for this request is outside of the recvWindow.
I run my codes and wrong message shows:
binance.exceptions.BinanceAPIException: APIError(code=-1021): Timestamp for this request is outside of the recvWindow.
how to solve it on linux server and windows server? thanks very much!!