Open 0xAnarz opened 4 years ago
Oh not good, I guess we should use micro seconds instead of unix milli seconds. Thanks @0xAnarz for opening the issue.
I will work on a fix now.
Actually I've just looked into this. Right now the nonce is generated using the function uint64(time.Now().Unix() * 1000)
, which right now is 1573140173000
.
MAX_SAFE_INTEGER is 9007199254740991
which means I am able to make 9005626114567991
requests before I exceed the integer limit.
Are you sure that the error you are seeing is due to an invalid nonce??
func (u *EpochNonceGenerator) GetNonce() string { return strconv.FormatUint(atomic.AddUint64(&u.nonce, 1), 10) }
actually give me 1573143819683568401
The temp fix (/1000) work, and without it I'm still getting :
2019/11/07 17:23:39 Error: POST https://api.bitfinex.com/v2/auth/r/positions: 500 apikey: invalid (10100)
Maybe an OS issue ? I'm doing it from win7
Thats strange, ill try this out on a windows machine.
GetNonce() for v2 REST can lead to an integer which exceed the MAX_SAFE_INTEGER constant, resulting in an authentication error from the API.
Temp fix :
func (u *EpochNonceGenerator) GetNonce() string { return strconv.FormatUint(atomic.AddUint64(&u.nonce, 1) / 1000, 10) }