cryptoeax / arbbot

Arbitrator, a bitcoin/altcoin arbitrage trading bot
https://gitter.im/cryptoeax-arbbot/Lobby
GNU General Public License v3.0
199 stars 78 forks source link

Invalid Nonce Parameter #8

Closed valent closed 6 years ago

valent commented 6 years ago

I am getting this error everytime i run the program. Kindly advice error

cryptoeax commented 6 years ago

This error typically means that your API key has already been used by another API call that has used a larger nonce value, so this bot doesn't know how to use your keys. Please try generating a fresh API key on Poloniex for the bot to use instead...

valent commented 6 years ago

Generated 3 fresh keys. Issue still persists.

cryptoeax commented 6 years ago

Can you please run the following steps to help diagnose what's going on so I can help you?

Thanks!

kingchenx commented 6 years ago

I get this infos with the edited code..

String(18) "768346381" 21:41:59: POLONIEX [ERROR] [POLONIEX] API error response: Invalid nonce parameter.

cryptoeax commented 6 years ago

Hmm, that looks very wrong!

Can you please paste this small test case into a file called test.php and run it and see what you get? Do you use php or hhvm? What version? Can you test with the other two?

<?php
var_dump( microtime( true ) );
$x = floor( microtime( true ) * 1000000 );
printf("%ld\n", $x);
kingchenx commented 6 years ago

Allright!

php test.php float(1512824985.4222) 1512824985422311

hhvm test.php float(1512825426.0869) 1512825426095384

The thing is, the problem is not conanstly, after a "clean" arbbot-production installation fix this problem for a limited time, then the "bug??" comes back.. idk mhmm, maybe there is a problem on poloniex side?

I used php and hhvm, same result,

hhvm 3.23.2-1~xen amd64
php-cli 1:7.0+35ubun all
php-common 1:35ubuntu6 all
php-curl 1:7.0+35ubun all
php-fpm 1:7.0+35ubun all
php7.0-cli 7.0.22-0ubun amd64

cryptoeax commented 6 years ago

The numbers you are seeing now are making more sense now.

Do you modify the system date when this problem happens? That is the only way that I can see this happen based on the code that generates this number, if something (either you or a program) sets the system date a long time into the past...)

I don't think this is a problem on the poloniex side. "nonce" is just an integer that should be larger than what you submitted in your latest API call, and is used to ensure your API calls are processed in the correct order.

kingchenx commented 6 years ago

You talked about the Time... My System Date and Time is correct 11.12.2017, 02:41 -> but the bot have 01:41 < bot missing one hour, is this the problem?

cryptoeax commented 6 years ago

The bot uses the UTC timezone, so perhaps that explains the difference in time?

But what I meant before was the number you are getting is the number of seconds since January 1, 1970 (this is called a "Unit Timestamp") so if your system date is changed either by someone or by a program, that could explain why the bot sometimes reads numbers that are that small.

FWIW, 768346381 represents a date around 1994-05-07 17:33:01. :-)

kingchenx commented 6 years ago

I think my ubuntu server have some sync problems... ill fixxed it with easy commands, and now works without the error/bug ;) thx cryptoeax feel free to add to readme for other users with same problem? ;) --> sudo apt-get install ntpdate --> sudo ntpdate ntp.ubuntu.com

cryptoeax commented 6 years ago

Thanks, I think I will add that to the installation instructions. :-)