Skip to content

Commit 86b0c0c

Browse files
committed
Fix network clients authentication for OKX
Thanks for reporting @S3toGreen
1 parent 62b02ed commit 86b0c0c

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

RELEASES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Released on TBD (UTC).
4848
- Fixed the instrument class of `IndexInstrument`, changing to `SPOT` to correctly represent a spot index of underlying constituents
4949
- Fixed data range request `end` handling for `DataEngine`
5050
- Fixed unsubscribe instrument close for `DataEngine`
51+
- Fixed network clients authentication for OKX (#2553), thanks for reporting @S3toGreen
5152
- Reverted removal of rotate log file on UTC date change (#2552), thanks @twitu
5253

5354
### Documentation Updates

nautilus_trader/adapters/okx/http/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def _sign(self, timestamp: str, method: str, url_path: str, body: str) -> str:
131131
if body == "{}" or body == "None":
132132
body = ""
133133
message = str(timestamp) + method.upper() + url_path + body
134-
digest = hmac_signature(self._api_secret, message).encode()
134+
digest = bytes.fromhex(hmac_signature(self._api_secret, message))
135135
return base64.b64encode(digest).decode()
136136

137137
async def send_request(

nautilus_trader/adapters/okx/websocket/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ async def _login(self):
10041004

10051005
timestamp = int(self._clock.timestamp())
10061006
message = str(timestamp) + "GET/users/self/verify"
1007-
digest = hmac_signature(self._api_secret, message).encode()
1007+
digest = bytes.fromhex(hmac_signature(self._api_secret, message))
10081008
sign = base64.b64encode(digest).decode()
10091009
payload = {
10101010
"op": "login",

0 commit comments

Comments
 (0)