askmike / gekko

A bitcoin trading bot written in node - https://gekko.wizb.it/
MIT License
10.07k stars 3.94k forks source link

Received error in import #2348

Closed Eivlys closed 6 years ago

Eivlys commented 6 years ago

I run gekko in the cloud and it can't import data, log shows: <-- POST /api/import Import 3656690821254136 started --> POST /api/import 200 5ms 148b RECEIVED ERROR IN IMPORT 3656690821254136 {}

and the alert in page is image

when run with commandline I got this error /home/sylvie/gekko/core/pluginUtil.js:72 if(!_.contains(plugin.modes, gekkoMode)) { ^

TypeError: _.contains is not a function at load (/home/sylvie/gekko/core/pluginUtil.js:72:11) at /home/sylvie/gekko/node_modules/async/dist/async.js:1156:9 at replenish (/home/sylvie/gekko/node_modules/async/dist/async.js:1030:17) at /home/sylvie/gekko/node_modules/async/dist/async.js:1034:9 at _asyncMap (/home/sylvie/gekko/node_modules/async/dist/async.js:1154:5) at /home/sylvie/gekko/node_modules/async/dist/async.js:1240:16 at Object.mapSeries (/home/sylvie/gekko/node_modules/async/dist/async.js:1066:16) at loadPlugins (/home/sylvie/gekko/core/pipeline.js:52:11) at /home/sylvie/gekko/node_modules/async/dist/async.js:3845:9 at replenish (/home/sylvie/gekko/node_modules/async/dist/async.js:1030:17)

I tried different exchanges and they all have the same issue, but data import runs ok in my local

version in cloud npm 6.1.0 gekko 0.6.2

version in local npm 6.1.0 gekko 0.5.14

How can I fixed this, thank you!

askmike commented 6 years ago

Something is wrong with the versions of your dependencies, best fix would be running these commands inside the Gekko folder:

rm -rf node_modules
npm install --only=production
cd exchange
rm -rf node_modules
npm install --only=production
Eivlys commented 6 years ago

@askmike I reinstall the node_module as the commands upwards, but it still got the same problem, is there another way to deal with that?

askmike commented 6 years ago

Inside the gekko directory, can you run the following and let me know what the result?

npm list | grep lodash

On Mon, Jul 23, 2018 at 11:32 AM, Eivlys notifications@github.com wrote:

@askmike https://github.com/askmike I reinstall the node_module as the commands upwards, but it still got the same problem, is there another way to deal with that?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/askmike/gekko/issues/2348#issuecomment-406929574, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7MDzq8X9lLdY6yZ01mOCPsTXCmp0s2ks5uJUPSgaJpZM4VZ647 .

-- PGP key at keybase.io/mikevanrossum https://keybase.io/mikevanrossum/key.asc

mdcaddic commented 6 years ago

I think you might need to open this one again @askmike, I get the same issue importing from binance. Issue only started with 0.63 and other (ok, polo,usdt,btc) work fine.

mdcaddic@ubuntu1604:~/gekko$ npm list | grep lodash │ ├── lodash@4.17.4 │ └── lodash@4.17.4 │ ├── lodash@4.17.10 ├── lodash@2.4.2 │ │ └── lodash@4.17.4

To confirm: Importing from binance on 0.5.13 stills works correctly this morning. Importing same data on 0.6.3 does not even after rm -rf node_modules and npm install --only=prod

mdcaddic commented 6 years ago

Importing from command line on 0.6.3

2018-07-23 06:05:33 (DEBUG): 2018-07-23T06:05:33+00:00 crypto.js:117 this._handle.init(hmac, toBuf(key)); ^

TypeError: Key must be a buffer at new Hmac (crypto.js:117:16) at Object.createHmac (crypto.js:643:10) at BinanceRest._sign (/home/mdcaddic/gekko/exchange/node_modules/binance/lib/rest.js:163:23) at BinanceRest._makeRequest (/home/mdcaddic/gekko/exchange/node_modules/binance/lib/rest.js:51:46) at BinanceRest.account (/home/mdcaddic/gekko/exchange/node_modules/binance/lib/rest.js:331:21) at fetch (/home/mdcaddic/gekko/exchange/wrappers/binance.js:194:36) at RetryOperation._fn (/home/mdcaddic/gekko/exchange/exchangeUtils.js:21:5) at RetryOperation.attempt (/home/mdcaddic/gekko/exchange/node_modules/retry/lib/retry_operation.js:112:8) at retryInstance (/home/mdcaddic/gekko/exchange/exchangeUtils.js:20:13) at Trader.getFee (/home/mdcaddic/gekko/exchange/wrappers/binance.js:195:3) mdcaddic@ubuntu1604:~/gekko$

Eivlys commented 6 years ago

@askmike │ ├── lodash@4.17.4 │ └── lodash@4.17.10 │ └── lodash@4.17.10 │ ├── lodash@4.17.10 │ │ └── lodash@3.10.1 │ │ ├── lodash.assignin@4.2.0 │ │ ├── lodash.bind@4.2.1 │ │ ├── lodash.defaults@4.2.0 │ │ ├── lodash.filter@4.6.0 │ │ ├── lodash.flatten@4.4.0 │ │ ├── lodash.foreach@4.5.0 │ │ ├── lodash.map@4.6.0 │ │ ├── lodash.merge@4.6.1 │ │ ├── lodash.pick@4.4.0 │ │ ├── lodash.reduce@4.6.0 │ │ ├── lodash.reject@4.6.0 │ │ └── lodash.some@4.6.0 │ ├─┬ lodash.create@3.1.1 │ │ ├─┬ lodash._baseassign@3.2.0 │ │ │ ├── lodash._basecopy@3.0.1 │ │ │ └─┬ lodash.keys@3.1.2 │ │ │ ├── lodash._getnative@3.9.1 │ │ │ ├── lodash.isarguments@3.1.0 │ │ │ └── lodash.isarray@3.0.4 │ │ ├── lodash._basecreate@3.0.3 │ │ └── lodash._isiterateecall@3.0.9 ├── lodash@4.17.10 │ │ └── lodash@4.17.10

askmike commented 6 years ago

So the main Gekko project (not Gekko Broker which is located in the exchange folder) relies on lodash version 2. Not version 4. For some reason NPM is installing version 4.

I am not sure why npm is installing the wrong version for you, the only things I can recommend are:

2018-07-23 14:38 GMT+08:00 Eivlys notifications@github.com:

@askmike https://github.com/askmike │ ├── lodash@4.17.4 │ └── lodash@4.17.10 │ └── lodash@4.17.10 │ ├── lodash@4.17.10 │ │ └── lodash@3.10.1 │ │ ├── lodash.assignin@4.2.0 │ │ ├── lodash.bind@4.2.1 │ │ ├── lodash.defaults@4.2.0 │ │ ├── lodash.filter@4.6.0 │ │ ├── lodash.flatten@4.4.0 │ │ ├── lodash.foreach@4.5.0 │ │ ├── lodash.map@4.6.0 │ │ ├── lodash.merge@4.6.1 │ │ ├── lodash.pick@4.4.0 │ │ ├── lodash.reduce@4.6.0 │ │ ├── lodash.reject@4.6.0 │ │ └── lodash.some@4.6.0 │ ├─┬ lodash.create@3.1.1 │ │ ├─┬ lodash._baseassign@3.2.0 │ │ │ ├── lodash._basecopy@3.0.1 │ │ │ └─┬ lodash.keys@3.1.2 │ │ │ ├── lodash._getnative@3.9.1 │ │ │ ├── lodash.isarguments@3.1.0 │ │ │ └── lodash.isarray@3.0.4 │ │ ├── lodash._basecreate@3.0.3 │ │ └── lodash._isiterateecall@3.0.9 ├── lodash@4.17.10 │ │ └── lodash@4.17.10

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/askmike/gekko/issues/2348#issuecomment-406955138, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7MDyfB7AbNQGcQGIzgUcR0xCkw6ZUiks5uJW9zgaJpZM4VZ647 .

-- PGP key at keybase.io/mikevanrossum https://keybase.io/mikevanrossum/key.asc

mdcaddic commented 6 years ago

@askmike. I tried initially doing the update and had the problem.
(I was on 0.6.2 develop and it was working fine. Tried to update via a git pull and it complained about the package.lock file which I deleted and then did the git pull and npm install, seemed normal).

Restart and then the watcher crashes everytime I try to start a new live gecko.

While fault finding, I deleted the original gekko folder, git cloned the develop branch and then installed and still had the problem. I was thinking its somewhere outside of the gecko installation folder but it one of the dependences however now I'm not so sure. npm -v = 6.2.0 node -v = v8.11.3

I also have an instance of 5.1.3 on the same server and it is able to import from binance without any issues.

Any ideas where I should start looking?

Eivlys commented 6 years ago

@askmike totally have no idea why the version got changed, so I change it back to 2.4.2 in package.json then reinstall lodash and it worked! Thanks a lot !