Closed ronanmendes closed 4 years ago
Open the app folder and edit BinanceAPI.py in notepad find recvWindow and replace the figures with something <= 60000
This got it working for me.
can anyone explain what that function does and what happens if i change the value?
The recvWindow is for synchronization with the Binance server. It is checking your local time and the time on the Binance server, if the difference is bigger than the recvWindow {miliseconds] you will recieve an error. "An additional parameter, recvWindow, may be sent to specify the number of milliseconds after timestamp the request is valid for. If recvWindow is not sent, it defaults to 5000." You can also check here: https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md
The value isn't read from the config file, so here is a diff output that needs to be applied to fix the issue:
diff --git a/app/BinanceAPI.py b/app/BinanceAPI.py
index e47763d..e4081bb 100755
--- a/app/BinanceAPI.py
+++ b/app/BinanceAPI.py
@@ -114,7 +114,7 @@ class BinanceAPI:
return data
def _get(self, path, params={}):
- params.update({"recvWindow": 120000})
+ params.update({"recvWindow": 60000})
query = urlencode(self._sign(params))
url = "%s?%s" % (path, query)
header = {"X-MBX-APIKEY": self.key}
@@ -122,7 +122,7 @@ class BinanceAPI:
timeout=30, verify=True).json()
def _post(self, path, params={}):
- params.update({"recvWindow": 120000})
+ params.update({"recvWindow": 60000})
query = urlencode(self._sign(params))
url = "%s?%s" % (path, query)
header = {"X-MBX-APIKEY": self.key}
@@ -149,9 +149,9 @@ class BinanceAPI:
return "{:.8f}".format(price)
def _delete(self, path, params={}):
- params.update({"recvWindow": 120000})
+ params.update({"recvWindow": 60000})
query = urlencode(self._sign(params))
url = "%s?%s" % (path, query)
header = {"X-MBX-APIKEY": self.key}
return requests.delete(url, headers=header, \
- timeout=30, verify=True).json()
\ No newline at end of file
+ timeout=30, verify=True).json()
With the latest commit, value is read from 'config.py'
I tried this command bellow and got the error in the image
python trader.py --symbol KAVABTC --mode range --quantity 64 --buyprice 0.00013965 --sellprice 0.00014650 --stop_loss 1
https://imgur.com/a/RZuHLv8