Merge pull request #1 from itsdeka/patch-1

Nonce generation must be the same of the previous version.
This commit is contained in:
Davide Casale
2023-02-20 15:19:05 +01:00
committed by Davide Casale
2 changed files with 3 additions and 3 deletions

View File

@@ -19,7 +19,7 @@ class Middleware(object):
assert isinstance(self.API_KEY, str) and isinstance(self.API_SECRET, str), \ assert isinstance(self.API_KEY, str) and isinstance(self.API_SECRET, str), \
"API_KEY and API_SECRET must be both str to call __build_authentication_headers" "API_KEY and API_SECRET must be both str to call __build_authentication_headers"
nonce = str(int(time.time()) * 1000) nonce = int(round(time.time() * 1_000_000))
if data == None: if data == None:
path = f"/api/v2/{endpoint}{nonce}" path = f"/api/v2/{endpoint}{nonce}"

View File

@@ -174,7 +174,7 @@ class BfxWebsocketClient(object):
async def __authenticate(self, API_KEY, API_SECRET, filter=None): async def __authenticate(self, API_KEY, API_SECRET, filter=None):
data = { "event": "auth", "filter": filter, "apiKey": API_KEY } data = { "event": "auth", "filter": filter, "apiKey": API_KEY }
data["authNonce"] = int(time.time()) * 1000 data["authNonce"] = int(round(time.time() * 1_000_000))
data["authPayload"] = "AUTH" + str(data["authNonce"]) data["authPayload"] = "AUTH" + str(data["authNonce"])