Closed roywasse closed 3 years ago
Thanks again for identifying another bug Roy.
If you fancy having a go at a fix and PR, you're more than welcome :-)
I'm pretty busy at the moment with other stuff, but I plan on releasing a maintenance/dependency update release of the bot in the Spring.
When the bot is running a long time, I still receive errors from Kraken saying that the nonce is invalid.
According to this kraken article https://support.kraken.com/hc/en-us/articles/360022636092-Sample-implementations , the following implementation is an working example implementation for the rest api:
Maybe, bxbot should use this calculation as well?
@MarcDahlem It seems that nonce can indeed cause issues in the current implementation in certain circumstances. But the root cause is not what you might think (IMO).
The comments in the existing code explain this and provide a solution, copy paste of this comments:
_Note: Sometimes requests can arrive out of order or NTP can cause your clock to rewind,
The current nonce is derived from the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC. See https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/System.html#currentTimeMillis()
This should ensure the nonce is always unique.
I therefore don't think it's necessary to update the calculation method of the nonce
The KrakenAPI doesn't allow the nonce is currently formatted: nonce = System.currentTimeMillis() \ 1000; Solution: nonce = System.currentTimeMillis();