rferro / plnx

Unofficial Poloniex API client, with public/private methods and push.
http://rferro.github.io/plnx
46 stars 12 forks source link

error: Nonce must be greater than XXX. You provided YYY #2

Closed hems closed 8 years ago

hems commented 8 years ago

sometimes when calling poloniex.returnCompleteBalances i get the following error:

Nonce must be greater than 145775411307000. You provided 145775411206800.

Perhaps there is something weird going with the https://github.com/abrkn/nonce module ?

rferro commented 8 years ago

Hi hems

I remove the nonce module and create a new internal function. Now the nonce number is milliseconds with a counter (1000+). In my tests with big concurrent calling, the problem don't appear.

Tks

hems commented 8 years ago

Still i get the same error with 0.0.6, for instance now i got:

I20160313-16:37:20.686(0)? Nonce must be greater than 1457886268864001. You provided 1457886263846001.
I20160313-16:37:23.127(0)? Nonce must be greater than 1457886271873001. You provided 1457886270872001.
I20160313-16:37:26.337(0)? Nonce must be greater than 1457886278894001. You provided 1457886277890001.
I20160313-16:37:33.529(0)? Nonce must be greater than 1457886282906001. You provided 1457886275885001.
I20160313-16:37:42.990(0)? Nonce must be greater than 1457886288932001. You provided 1457886276889001.
rferro commented 8 years ago

hi hems

how are you doing these requests? I think if you are doing all at the same time, one can be executed before another and give this problem.

tks

hems commented 8 years ago

@rferro i have them in a setInterval with 1 second delay, perhaps that isn't a good strategy in case something is lagging on their side..

Anyway i must change my implementation to be smarter about using the push api.

rferro commented 8 years ago

@hems I found the problem. the options object when referenced and I change them inside main function. So the nonce param crash if you use a object and not explicit.

With problem: plnx.returnTradeHistory(options, function(err, data){}

Without problem: plnx.returnTradeHistory({key:"", secret:""}, function(err, data){}

In commit 7340021 the problem has fixed.

Tks!

hems commented 8 years ago

ahhhh muleki!

i'll be back! i mean, i hope i won't (( :

please don't forget to publish the package