An EAPI:Invalid nonce error indicates that an API request was received with a repeated or lower than expected nonce value.
Since the nonce value must be unique and must increase with every request, you may run into errors when trying to make simultaneous requests, or requests in rapid succession, or when attempting to use a single API key for multiple devices/apps/bots.
As an example, two simultaneous API requests might not arrive in the intended order, and if the second request (with a higher nonce) arrives before the first request (with a lower nonce), the first request would be rejected when it finally arrives.
As invalid nonce errors will cause your API requests to fail (your orders not to be placed, for example), invalid nonce errors should not simply be ignored, but should be corrected by improving the nonce creation algorithm (see some solutions below).
Some potential solutions for invalid nonce errors are as follows:
- 1Create multiple API keys and use a different key for each simultaneous request, each device/app, each trading bot, etc. Each API key has its own separate nonce value, so the order in which API requests arrive would no longer be an issue.
- 2Increase the nonce resolution so as to allow additional requests during the same time frame (increasing the nonce resolution from milliseconds to tenths of milliseconds, for example).
- 3Increase/widen the nonce window for your API keys so as to provide a short time frame during which invalid nonce values would not cause an error. Note that this solution should only be used to overcome networking issues, not as a way to ignore invalid nonce errors entirely.