Cannot read property 'amount' of undefined
I just tried your app for the first time just to have a feel on how it works.
When I tried to run using $ node gekko, this error showed:
2016-06-23 15:14:01 (INFO): We have new trading advice!
2016-06-23 15:14:01 (INFO): Position: long
2016-06-23 15:14:01 (INFO): Market price: 590.2
2016-06-23 15:14:01 (INFO): Based on market time: 2016-06-23 07:10:00
/Users/jhnferraris/Projects/NodeProjects/btc-gekko/jhnferraris/gekko/core/portfolioManager.js:109
return this.getFund(fund).amount;
^
TypeError: Cannot read property 'amount' of undefined
at Manager.getBalance (/Users/jhnferraris/Projects/NodeProjects/btc-gekko/jhnferraris/gekko/core/portfolioManager.js:109:28)
at bound [as getBalance] (/Users/jhnferraris/Projects/NodeProjects/btc-gekko/jhnferraris/gekko/node_modules/lodash/dist/lodash.js:729:21)
at act (/Users/jhnferraris/Projects/NodeProjects/btc-gekko/jhnferraris/gekko/core/portfolioManager.js:137:23)
at bound (/Users/jhnferraris/Projects/NodeProjects/btc-gekko/jhnferraris/gekko/node_modules/lodash/dist/lodash.js:729:21)
at /Users/jhnferraris/Projects/NodeProjects/btc-gekko/jhnferraris/gekko/node_modules/async/lib/async.js:232:13
at /Users/jhnferraris/Projects/NodeProjects/btc-gekko/jhnferraris/gekko/node_modules/async/lib/async.js:142:25
at /Users/jhnferraris/Projects/NodeProjects/btc-gekko/jhnferraris/gekko/node_modules/async/lib/async.js:229:17
at /Users/jhnferraris/Projects/NodeProjects/btc-gekko/jhnferraris/gekko/node_modules/async/lib/async.js:556:34
at null.<anonymous> (/Users/jhnferraris/Projects/NodeProjects/btc-gekko/jhnferraris/gekko/core/portfolioManager.js:75:7)
at /Users/jhnferraris/Projects/NodeProjects/btc-gekko/jhnferraris/gekko/exchanges/bitfinex.js:60:5
The config is this:
config.watch = {
exchange: 'bitfinex', // see gekko/docs/supported_exchanges.md
currency: 'USD',
asset: 'BTC'
}
config.tradingAdvisor = {
enabled: true,
method: 'DEMA',
candleSize: 5,
adapter: 'sqlite',
historySize: 20,
talib: {
enabled: false,
version: '1.0.2'
}
}
config.trader = {
enabled: true,
key: 'My API Key',
secret: 'My API Secret',
username: '' // your username, only required for specific exchanges.
}
config.adviceLogger = {
enabled: true
}
config['I understand that Gekko only automates MY OWN trading strategies'] = true;
Is portfolioManager.js requires sqlite in the machine to access the data amount? Or maybe this is because my bitfinex account has no money?
Hi John! I was working on the bitfinex module and I had a similar issue. There should be atleast .015 btc available in your bfx exchange wallet. 0.01 btc is a minimum trade and there are fees per trade. Also, you may need to wait at least 10mins for the api keys to get validated.
I suggest you run in simulation mode or send some btc to your exchange wallet. Ill look into a test to prevent that errror dump.
Hey xhad! So my account assumption was correct. Thanks! Should I close this or this will be the basis of your fix?
Also, several node modules may not be referenced properly.
As a fix, you could try installing the node modules listed unavailable in the dump:
npm install async, lodash...
Ill test this out and get back to you.
@xhad good to see you are on it already. So this error is caused when there are no funds available? Maybe we should catch this instead of crashing?
This is a strange issue. It's not related to having funds available. The callback is giving an error code 'ETIMEDOUT' sometimes, but most of the it works fine. I'm not sure what's causing this error. It comes from calling #L65
Mike, please advise if you have time. Thanks. ><
@jhnferraris I reverted back to old but working bitfinex code until this is fixed.
Please run:
git pull
npm install
And try again!