Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

Nonce is too small Error. When trying to use bitfinex exchange. #595

Closed
sad8c opened this issue Feb 21, 2017 · 16 comments
Closed

Nonce is too small Error. When trying to use bitfinex exchange. #595

sad8c opened this issue Feb 21, 2017 · 16 comments

Comments

@sad8c
Copy link

sad8c commented Feb 21, 2017

Just starting gekko
node gekko
Then i see some advices and then gekko stops with error:

Gekko encountered an error and can't continue

Error:

Error: Nonce is too small.
    at Request._callback (/home/ubuntu/workspace/gekko/node_modules/bitfinex-api-node/rest.js:68:23)
    at Request.self.callback (/home/ubuntu/workspace/gekko/node_modules/request/request.js:186:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:192:7)
    at Request.<anonymous> (/home/ubuntu/workspace/gekko/node_modules/request/request.js:1081:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:189:7)
    at IncomingMessage.<anonymous> (/home/ubuntu/workspace/gekko/node_modules/request/request.js:1001:12)
    at Object.onceWrapper (events.js:291:19)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:186:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9) '\n\n'

Meta debug info:

Gekko version: v0.3.4
Nodejs version: v7.5.0

If i use log.debug in rest.js file (in bitfinex-api-node module):

function rest(key, secret, nonceGenerator) {
    this.url = "https://api.bitfinex.com";
    this.version = 'v1';
    this.key = key;
    this.secret = secret;
    this.nonce = new Date().getTime();
    this._nonce = typeof nonceGenerator === "function" ? nonceGenerator : function () {
        //noinspection JSPotentiallyInvalidUsageOfThis
        log.debug(this.nonce);
        return ++this.nonce;
    };
}

i see nonces logged in console, and see another error:

2017-02-21 16:39:10 (DEBUG):    1487695150056
2017-02-21 16:39:10 (DEBUG):    1487695150057
2017-02-21 16:39:10 (DEBUG):    1487695150058
2017-02-21 16:39:10 (DEBUG):    1487695150059
2017-02-21 16:39:10 (DEBUG):    1487695150060
2017-02-21 16:39:10 (DEBUG):    1487695150061
2017-02-21 16:39:10 (DEBUG):    1487695150062
2017-02-21 16:39:10 (DEBUG):    1487695150063
2017-02-21 16:39:10 (DEBUG):    1487695150064
2017-02-21 16:39:10 (DEBUG):    1487695150065
2017-02-21 16:39:10 (DEBUG):    1487695150066
2017-02-21 16:39:10 (DEBUG):    1487695150067
2017-02-21 16:39:10 (DEBUG):    1487695150068
2017-02-21 16:39:10 (DEBUG):    1487695150069
2017-02-21 16:39:10 (DEBUG):    1487695150070
2017-02-21 16:39:10 (DEBUG):    1487695150071
2017-02-21 16:39:10 (DEBUG):    1487695150072
2017-02-21 16:39:10 (DEBUG):    1487695150073
2017-02-21 16:39:10 (DEBUG):    { type: 'exchange',
  currency: 'btc',
  amount: '1.0',
  available: '1.0' }
/home/ubuntu/workspace/gekko/plugins/trader/portfolioManager.js:110
  return this.getFund(fund).amount;
                           ^

TypeError: Cannot read property 'amount' of undefined
    at Manager.getBalance (/home/ubuntu/workspace/gekko/plugins/trader/portfolioManager.js:110:28)
    at Manager.bound [as getBalance] (/home/ubuntu/workspace/gekko/node_modules/lodash/dist/lodash.js:729:21)
    at Manager.act (/home/ubuntu/workspace/gekko/plugins/trader/portfolioManager.js:138:23)
    at bound (/home/ubuntu/workspace/gekko/node_modules/lodash/dist/lodash.js:729:21)
    at /home/ubuntu/workspace/gekko/node_modules/async/lib/async.js:232:13
    at /home/ubuntu/workspace/gekko/node_modules/async/lib/async.js:142:25
    at /home/ubuntu/workspace/gekko/node_modules/async/lib/async.js:229:17
    at /home/ubuntu/workspace/gekko/node_modules/async/lib/async.js:556:34
    at Manager.<anonymous> (/home/ubuntu/workspace/gekko/plugins/trader/portfolioManager.js:76:7)
    at /home/ubuntu/workspace/gekko/exchanges/bitfinex.js:56:5
    at Request._callback (/home/ubuntu/workspace/gekko/node_modules/bitfinex-api-node/rest.js:70:16)
    at Request.self.callback (/home/ubuntu/workspace/gekko/node_modules/request/request.js:186:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:192:7)
    at Request.<anonymous> (/home/ubuntu/workspace/gekko/node_modules/request/request.js:1081:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:189:7)
    at IncomingMessage.<anonymous> (/home/ubuntu/workspace/gekko/node_modules/request/request.js:1001:12)
    at Object.onceWrapper (events.js:291:19)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:186:7)
    at endReadableNT (_stream_readable.js:974:12)
@sad8c
Copy link
Author

sad8c commented Feb 21, 2017

Sorry, it's not bound. I have Nonce error even if i log this:

2017-02-21 16:44:43 (DEBUG):    1487695483017
2017-02-21 16:44:43 (DEBUG):    1487695483018
2017-02-21 16:44:43 (DEBUG):    1487695483019
2017-02-21 16:44:43 (DEBUG):    1487695483020
2017-02-21 16:44:43 (DEBUG):    1487695483021
2017-02-21 16:44:43 (DEBUG):    1487695483022
2017-02-21 16:44:43 (DEBUG):    1487695483023
2017-02-21 16:44:43 (DEBUG):    1487695483024
2017-02-21 16:44:43 (DEBUG):    1487695483025
2017-02-21 16:44:43 (DEBUG):    1487695483026
2017-02-21 16:44:43 (DEBUG):    1487695483027
2017-02-21 16:44:43 (DEBUG):    1487695483028
2017-02-21 16:44:43 (DEBUG):    1487695483029
2017-02-21 16:44:43 (DEBUG):    1487695483030


Gekko encountered an error and can't continue

Error:

Error: Nonce is too small.
    at Request._callback (/home/ubuntu/workspace/gekko/node_modules/bitfinex-api-node/rest.js:68:23)
    at Request.self.callback (/home/ubuntu/workspace/gekko/node_modules/request/request.js:186:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:192:7)
    at Request.<anonymous> (/home/ubuntu/workspace/gekko/node_modules/request/request.js:1081:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:189:7)
    at IncomingMessage.<anonymous> (/home/ubuntu/workspace/gekko/node_modules/request/request.js:1001:12)
    at Object.onceWrapper (events.js:291:19)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:186:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9) '\n\n'

Meta debug info:

Gekko version: v0.3.4
Nodejs version: v7.5.0

@sad8c
Copy link
Author

sad8c commented Feb 21, 2017

I've noticed that logging nonces a really strange. In unixtime it is like that:
1487695483030 = Wed, 12 Mar 49113 17:17:10 GMT

@sad8c
Copy link
Author

sad8c commented Feb 21, 2017

I think "Nonce too small" can be because any same process is running twice. But which process?...

@xhad
Copy link
Contributor

xhad commented Feb 23, 2017

I can take a look at this when I have time. Its very possible the bfx npm module is outdated and would need to be rewritten.

http://docs.bitfinex.com/v1/docs/rest-auth

@thegamecat
Copy link

Getting the same error with Poloniex.

@askmike askmike added the bug label Mar 10, 2017
@Rudimo
Copy link

Rudimo commented Mar 23, 2017

same problem on the Bitfinex

@x0rium
Copy link

x0rium commented Mar 23, 2017

Bitfinex problem

@thegamecat
Copy link

Still getting this on poloniex

@generalectric
Copy link
Contributor

I had this error when I ran gekko in a virtual machine on Windows 7. In my case it turned out to be time drift.

@thegamecat
Copy link

This is on ubuntu 16.04 and:

Nonce must be greater than 1905332886555001. You provided 149315522139600.

@thegamecat
Copy link

Is anyone else getting this issue on Poloniex?

@askmike
Copy link
Owner

askmike commented Apr 26, 2017

@thegamecat please open a seperate issue for poloniex, this is definitely not the same problem!

@askmike
Copy link
Owner

askmike commented Jul 2, 2017

I have worked on updating the codebase for bitfinex (as part of #737), in my testing I am unable to reproduce. I am closing this because I assume this is not an issue anymore, it it is please comment here :)

@ghost
Copy link

ghost commented Apr 1, 2018

I have just had the same problem ...
I have remove old api key/secret.
Create a new one and now it s work.

@xFFFFF
Copy link
Contributor

xFFFFF commented Apr 14, 2018

I have this problem too on my local. On VPS working fine. Created new API doesnt help.

@askmike I can give You access to my local with anydesk to fix it if You want.

@halflive-1
Copy link

Same problem on Poloniex.
Error: Nonce must be greater than 152510833507500. You provided 152510832809100

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants