pybit
pybit copied to clipboard
Add signature_window to WebSocket def _auth()
#63 Solution for the issue described there
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:
- use an attribute like
signature_windowshown 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
- create a method which queries for bybit's server time and automatically calculates the difference and adjusts
expiresaccordingly (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.