APIError(code=-1021): Timestamp for this request was 1000ms ahead of the server's time.
CLIENT.get_my_trades(symbol="BNBETH", recvWindow=100000)
CLIENT.get_my_trades(symbol="BNBETH")
Both give the same error. The strange thing is that I don't get this error with get_aggregate_trades function, only with get_my_trades.
I made sure my internet time is synced.
I get the same error sometimes with get_account()
I see the same error. Has anyone solved it?
I found that my computer time is not synced with a proper NTP server therefore I ran into this issue too.
If you are using OSX, can try this tutorial: https://grok.lsu.edu/article.aspx?articleid=8102 and set the NTP server to the correct NTP server on http://www.pool.ntp.org/zone/us (US for example).
Otherwise, a dirty hack is to "minus" the calculate timestamp
int(time.time() * 1000) -
Unfortunately Binance is strict with the timestamp differences in their API constraints.
This is my solution for timestamps issue. The code made equal windows time to binance server time.
from binance.client import Client client = Client('api_key', 'api_secret') import time import win32api gt = client.get_server_time() aa = str(gt) bb = aa.replace("{'serverTime': ","") aa = bb.replace("}","") gg=int(aa) ff=gg-10799260 uu=ff/1000 yy=int(uu) tt=time.localtime(yy) win32api.SetSystemTime(tt[0],tt[1],0,tt[2],tt[3],tt[4],tt[5],0)
"The integer 10799260 for adjusting time zone and fine tuning for miliseconds."
The solution from nadirdogan works for me too. I improved/condensed his code a bit
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)
Hi @MarcelBeining, I'm glad to see you like my solution :)
from control panel > date and time > internet time change the server to >>>> time.nist.gov it worked with me
nbjkl;
from control panel > date and time > internet time change the server to >>>> time.nist.gov it worked with me
This works for me on win10, make sure you set control panel icons to small or you may have a hard time finding the internet time setting.
from control panel > date and time > internet time change the server to >>>> time.nist.gov it worked with me You can go to date and time settings(Change the date and time). Then press sync now.
(default) time.windows.com is working for me.
Solution for me on:
APIError(code=-1021): Timestamp for this request was 1000ms ahead of the server's time.
After searching for days and trying so many things, this webpage blog helped me out to get my laptop in sync... thank god.
All the other usual solutions didn't work at all for but this, Its in german but i guess one can easily translate it in their language ;).
First link is part 1 and the second link is part 2.
https://www.borncity.com/blog/2019/02/25/windows-10-probleme-mit-der-zeitsynchronisation/ https://www.borncity.com/blog/2019/02/26/windows-10-probleme-mit-der-zeitsynchronisation-teil-2/
you need to synchronize the time on your PC over the Internet. import os os.system("w32tm /resync")
from control panel > date and time > internet time change the server to >>>> time.nist.gov it worked with me
it's worked for me, thanks 👌
CLIENT.get_my_trades(symbol="BNBETH", recvWindow=100000) CLIENT.get_my_trades(symbol="BNBETH")Both give the same error. The strange thing is that I don't get this error with get_aggregate_trades function, only with get_my_trades.
I made sure my internet time is synced.
I also had the same issue on my windows PC, And I just adjusted the time to be automatic and its now working perfectly