pybit icon indicating copy to clipboard operation
pybit copied to clipboard

Add signature_window to WebSocket def _auth()

Open ImaRicklePick opened this issue 4 years ago • 1 comments

#63 Solution for the issue described there

ImaRicklePick avatar Dec 02 '21 19:12 ImaRicklePick

This is not a good way to solve this issue. Ideally, it should be solved at the root, which is by syncing the computer's clock (which python's time module relies on). I don't think it should be addressed in code, as it disguises the problem, which could cause other issues later on that would be difficult to diagnose.

If one was to address it in code, it should be done in one of the following ways:

  1. use an attribute like signature_window shown here, but add the difference to the current time instead of removing the millisecond conversion as done by this PR. It should look something like
expires = int((time.time() + 1) * 1000 + self.signature_window
  1. create a method which queries for bybit's server time and automatically calculates the difference and adjusts expires accordingly (in the same way as in the above example)

But I don't think these are real solutions and I don't want to encourage their use... However, I am open to persuasion.

dextertd avatar Dec 24 '21 12:12 dextertd