Separating this from the other issue.
Re: http://gekkowarez.com/gekko-genetic-algorithm/
Hey @thegamecat - thanks for sharing this :)
I'm getting an error at this step though:
[gekko]$ node run-ga-parallel.js
/home/gekko/run-ga-parallel.js:206
"data": {
^^^^^^
SyntaxError: Unexpected string
at createScript (vm.js:74:10)
at Object.runInThisContext (vm.js:116:10)
at Module._compile (module.js:537:28)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Function.Module.runMain (module.js:609:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:598:3
Any ideas?
Do I really have to long in, to download this?
Can someone give me a link?
Edit: never mind i logged in
@imkane I said this in the other thread as well, but just add the comment closure tag to wrap the specified date range option.
@mnoseworthy Thanks! Good catch.
Now I'm getting errors from my terminal1 that's running the server:
<-- POST /api/backtest
2017-09-09 12:23:44 (INFO): Setting up Gekko in backtest mode
2017-09-09 12:23:44 (INFO):
2017-09-09 12:23:44 (INFO): Setting up:
2017-09-09 12:23:44 (INFO): Trading Advisor
2017-09-09 12:23:44 (INFO): Calculate trading advice
xxx POST /api/backtest 500 413ms -
Error: non-error thrown: Child process has died.
at Object.onerror (/home/gekko/node_modules/koa/lib/context.js:105:40)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
Has anyone seen this before?
@imkane This is due to your trading method being configured improperly, post your gekkoConfig object
Ok, I think I'm slowly getting it lol
In config.js:
// RSI settings:
config.RSI = {
interval: 8,
thresholds: {
low: 29,
high: 68,
// How many candle intervals should a trend persist
// before we consider it real?
persistence: 1
}
};
In run-ga-parallel.js:
"gekkoConfig": {
"watch": {
"exchange": "gdax",
"currency": "BTC",
"asset": "LTC"
},
"paperTrader": {
"fee": 0.25,
"slippage": 0.05,
"feeTaker": 0.25,
"feeUsing": "maker",
"simulationBalance": {
"asset": 1,
"currency": 100
},
"reportRoundtrips": true,
"enabled": true
},
"writer": {
"enabled": false,
"logpath": ""
},
"tradingAdvisor": {
"enabled": true,
"method": "RSI",
"candleSize": data.candleSize,
// "candleSize": 1,
"historySize": 10,
talib: {
enabled: false,
version: '1.0.2'
}
},
//this is just the same as your usual setup in config.js
"add your strategy here, it's the same name you use in config.js": {
"parameters": {
"interval": 8,
"thresholds": {
//here we reference the indicator range outputs into the config
"low": data.rsilong,
"high": data.rsishort,
"persistence": 1
}
},
},
"backtest": {
//use scan or a daterange by commenting / uncommenting out
//"daterange": "scan",
"daterange": {
"from": "2017-07-01 00:00:00",
"to": "2017-08-01 00:00:00"
}
},
"performanceAnalyzer": {
"riskFreeReturn": 5,
"enabled": true
},
"valid": true
},
"data": {
"candleProps": ["close", "start"],
"indicatorResults": true,
"report": true,
"roundtrips": true,
"trades": true
}
New error:
2017-09-09 12:35:18 (INFO): Using the strategy: RSI
/home/gekko/strategies/indicators/RSI.js:6
this.weight = settings.interval;
^
TypeError: Cannot read property 'interval' of undefined
at new Indicator (/home/gekko/strategies/indicators/RSI.js:6:25)
at Base.addIndicator (/home/gekko/plugins/tradingAdvisor/baseTradingMethod.js:290:27)
at Base.bound [as addIndicator] (/home/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Base.method.init (/home/gekko/strategies/RSI.js:34:8)
at Base.bound [as init] (/home/gekko/node_modules/lodash/dist/lodash.js:729:21)
at new Base (/home/gekko/plugins/tradingAdvisor/baseTradingMethod.js:117:8)
at Actor.setupTradingMethod (/home/gekko/plugins/tradingAdvisor/tradingAdvisor.js:58:17)
at Actor.bound [as setupTradingMethod] (/home/gekko/node_modules/lodash/dist/lodash.js:729:21)
at new Actor (/home/gekko/plugins/tradingAdvisor/tradingAdvisor.js:23:8)
at load (/home/gekko/core/pluginUtil.js:95:22)
xxx POST /api/backtest 500 543ms -
Error: non-error thrown: Child process has died.
at Object.onerror (/home/gekko/node_modules/koa/lib/context.js:105:40)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
"add your strategy here, it's the same name you use in config.js": {
"parameters": {
put your strat name in the first bit:
"add your strategy here, it's the same name you use in config.js": {
Then delete the parameters line and the corresponding closure.
For example:
"divergeance": {
"logging": false,
"interval": 25,
"historylength": data.historylength,
"candleintervallong": data.candleintervallong,
"candleintervalshort": data.candleintervalshort,
"pricelldiff": data.pricelldiff,
"pricehhdiff": data.pricehhdiff
},
@thegamecat I can't get profit outputs, I've tracked it down to asset getting set as NaN in the performance Analyzer instance, which was probably bled through other plugin's as well. Any idea why this would occur?
Edit:
This only seems to happen when I use a DASH pairing
Edit 2:
Nevermind, It seems to not occur the first time running a specific pair, but any tests after the first it occurs
It maybe you need to start with both currency and asset having values, neither can be 0 (I think...)
@thegamecat
I have the defaults left for that, { ... asset : 1, currency: 100 ...}
Oh god I have no idea then. Maybe worth chucking up some code.
@thegamecat
Very odd, on the first run of a pair, the asset is set correctly and therefore the profit calculations work. However, as soon as a trade is made, the asset becomes NaN, and currency 0. This occurs even if i reset the server. Then, the second time the script is ran, no profits are calculated.
Values in performanceAnalyzer:
On init:
{ asset: 1, currency: 100, balance: 428.11 }
After first position open:
{ asset: NaN, currency: 0, balance: 428.11 }
Which on positon close changes to:
{ asset: 0, currency: NaN, balance: 428.11 }
Here's my config:
let outconfig = {
"gekkoConfig": {
"watch": {
"exchange": "gdax",
"currency": "USD",
"asset": "ETH"
},
"paperTrader": {
"fee": 0.25,
"slippage": 0.05,
"feeTaker": 0.25,
"feeUsing": "maker",
"reportInCurrency": true,
"simulationBalance": {
"asset": 1,
"currency": 100
},
"reportRoundtrips": true,
"enabled": true
},
"writer": {
"enabled": false,
"logpath": ""
},
"tradingAdvisor": {
"enabled": true,
"method": "RSI",
"candleSize": data.candleSize,
// "candleSize": 1,
"historySize": 10,
talib: {
enabled: false,
version: '1.0.2'
}
},
'MACD' : {
'short': data.rsishort,
'long': data.rsilong,
'signal': 9,
// the difference between the EMAs (to act as triggers)
'thresholds': {
'down': -0.025,
'up': 0.025,
// How many candle intervals should a trend persist
// before we consider it real?
'persistence': 1
}
},
'RSI' : {
interval: 14,
thresholds: {
low: data.rsilow,
high: data.rsihigh,
// How many candle intervals should a trend persist
// before we consider it real?
persistence: 1
}
},
"backtest": {
//use scan or a daterange by commenting / uncommenting out
//"daterange": "scan",
"daterange": {
"from": " 2017-09-07 04:00",
"to": " 2017-09-07 19:00"
},
"bactchSize" : 50
},
"performanceAnalyzer": {
"riskFreeReturn": 5,
"enabled": true
},
"valid": true
},
"data": {
"candleProps": ["close", "start"],
"indicatorResults": true,
"report": true,
"roundtrips": true,
"trades": true
}
};
Here's a print-out of the first iteration (calculates profit correctly):
{ trades: [],
candles:
[ { close: 329.92, start: '2017-09-07T04:00:00.000Z' },
{ close: 324.4, start: '2017-09-07T06:00:00.000Z' },
{ close: 330, start: '2017-09-07T08:00:00.000Z' },
{ close: 331.75, start: '2017-09-07T10:00:00.000Z' },
{ close: 335.87, start: '2017-09-07T12:00:00.000Z' },
{ close: 336.8, start: '2017-09-07T14:00:00.000Z' },
{ close: 333.44, start: '2017-09-07T16:00:00.000Z' } ],
report:
{ currency: 'USD',
asset: 'ETH',
startTime: '2017-09-07 04:00:00',
endTime: '2017-09-07 19:00:00',
timespan: '15 hours',
market: 1.7341745146444794,
balance: 433.8,
profit: 5.689999999999998,
relativeProfit: 1.3290976618158794,
yearlyProfit: '3322.96000000',
relativeYearlyProfit: '776.19303450',
startPrice: 328.11,
endPrice: 333.8,
trades: 0,
startBalance: 428.11,
sharpe: 0,
alpha: 3.9558254853555184 },
roundtrips: [] }
{ trades: [],
candles:
[ { close: 329.92, start: '2017-09-07T04:00:00.000Z' },
{ close: 324.4, start: '2017-09-07T06:00:00.000Z' },
{ close: 330, start: '2017-09-07T08:00:00.000Z' },
{ close: 331.75, start: '2017-09-07T10:00:00.000Z' },
{ close: 335.87, start: '2017-09-07T12:00:00.000Z' },
{ close: 336.8, start: '2017-09-07T14:00:00.000Z' },
{ close: 333.44, start: '2017-09-07T16:00:00.000Z' } ],
report:
{ currency: 'USD',
asset: 'ETH',
startTime: '2017-09-07 04:00:00',
endTime: '2017-09-07 19:00:00',
timespan: '15 hours',
market: 1.7341745146444794,
balance: 433.8,
profit: 5.689999999999998,
relativeProfit: 1.3290976618158794,
yearlyProfit: '3322.96000000',
relativeYearlyProfit: '776.19303450',
startPrice: 328.11,
endPrice: 333.8,
trades: 0,
startBalance: 428.11,
sharpe: 0,
alpha: 3.9558254853555184 },
roundtrips: [] }
{ trades:
[ { action: 'buy',
price: 328.96,
portfolio: [Object],
balance: null,
date: '2017-09-07T06:15:00.000Z' } ],
candles:
[ { close: 327.23, start: '2017-09-07T04:00:00.000Z' },
{ close: 326.7, start: '2017-09-07T04:15:00.000Z' },
{ close: 327.49, start: '2017-09-07T04:30:00.000Z' },
{ close: 327.98, start: '2017-09-07T04:45:00.000Z' },
{ close: 329.52, start: '2017-09-07T05:00:00.000Z' },
{ close: 329.24, start: '2017-09-07T05:15:00.000Z' },
{ close: 329.84, start: '2017-09-07T05:30:00.000Z' },
{ close: 329.92, start: '2017-09-07T05:45:00.000Z' },
{ close: 327.9, start: '2017-09-07T06:00:00.000Z' },
{ close: 328.96, start: '2017-09-07T06:15:00.000Z' },
{ close: 327.16, start: '2017-09-07T06:30:00.000Z' },
{ close: 327.16, start: '2017-09-07T06:45:00.000Z' },
{ close: 325.91, start: '2017-09-07T07:00:00.000Z' },
{ close: 325.2, start: '2017-09-07T07:15:00.000Z' },
{ close: 325.27, start: '2017-09-07T07:30:00.000Z' },
{ close: 324.4, start: '2017-09-07T07:45:00.000Z' },
{ close: 324.11, start: '2017-09-07T08:00:00.000Z' },
{ close: 324.52, start: '2017-09-07T08:15:00.000Z' },
{ close: 324.59, start: '2017-09-07T08:30:00.000Z' },
{ close: 326.83, start: '2017-09-07T08:45:00.000Z' },
{ close: 326.5, start: '2017-09-07T09:00:00.000Z' },
{ close: 328.72, start: '2017-09-07T09:15:00.000Z' },
{ close: 330, start: '2017-09-07T09:30:00.000Z' },
{ close: 330, start: '2017-09-07T09:45:00.000Z' },
{ close: 330.76, start: '2017-09-07T10:00:00.000Z' },
{ close: 329.46, start: '2017-09-07T10:15:00.000Z' },
{ close: 328.84, start: '2017-09-07T10:30:00.000Z' },
{ close: 329.55, start: '2017-09-07T10:45:00.000Z' },
{ close: 329.33, start: '2017-09-07T11:00:00.000Z' },
{ close: 332.42, start: '2017-09-07T11:15:00.000Z' },
{ close: 330.51, start: '2017-09-07T11:30:00.000Z' },
{ close: 331.75, start: '2017-09-07T11:45:00.000Z' },
{ close: 331.72, start: '2017-09-07T12:00:00.000Z' },
{ close: 330.92, start: '2017-09-07T12:15:00.000Z' },
{ close: 331.4, start: '2017-09-07T12:30:00.000Z' },
{ close: 334.99, start: '2017-09-07T12:45:00.000Z' },
{ close: 334.96, start: '2017-09-07T13:00:00.000Z' },
{ close: 335.02, start: '2017-09-07T13:15:00.000Z' },
{ close: 334.91, start: '2017-09-07T13:30:00.000Z' },
{ close: 335.87, start: '2017-09-07T13:45:00.000Z' },
{ close: 335.57, start: '2017-09-07T14:00:00.000Z' },
{ close: 334.77, start: '2017-09-07T14:15:00.000Z' },
{ close: 335.98, start: '2017-09-07T14:30:00.000Z' },
{ close: 335.4, start: '2017-09-07T14:45:00.000Z' },
{ close: 335.5, start: '2017-09-07T15:00:00.000Z' },
{ close: 335.99, start: '2017-09-07T15:15:00.000Z' },
{ close: 337.4, start: '2017-09-07T15:30:00.000Z' },
{ close: 336.8, start: '2017-09-07T15:45:00.000Z' },
{ close: 338.31, start: '2017-09-07T16:00:00.000Z' },
{ close: 337.43, start: '2017-09-07T16:15:00.000Z' },
{ close: 337.34, start: '2017-09-07T16:30:00.000Z' },
{ close: 335.51, start: '2017-09-07T16:45:00.000Z' },
{ close: 333.1, start: '2017-09-07T17:00:00.000Z' },
{ close: 333.19, start: '2017-09-07T17:15:00.000Z' },
{ close: 333.34, start: '2017-09-07T17:30:00.000Z' },
{ close: 333.44, start: '2017-09-07T17:45:00.000Z' },
{ close: 333.71, start: '2017-09-07T18:00:00.000Z' },
{ close: 333.54, start: '2017-09-07T18:15:00.000Z' },
{ close: 333.14, start: '2017-09-07T18:30:00.000Z' },
{ close: 333.8, start: '2017-09-07T18:45:00.000Z' } ],
report:
{ currency: 'USD',
asset: 'ETH',
startTime: '2017-09-07 04:00:00',
endTime: '2017-09-07 19:00:00',
timespan: '15 hours',
market: 1.7341745146444794,
balance: null,
profit: null,
relativeProfit: null,
yearlyProfit: 'NaN',
relativeYearlyProfit: 'NaN',
startPrice: 328.11,
endPrice: 333.8,
trades: 1,
startBalance: 428.11,
sharpe: 0,
alpha: null },
roundtrips: [] }
--------------------------------------------------------------
Epoch number: 50
Time it took (seconds): 1.152
Max profit: 5.689999999999998$ max profit position: 0
Max parametars:
{ rsihigh: 73, rsilow: 17, candleSize: 120 }
Other metrics:
{ balance: 433.8,
profit: 5.689999999999998,
relativeProfit: 1.3290976618158794,
yearlyProfit: '3322.96000000',
relativeYearlyProfit: '776.19303450',
startPrice: 328.11,
endPrice: 333.8,
trades: 0 }
--------------------------------------------------------------
Global maximum: 5.689999999999998$, parameters:
{ rsihigh: 73, rsilow: 17, candleSize: 120 }
Other metrics of global maximum:
Global maximum so far:
{ balance: 433.8,
profit: 5.689999999999998,
relativeProfit: 1.3290976618158794,
yearlyProfit: '3322.96000000',
relativeYearlyProfit: '776.19303450',
startPrice: 328.11,
endPrice: 333.8,
trades: 0 }
--------------------------------------------------------------
`
and here's an output on a second script run, where it doesn't:
`
{ trades:
[ { action: 'buy',
price: 326.83,
portfolio: [Object],
balance: null,
date: '2017-09-07T08:30:00.000Z' } ],
candles:
[ { close: 326.7, start: '2017-09-07T04:00:00.000Z' },
{ close: 327.98, start: '2017-09-07T04:30:00.000Z' },
{ close: 329.24, start: '2017-09-07T05:00:00.000Z' },
{ close: 329.92, start: '2017-09-07T05:30:00.000Z' },
{ close: 328.96, start: '2017-09-07T06:00:00.000Z' },
{ close: 327.16, start: '2017-09-07T06:30:00.000Z' },
{ close: 325.2, start: '2017-09-07T07:00:00.000Z' },
{ close: 324.4, start: '2017-09-07T07:30:00.000Z' },
{ close: 324.52, start: '2017-09-07T08:00:00.000Z' },
{ close: 326.83, start: '2017-09-07T08:30:00.000Z' },
{ close: 328.72, start: '2017-09-07T09:00:00.000Z' },
{ close: 330, start: '2017-09-07T09:30:00.000Z' },
{ close: 329.46, start: '2017-09-07T10:00:00.000Z' },
{ close: 329.55, start: '2017-09-07T10:30:00.000Z' },
{ close: 332.42, start: '2017-09-07T11:00:00.000Z' },
{ close: 331.75, start: '2017-09-07T11:30:00.000Z' },
{ close: 330.92, start: '2017-09-07T12:00:00.000Z' },
{ close: 334.99, start: '2017-09-07T12:30:00.000Z' },
{ close: 335.02, start: '2017-09-07T13:00:00.000Z' },
{ close: 335.87, start: '2017-09-07T13:30:00.000Z' },
{ close: 334.77, start: '2017-09-07T14:00:00.000Z' },
{ close: 335.4, start: '2017-09-07T14:30:00.000Z' },
{ close: 335.99, start: '2017-09-07T15:00:00.000Z' },
{ close: 336.8, start: '2017-09-07T15:30:00.000Z' },
{ close: 337.43, start: '2017-09-07T16:00:00.000Z' },
{ close: 335.51, start: '2017-09-07T16:30:00.000Z' },
{ close: 333.19, start: '2017-09-07T17:00:00.000Z' },
{ close: 333.44, start: '2017-09-07T17:30:00.000Z' },
{ close: 333.54, start: '2017-09-07T18:00:00.000Z' },
{ close: 333.8, start: '2017-09-07T18:30:00.000Z' } ],
report:
{ currency: 'USD',
asset: 'ETH',
startTime: '2017-09-07 04:00:00',
endTime: '2017-09-07 19:00:00',
timespan: '15 hours',
market: 1.7341745146444794,
balance: null,
profit: null,
relativeProfit: null,
yearlyProfit: 'NaN',
relativeYearlyProfit: 'NaN',
startPrice: 328.11,
endPrice: 333.8,
trades: 1,
startBalance: 428.11,
sharpe: 0,
alpha: null },
roundtrips: [] }
{ trades:
[ { action: 'buy',
price: 326.83,
portfolio: [Object],
balance: null,
date: '2017-09-07T08:30:00.000Z' } ],
candles:
[ { close: 326.7, start: '2017-09-07T04:00:00.000Z' },
{ close: 327.98, start: '2017-09-07T04:30:00.000Z' },
{ close: 329.24, start: '2017-09-07T05:00:00.000Z' },
{ close: 329.92, start: '2017-09-07T05:30:00.000Z' },
{ close: 328.96, start: '2017-09-07T06:00:00.000Z' },
{ close: 327.16, start: '2017-09-07T06:30:00.000Z' },
{ close: 325.2, start: '2017-09-07T07:00:00.000Z' },
{ close: 324.4, start: '2017-09-07T07:30:00.000Z' },
{ close: 324.52, start: '2017-09-07T08:00:00.000Z' },
{ close: 326.83, start: '2017-09-07T08:30:00.000Z' },
{ close: 328.72, start: '2017-09-07T09:00:00.000Z' },
{ close: 330, start: '2017-09-07T09:30:00.000Z' },
{ close: 329.46, start: '2017-09-07T10:00:00.000Z' },
{ close: 329.55, start: '2017-09-07T10:30:00.000Z' },
{ close: 332.42, start: '2017-09-07T11:00:00.000Z' },
{ close: 331.75, start: '2017-09-07T11:30:00.000Z' },
{ close: 330.92, start: '2017-09-07T12:00:00.000Z' },
{ close: 334.99, start: '2017-09-07T12:30:00.000Z' },
{ close: 335.02, start: '2017-09-07T13:00:00.000Z' },
{ close: 335.87, start: '2017-09-07T13:30:00.000Z' },
{ close: 334.77, start: '2017-09-07T14:00:00.000Z' },
{ close: 335.4, start: '2017-09-07T14:30:00.000Z' },
{ close: 335.99, start: '2017-09-07T15:00:00.000Z' },
{ close: 336.8, start: '2017-09-07T15:30:00.000Z' },
{ close: 337.43, start: '2017-09-07T16:00:00.000Z' },
{ close: 335.51, start: '2017-09-07T16:30:00.000Z' },
{ close: 333.19, start: '2017-09-07T17:00:00.000Z' },
{ close: 333.44, start: '2017-09-07T17:30:00.000Z' },
{ close: 333.54, start: '2017-09-07T18:00:00.000Z' },
{ close: 333.8, start: '2017-09-07T18:30:00.000Z' } ],
report:
{ currency: 'USD',
asset: 'ETH',
startTime: '2017-09-07 04:00:00',
endTime: '2017-09-07 19:00:00',
timespan: '15 hours',
market: 1.7341745146444794,
balance: null,
profit: null,
relativeProfit: null,
yearlyProfit: 'NaN',
relativeYearlyProfit: 'NaN',
startPrice: 328.11,
endPrice: 333.8,
trades: 1,
startBalance: 428.11,
sharpe: 0,
alpha: null },
roundtrips: [] }
--------------------------------------------------------------
Epoch number: 1
Time it took (seconds): 0.954
Max profit: 0$ max profit position: 0
Max parametars:
{ rsihigh: 74, rsilow: 33, candleSize: 30 }
Other metrics:
{ balance: 0,
profit: 0,
relativeProfit: 0,
yearlyProfit: 0,
relativeYearlyProfit: 0,
startPrice: 328.11,
endPrice: 333.8,
trades: 1 }
--------------------------------------------------------------
Global maximum: 0$, parameters:
{ rsihigh: 74, rsilow: 33, candleSize: 30 }
Other metrics of global maximum:
Global maximum so far:
{ balance: 0,
profit: 0,
relativeProfit: 0,
yearlyProfit: 0,
relativeYearlyProfit: 0,
startPrice: 328.11,
endPrice: 333.8,
trades: 1 }
--------------------------------------------------------------
{ trades:
[ { action: 'buy',
price: 326.83,
portfolio: [Object],
balance: null,
date: '2017-09-07T08:30:00.000Z' } ],
candles:
[ { close: 326.7, start: '2017-09-07T04:00:00.000Z' },
{ close: 327.98, start: '2017-09-07T04:30:00.000Z' },
{ close: 329.24, start: '2017-09-07T05:00:00.000Z' },
{ close: 329.92, start: '2017-09-07T05:30:00.000Z' },
{ close: 328.96, start: '2017-09-07T06:00:00.000Z' },
{ close: 327.16, start: '2017-09-07T06:30:00.000Z' },
{ close: 325.2, start: '2017-09-07T07:00:00.000Z' },
{ close: 324.4, start: '2017-09-07T07:30:00.000Z' },
{ close: 324.52, start: '2017-09-07T08:00:00.000Z' },
{ close: 326.83, start: '2017-09-07T08:30:00.000Z' },
{ close: 328.72, start: '2017-09-07T09:00:00.000Z' },
{ close: 330, start: '2017-09-07T09:30:00.000Z' },
{ close: 329.46, start: '2017-09-07T10:00:00.000Z' },
{ close: 329.55, start: '2017-09-07T10:30:00.000Z' },
{ close: 332.42, start: '2017-09-07T11:00:00.000Z' },
{ close: 331.75, start: '2017-09-07T11:30:00.000Z' },
{ close: 330.92, start: '2017-09-07T12:00:00.000Z' },
{ close: 334.99, start: '2017-09-07T12:30:00.000Z' },
{ close: 335.02, start: '2017-09-07T13:00:00.000Z' },
{ close: 335.87, start: '2017-09-07T13:30:00.000Z' },
{ close: 334.77, start: '2017-09-07T14:00:00.000Z' },
{ close: 335.4, start: '2017-09-07T14:30:00.000Z' },
{ close: 335.99, start: '2017-09-07T15:00:00.000Z' },
{ close: 336.8, start: '2017-09-07T15:30:00.000Z' },
{ close: 337.43, start: '2017-09-07T16:00:00.000Z' },
{ close: 335.51, start: '2017-09-07T16:30:00.000Z' },
{ close: 333.19, start: '2017-09-07T17:00:00.000Z' },
{ close: 333.44, start: '2017-09-07T17:30:00.000Z' },
{ close: 333.54, start: '2017-09-07T18:00:00.000Z' },
{ close: 333.8, start: '2017-09-07T18:30:00.000Z' } ],
report:
{ currency: 'USD',
asset: 'ETH',
startTime: '2017-09-07 04:00:00',
endTime: '2017-09-07 19:00:00',
timespan: '15 hours',
market: 1.7341745146444794,
balance: null,
profit: null,
relativeProfit: null,
yearlyProfit: 'NaN',
relativeYearlyProfit: 'NaN',
startPrice: 328.11,
endPrice: 333.8,
trades: 1,
startBalance: 428.11,
sharpe: 0,
alpha: null },
roundtrips: [] }
{ trades: [],
candles:
[ { close: 329.92, start: '2017-09-07T04:00:00.000Z' },
{ close: 324.4, start: '2017-09-07T06:00:00.000Z' },
{ close: 330, start: '2017-09-07T08:00:00.000Z' },
{ close: 331.75, start: '2017-09-07T10:00:00.000Z' },
{ close: 335.87, start: '2017-09-07T12:00:00.000Z' },
{ close: 336.8, start: '2017-09-07T14:00:00.000Z' },
{ close: 333.44, start: '2017-09-07T16:00:00.000Z' } ],
report:
{ currency: 'USD',
asset: 'ETH',
startTime: '2017-09-07 04:00:00',
endTime: '2017-09-07 19:00:00',
timespan: '15 hours',
market: 1.7341745146444794,
balance: 433.8,
profit: 5.689999999999998,
relativeProfit: 1.3290976618158794,
yearlyProfit: '3322.96000000',
relativeYearlyProfit: '776.19303450',
startPrice: 328.11,
endPrice: 333.8,
trades: 0,
startBalance: 428.11,
sharpe: 0,
alpha: 3.9558254853555184 },
roundtrips: [] }
{ trades:
[ { action: 'buy',
price: 326.83,
portfolio: [Object],
balance: null,
date: '2017-09-07T08:30:00.000Z' } ],
candles:
[ { close: 326.7, start: '2017-09-07T04:00:00.000Z' },
{ close: 327.98, start: '2017-09-07T04:30:00.000Z' },
{ close: 329.24, start: '2017-09-07T05:00:00.000Z' },
{ close: 329.92, start: '2017-09-07T05:30:00.000Z' },
{ close: 328.96, start: '2017-09-07T06:00:00.000Z' },
{ close: 327.16, start: '2017-09-07T06:30:00.000Z' },
{ close: 325.2, start: '2017-09-07T07:00:00.000Z' },
{ close: 324.4, start: '2017-09-07T07:30:00.000Z' },
{ close: 324.52, start: '2017-09-07T08:00:00.000Z' },
{ close: 326.83, start: '2017-09-07T08:30:00.000Z' },
{ close: 328.72, start: '2017-09-07T09:00:00.000Z' },
{ close: 330, start: '2017-09-07T09:30:00.000Z' },
{ close: 329.46, start: '2017-09-07T10:00:00.000Z' },
{ close: 329.55, start: '2017-09-07T10:30:00.000Z' },
{ close: 332.42, start: '2017-09-07T11:00:00.000Z' },
{ close: 331.75, start: '2017-09-07T11:30:00.000Z' },
{ close: 330.92, start: '2017-09-07T12:00:00.000Z' },
{ close: 334.99, start: '2017-09-07T12:30:00.000Z' },
{ close: 335.02, start: '2017-09-07T13:00:00.000Z' },
{ close: 335.87, start: '2017-09-07T13:30:00.000Z' },
{ close: 334.77, start: '2017-09-07T14:00:00.000Z' },
{ close: 335.4, start: '2017-09-07T14:30:00.000Z' },
{ close: 335.99, start: '2017-09-07T15:00:00.000Z' },
{ close: 336.8, start: '2017-09-07T15:30:00.000Z' },
{ close: 337.43, start: '2017-09-07T16:00:00.000Z' },
{ close: 335.51, start: '2017-09-07T16:30:00.000Z' },
{ close: 333.19, start: '2017-09-07T17:00:00.000Z' },
{ close: 333.44, start: '2017-09-07T17:30:00.000Z' },
{ close: 333.54, start: '2017-09-07T18:00:00.000Z' },
{ close: 333.8, start: '2017-09-07T18:30:00.000Z' } ],
report:
{ currency: 'USD',
asset: 'ETH',
startTime: '2017-09-07 04:00:00',
endTime: '2017-09-07 19:00:00',
timespan: '15 hours',
market: 1.7341745146444794,
balance: null,
profit: null,
relativeProfit: null,
yearlyProfit: 'NaN',
relativeYearlyProfit: 'NaN',
startPrice: 328.11,
endPrice: 333.8,
trades: 1,
startBalance: 428.11,
sharpe: 0,
alpha: null },
roundtrips: [] }
--------------------------------------------------------------
Epoch number: 2
Time it took (seconds): 1.108
Max profit: 0$ max profit position: 0
Max parametars:
{ rsihigh: 89, rsilow: 33, candleSize: 30 }
Other metrics:
{ balance: 0,
profit: 0,
relativeProfit: 0,
yearlyProfit: 0,
relativeYearlyProfit: 0,
startPrice: 328.11,
endPrice: 333.8,
trades: 1 }
--------------------------------------------------------------
Global maximum: 0$, parameters:
{ rsihigh: 89, rsilow: 33, candleSize: 30 }
Other metrics of global maximum:
Global maximum so far:
{ balance: 0,
profit: 0,
relativeProfit: 0,
yearlyProfit: 0,
relativeYearlyProfit: 0,
startPrice: 328.11,
endPrice: 333.8,
trades: 1 }
--------------------------------------------------------------
Ok I'm not sure from that, can you try a month ? I don't know if you'll learn much from 12 hours (I'm happy to be wrong though).
Also, maybe ensure the candle size array doesn't have large candle sizes compared to your date range - could also be partly to blame.
Edit:
I forgot to mention that the console output shows 0's for everything because I made it sub NaN or null for 0.
Sure, here's the output from running a test over a month period (With only 1hour candles):
{ trades:
[ { action: 'buy',
price: 0.09239999,
portfolio: [Object],
balance: null,
date: '2017-06-07T06:16:00.000Z' },
{ action: 'sell',
price: 0.1493028,
portfolio: [Object],
balance: null,
date: '2017-06-12T22:16:00.000Z' },
{ action: 'buy',
price: 0.12793296,
portfolio: [Object],
balance: null,
date: '2017-06-20T14:16:00.000Z' } ],
candles:
[ { close: 0.09248966, start: '2017-06-05T18:16:00.000Z' },
{ close: 0.08870465, start: '2017-06-05T22:16:00.000Z' },
{ close: 0.08980017, start: '2017-06-06T02:16:00.000Z' },
{ close: 0.08999998, start: '2017-06-06T06:16:00.000Z' },
{ close: 0.092, start: '2017-06-06T10:16:00.000Z' }
... all of the items ],
report:
{ currency: 'BTC',
asset: 'ETH',
startTime: '2017-06-05 18:16:00',
endTime: '2017-07-03 02:16:00',
timespan: 'a month',
market: 17.391316796534127,
balance: null,
profit: null,
relativeProfit: null,
yearlyProfit: 'NaN',
relativeYearlyProfit: 'NaN',
startPrice: 0.09429999,
endPrice: 0.1107,
trades: 3,
startBalance: 100.09429999,
sharpe: null,
alpha: null },
roundtrips:
[ { entryAt: '2017-06-07T06:16:00.000Z',
entryPrice: 0.09239999,
entryBalance: null,
exitAt: '2017-06-12T22:16:00.000Z',
exitPrice: 0.1464,
exitBalance: null,
duration: 489600000,
pnl: null,
profit: null } ] }
I really have no idea, not seen that before :(
@thegamecat - thanks! I'm clearly dumb when it comes to debugging or understanding comments lol
@thegamecat
I've tracked it down to an error in paperTrader.js when initalizing this.fee:
this.fee = 1 - (calcConfig['fee' + calcConfig.feeUsing.charAt(0).toUpperCase() + calcConfig.feeUsing.slice(1)] + calcConfig.slippage) / 100;
The problem is of course, that the config parameter required.. was not set. Sorry for all the confusion for my silly problem. I've only recently started looking at this codebase and didn't understand the significance of the feeUsing parameter.
Upward and onward !
P.s.
After I integrate my own strats into this, I may implement a UI for it. How would I approach contributing to this with you?
Thats brilliant thanks @mnoseworthy - I've updated the file.
Also the GA is now on github again in this repo: https://github.com/thegamecat/gekko-trading-stuff
Just contact me on the discord group - I'm .zuki! @ https://discord.gg/Ws3M2A
I let it run for awhile, then went back to look at terminal2:
Global maximum: 0$, parameters:
{ rsishort: 62, rsilong: 29, candleSize: 1440 }
Other metrics of global maximum:
Global maximum so far:
{ balance: null,
profit: null,
relativeProfit: null,
yearlyProfit: 'NaN',
relativeYearlyProfit: 'NaN',
startPrice: 0.01605,
endPrice: 0.01479,
trades: 1 }
--------------------------------------------------------------
{ Error: socket hang up
at createHangUpError (_http_client.js:345:15)
at Socket.socketOnEnd (_http_client.js:437:23)
at emitNone (events.js:110:20)
at Socket.emit (events.js:207:7)
at endReadableNT (_stream_readable.js:1059:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9) code: 'ECONNRESET' }
/home/arbitrage/gekko2/run-ga-parallel.js:229
let report = body.report;
^
TypeError: Cannot read property 'report' of undefined
at Request._callback (/home/arbitrage/gekko2/run-ga-parallel.js:229:23)
at self.callback (/home/arbitrage/gekko2/node_modules/request/request.js:188:22)
at emitOne (events.js:115:13)
at Request.emit (events.js:210:7)
at Request.onRequestError (/home/arbitrage/gekko2/node_modules/request/request.js:884:8)
at emitOne (events.js:115:13)
at ClientRequest.emit (events.js:210:7)
at Socket.socketOnEnd (_http_client.js:437:9)
at emitNone (events.js:110:20)
at Socket.emit (events.js:207:7)
What OS are you using?
is that candlesize bigger than your test period?
@imkane
I think this is due to a too short time interval for your date range
Edit:
also Change feeMaker from "maker" to "taker"
@mnoseworthy do you have discord btw?
@thegamecat I don't actually :( It's for Voice chat right?
get it :)
it's voice and text chat
@thegamecat:
CentOS 7
I'm not sure how to tell about the candlesize vs my test period. I left the same candlesize setup as your original code, and:
"daterange": {
"from": "2017-07-01 00:00:00",
"to": "2017-08-01 00:00:00"
}
@mnoseworthy Do you think 1 month is too short?
1month is fine - i usually run way more.
Maybe a dumb Q, but how do we know what B&H / market was from this output?
Global maximum: 20.55338325999999$, parameters:
21|ga2 | { rsishort: 85, rsilong: 21, candleSize: 60 }
21|ga2 | Other metrics of global maximum:
21|ga2 | Global maximum so far:
21|ga2 | { balance: 120.56943326,
21|ga2 | profit: 20.55338325999999,
21|ga2 | relativeProfit: 20.550084971362082,
21|ga2 | yearlyProfit: '241.99951258',
21|ga2 | relativeYearlyProfit: '241.96067789',
21|ga2 | startPrice: 0.01605,
21|ga2 | endPrice: 0.01479,
21|ga2 | trades: 6 }
Also, when I plug these same params into a backtest in the UI, I get COMPLETELY different results, everything from # of trades to profit (I get a loss in the UI).

I'm getting almost exactly the same error as imkane:
2017-09-10 21:56:33 (INFO): Setting up Gekko in backtest mode
2017-09-10 21:56:33 (INFO):
2017-09-10 21:56:33 (INFO): Setting up:
2017-09-10 21:56:33 (INFO): Trading Advisor
2017-09-10 21:56:33 (INFO): Calculate trading advice
xxx POST /api/backtest 500 200ms -
Error: non-error thrown: Child process has died.
at Object.onerror (/home/nils/gekko/node_modules/koa/lib/context.js:105:40)
at process._tickCallback (internal/process/next_tick.js:109:7)
altough his says next_tick.js:188:7
The strategy I have set in run-ga-parallel is:
"rsi": {
"parameters": {
"interval": 8,
"thresholds": {
//here we reference the indicator range outputs into$
"low": data.rsilong,
"high": data.rsishort,
"persistence": 1
}
},
},
Any idea what is going wrong in my instance?
@imkane can you paste the strategy you have in run-ga-parallel please?
I think this should fix it for ya :) Removed "parameters".
"rsi": {
"interval": 8,
"thresholds": {
//here we reference the indicator range outputs into$
"low": data.rsilong,
"high": data.rsishort,
"persistence": 1
}
},
Hmm, I came to the same conclusion, but even after pasting your exact strategy it's still not working...
Maybe try:
"feeUsing": "maker",
And make sure your "daterange" code has the correct # of opening/closing brackets.
Which version of Gekko are you running?
@imkane I don't know what you mean with that line, what is there to try with it?
"daterange" is set correctly though
@thegamecat I am running the latest version. Tried both on a Raspberry Pi and on a pc running Ubuntu server
there should be a feeUsing line in the configGekko section
Yes:
"paperTrader": {
"fee": 0.25,
"slippage": 0.05,
"feeTaker": 0.25,
"feeUsing": "maker",
"reportInCurrency": true,
"simulationBalance": {
"asset": 1,
"currency": 100
},
"reportRoundtrips": true,
"enabled": true
},
Do I need to edit something here? everything is left default
Hrm take out the reportIncurrency line....that might work.
Nope, commenting out or setting it false has no effect. I'm at a loss here, both Gekko and the GA are near default, I followed the steps required to get Gekko working and to get the GA working, as well as adding the right strategy in the GA. What could I have done wrong?
I figured what I did wrong. I missed the following section:
"tradingAdvisor": {
"enabled": true,
"method": "RSI",
It was still on test_method_2 or something.
However, I keep getting null and NaN results, just as @mnoseworthy was having.
ah he fixed that um, in the other thread....
Can someone paste some good strategy settings found by this algorithm, or any other that uses GA or Bayesian Optimization?
Hey @mnoseworthy and @thegamecat .
Im on gekko 0.57 stable (windows) and have also run into the issue of NaN profit reporting.
As soon as gekko executes one trade, profits become NaN.
If no trades have been executed (I just caused this by a short time range) profits report fine.
Could you walk me through how you solved this? (if at all? : ) )
Heres a simple config with some random values, but i do not think it is the issue.
//run server.js with the following command:
//node --max-old-space-size=8192 server.js
// then run this to run the GA
// node run-ga-parallel.js
const async = require('async');
const randomExt = require('random-ext');
const request = require('request');
// Creates a random gene if prop='all', creates one random property otherwise
function create_gene(prop) {
let candle_values = [5,10,15,240];
let properites = {
//here add the indicators and the ranges you want to handle
//in this case my strategy wants to test RSI ranges
demashort: randomExt.integer(30,10),
demalong: randomExt.integer(60, 20),
treshold: randomExt.float(0.01,1),
"candleSize": candle_values[randomExt.integer(3,0)],
};
// console.log(properites);
if (prop === 'all')
return properites;
else {
return properites[prop];
}
}
// Creates random population from genes
function create_population(amount) {
let population = [];
for (let i = 0; i < amount; i++) {
population.push(create_gene('all'));
}
return population;
}
// Pairs two parents returning two new childs
function crossover(a, b) {
let len = Object.keys(a).length;
let cross_point = randomExt.integer(len - 1, 1);
let tmp_a = {};
let tmp_b = {};
let curr_point = 0;
for (let i in a) {
if (a.hasOwnProperty(i) && b.hasOwnProperty(i)) {
if (curr_point < cross_point) {
tmp_a[i] = a[i];
tmp_b[i] = b[i];
}
else {
tmp_a[i] = b[i];
tmp_b[i] = a[i];
}
}
curr_point++;
}
return [tmp_a, tmp_b];
}
// Mutates object a at most maxAmount times
function mutate(a, maxAmount) {
let amt = randomExt.integer(maxAmount, 0);
let all_props = Object.keys(a);
let tmp = {};
for (let p in a) {
if (a.hasOwnProperty(p))
tmp[p] = a[p];
}
for (let i = 0; i < amt; i++) {
let position = randomExt.integer(0, a.length);
let prop = all_props[position];
tmp[prop] = create_gene(prop);
}
return tmp;
}
// For the given population and fitness, returns new population and max score
function run_epoch(population, variation, population_amt, mutate_elements, fitness_arr) {
let selection_prob = [];
let fitness_sum = 0;
let max_fitness = [0, 0];
for (let i = 0; i < population_amt; i++) {
if (fitness_arr[i] > max_fitness[0])
max_fitness = [fitness_arr[i], i];
fitness_sum += fitness_arr[i];
}
if (fitness_sum === 0) {
for (let j = 0; j < population_amt; j++) {
selection_prob[j] = 1 / population_amt;
}
}
else {
for (let j = 0; j < population_amt; j++) {
selection_prob[j] = fitness_arr[j] / fitness_sum;
}
}
let new_population = [];
while (new_population.length < population_amt * (1 - variation)) {
let a, b;
let selected_prob = randomExt.float(1, 0);
for (let k = 0; k < population_amt; k++) {
selected_prob -= selection_prob[k];
if (selected_prob <= 0) {
a = population[k];
break;
}
}
selected_prob = randomExt.float(1, 0);
for (k = 0; k < population_amt; k++) {
selected_prob -= selection_prob[k];
if (selected_prob <= 0) {
b = population[k];
break;
}
}
let res = crossover(mutate(a, mutate_elements), mutate(b, mutate_elements));
new_population.push(res[0]);
new_population.push(res[1]);
}
for (let l = 0; l < population_amt * variation; l++) {
new_population.push(create_gene('all'));
}
return [new_population, max_fitness];
}
// Calls api for every element in test_series and returns gain for each
function fitness_api(tests_series, callback) {
const number_of_parallel_queries = 8;
async.mapLimit(tests_series, number_of_parallel_queries, function (data, callback) {
let outconfig = {
"gekkoConfig": {
"watch": {
"exchange": "poloniex",
"currency": "USDT",
"asset": "BTC"
},
"paperTrader": {
"fee": 0.25,
"slippage": 0.05,
"feeTaker": 0.25,
"feeUsing": "maker",
"reportInCurrency": true,
"simulationBalance": {
"asset": 1,
"currency": 100
},
"reportRoundtrips": true,
"enabled": true
},
"writer": {
"enabled": true,
//"logpath": "logs/test"
},
"tradingAdvisor": {
"enabled": true,
"method": "DEMA",
"candleSize": data.candleSize,
// "candleSize": 1,
"historySize": 240,
talib: {
enabled: false,
version: '1.0.2'
}
},
//this is just the same as your usual setup in config.js
"DEMA":{
// EMA weight (α)
// the higher the weight, the more smooth (and delayed) the line
short: data.demashort,
long: data.demalong,
// amount of candles to remember and base initial EMAs on
// the difference between the EMAs (to act as triggers)
thresholds: {
down: -data.treshold,
up: data.treshold
}
},
"backtest": {
//use scan or a daterange by commenting / uncommenting out
/* "daterange": "scan",
*/
"daterange": {
"from": "2017-08-14 19:21",
"to": "2017-08-28 19:21"
}
},
"performanceAnalyzer": {
"riskFreeReturn": 5,
"enabled": true
},
"valid": true
},
"data": {
"candleProps": ["close", "start"],
"indicatorResults": true,
"report": true,
"roundtrips": true,
"trades": true
}
};
request.post({
url: 'http://localhost:3000/api/backtest',
json: outconfig,
headers: {
"Content-Type": "application/json"
}
},
function (err, httpResponse, body) {
if (err)
console.log(err);
// These properties will be outputted every epoch, remove property if not needed
let properties = ['balance', 'profit', 'relativeProfit', 'yearlyProfit', 'relativeYearlyProfit', 'startPrice', 'endPrice', 'trades'];
if(body===false){
}
let report = body.report;
let result = {"profit": 0, "metrics": false};
if (report) {
let picked = properties.reduce(function (o, k) {
o[k] = report[k];
return o;
}, {});
result = {"profit": body.report.profit, "metrics": picked};
}
return callback(err, result);
});
}, function (err, results) {
let profits = [];
let other_metrics = [];
for (let i in results) {
if (results.hasOwnProperty(i)) {
profits.push(results[i]["profit"]);
other_metrics.push(results[i]["metrics"])
}
}
callback(profits, other_metrics);
});
}
// ********************************************************************
// Configurable parameters
// --------------------------------------------------------------------
// How many completely new units will be added to the population
const variation = 0.3; // Population * variation must be a whole number!!
// Population size, better reduce this for larger data
const population_amt = 8;
// How many components maximum to mutate at once
const mutate_elements = 14;
// When the algorithm reaches this value it will stop,
// but you can stop it any time you wish since the last max parameters are outputted every epoch
const target_value = 5000000000;
// --------------------------------------------------------------------
let population = create_population(population_amt);
let population_fitness;
let other_population_metrics;
let epoch_number = 0;
console.log("Starting training with: " + population_amt + " units");
let start_time = new Date().getTime();
let all_time_maximum = {parameters: {}, gain: 0, epoch_number: 0, other_metrics: {}};
async.doWhilst(function (callback) {
start_time = new Date().getTime();
fitness_api(population, function (result, other_metrics) {
population_fitness = result;
other_population_metrics = other_metrics;
callback();
})
}, function () {
let end_time = new Date().getTime();
epoch_number++;
let results = run_epoch(population, variation, population_amt, mutate_elements, population_fitness);
let new_population = results[0];
let max_result = results[1];
let value = max_result[0];
let position = max_result[1];
if (value >= all_time_maximum.gain) {
all_time_maximum.parameters = population[position];
all_time_maximum.other_metrics = other_population_metrics[position];
all_time_maximum.gain = value;
all_time_maximum.epoch_number = epoch_number;
}
console.log("--------------------------------------------------------------");
console.log("Epoch number: " + epoch_number);
console.log("Time it took (seconds): " + (end_time - start_time) / 1000);
console.log("Max profit: " + value + "$" + " max profit position: " + position);
console.log("Max parametars: ");
console.log(population[position]);
console.log("Other metrics: "); // Prints other metrics, they can be turned off on line 190
console.log(other_population_metrics[position]);
// Prints out the whole population with its fitness,
// useful for finding properties that make no sense and debugging
// for (let element in population) {
// console.log("Fitness: "+population_fitness[element]+" Properties:");
// console.log(population[element])
// }
console.log("--------------------------------------------------------------");
console.log("Global maximum: " + all_time_maximum.gain + "$, parameters:");
console.log(all_time_maximum.parameters);
console.log("Other metrics of global maximum:");
console.log("Global maximum so far:");
console.log(all_time_maximum.other_metrics);
console.log("--------------------------------------------------------------");
population = new_population;
return value < target_value;
}, function () {
console.log("Finished!");
console.log("All time maximum:");
console.log(all_time_maximum)
});
@jxxxst quick question: do you also see this when using the UI?
@askmike things are fine in UI and backtesting via commandline.
Hi,
maybe you can have a look:
Global maximum: 0$, parameters:
{ rsishort: 74, rsilong: 37, candleSize: 1440 }
Other metrics of global maximum:
Global maximum so far:
Epoch number: 2
Time it took (seconds): 25.45
Max profit: 0$ max profit position: 0
Max parametars:
{ rsishort: 74, rsilong: 37, candleSize: 1440 }
Other metrics:
Global maximum: 0$, parameters:
{ rsishort: 74, rsilong: 37, candleSize: 1440 }
Other metrics of global maximum:
Global maximum so far:
Epoch number: 3
Time it took (seconds): 9.318
Max profit: 0$ max profit position: 0
Max parametars:
{ rsishort: 72, rsilong: 32, candleSize: 120 }
Other metrics:
Global maximum: 0$, parameters:
{ rsishort: 72, rsilong: 32, candleSize: 120 }
Other metrics of global maximum:
Global maximum so far:
Epoch number: 4
Time it took (seconds): 8.66
Max profit: 0$ max profit position: 0
Max parametars:
{ rsishort: 86, rsilong: 38, candleSize: 120 }
Other metrics:
Global maximum: 0$, parameters:
{ rsishort: 86, rsilong: 38, candleSize: 120 }
Other metrics of global maximum:
Global maximum so far:
Epoch number: 5
Time it took (seconds): 8.95
Max profit: 0$ max profit position: 0
Max parametars:
{ rsishort: 80, rsilong: 14, candleSize: 120 }
Other metrics:
Global maximum: 0$, parameters:
{ rsishort: 80, rsilong: 14, candleSize: 120 }
Other metrics of global maximum:
Global maximum so far:
Epoch number: 6
Time it took (seconds): 9.183
Max profit: 0$ max profit position: 0
Max parametars:
{ rsishort: 64, rsilong: 17, candleSize: 120 }
Other metrics:
Global maximum: 0$, parameters:
{ rsishort: 64, rsilong: 17, candleSize: 120 }
Other metrics of global maximum:
Global maximum so far:
Epoch number: 7
Time it took (seconds): 39.166
Max profit: 0$ max profit position: 0
Max parametars:
{ rsishort: 78, rsilong: 22, candleSize: 120 }
Other metrics:
Global maximum: 0$, parameters:
{ rsishort: 78, rsilong: 22, candleSize: 120 }
Other metrics of global maximum:
Global maximum so far:
false`
I am getting only zero values and I do not know why.
For testing purposes, I added the DEMA from above
"gekkoConfig": {
"watch": {
"exchange": "poloniex",
"currency": "USDT",
"asset": "ETH"
},
"paperTrader": {
"fee": 0.25,
"slippage": 0.05,
"feeTaker": 0.25,
"feeUsing": "maker",
"reportInCurrency": true,
"simulationBalance": {
"asset": 1,
"currency": 100
},
"reportRoundtrips": true,
"enabled": true
},
"writer": {
"enabled": false,
"logpath": ""
},
"tradingAdvisor": {
"enabled": true,
"method": "DEMA",
"candleSize": data.candleSize,
// "candleSize": 1,
"historySize": 10,
talib: {
enabled: false,
version: '1.0.2'
}
},
"DEMA":{
// EMA weight (α)
// the higher the weight, the more smooth (and delayed) the line
short: data.demashort,
long: data.demalong,
// amount of candles to remember and base initial EMAs on
// the difference between the EMAs (to act as triggers)
thresholds: {
down: -data.treshold,
up: data.treshold
}
//},
},
"backtest": {
//use scan or a daterange by commenting / uncommenting out
"daterange": "scan",
"daterange": {
"from": "2017-05-04 00:00:00",
"to": "2017-09-28 00:00:00"
}
},
@jxxxst @askmike @thegamecat The issue with the NaN and undefined values for profit is due to the use of "fee" in the paperTrade, change this to "feeMaker" and it should work.
Thanks, I'll update this.
@cmroche thanks alot, i finally got it working !
Can someone post strategies found by these GA's?
@thegamecat I'm having same issues as @imkane. Gekko is randomly crashing (Error: socket hang up) and results are quite different compared with the UI. Any ideas?
I don't but may be worth extending the timeout on the server.js?
As for different results - the GA is hitting the same api as the UI so I can't see how that is possible.
yes! I'd love a PR for that.
On Mon, Oct 30, 2017 at 3:38 PM, thegamecat notifications@github.com
wrote:
I don't but may be worth extending the timeout on the server.js?
As for different results - the GA is hitting the same api as the UI so I
can't see how that is possible.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/askmike/gekko/issues/1102#issuecomment-340376784, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AA7MD2fRbiYhouyP7oUOIA47NUgMFkvdks5sxYsSgaJpZM4PSEz3
.
--
PGP key at keybase.io/mikevanrossum
https://keybase.io/mikevanrossum/key.asc
There are 2 scenarios:
1) Candle size too small compared to history: Terminal 2 (run-ga-parallel.js), crashes but Terminal 1 (server.js) keeps going.
Using CCI with a fixed candle size of 1 and a datarange from 2017-07-20 00:00:00 to 2017-10-02 00:00:00; It's not even possible to go through a single epoch before it crashes.
2) If I increase the candle size or reduce history, then => Random crash: Termial 1 crashes first (debug messages stop) and then, because of that, Terminal 2 crashes.
Using CCI with a fixed candle size of 5 and a datarange : 2017-07-20 00:00:00 to 2017-10-02 00:00:00. Epoch 5 creashed and I got this results:
Epoch number: 4
Time it took (seconds): 125.048
Max profit: 161.2860603350398$ max profit position: 0
Max parametars:
{ cciDown: -99, cciUP: 81, candleSize: 5 }
Other metrics:
{ balance: 456.2860603350398,
profit: 161.2860603350398,
relativeProfit: 54.67324079153889,
yearlyProfit: '795.53259490',
relativeYearlyProfit: '269.67206607',
startPrice: 195,
endPrice: 304.99999999,
trades: 1 }
--------------------------------------------------------------
Global maximum: 161.2860603350398$, parameters:
{ cciDown: -99, cciUP: 81, candleSize: 5 }
Other metrics of global maximum:
Global maximum so far:
{ balance: 456.2860603350398,
profit: 161.2860603350398,
relativeProfit: 54.67324079153889,
yearlyProfit: '795.53259490',
relativeYearlyProfit: '269.67206607',
startPrice: 195,
endPrice: 304.99999999,
trades: 1 }
--------------------------------------------------------------
Using the same data with the UI ( cciDown: -99, cciUP: 81, candleSize: 5):

As you can see not even the number of trades are equal. Actually there has to be something wrong here since it ALWAYS make only one trade.
PS: I couldn't find out how to extend the server timeout
I've created a GA discord channel specifically for people doing GA backtesting with Gekko. Here we can share tools, knowledge, tips, tricks etc.. I would also like to maintain a server list for people who are interested in sharing system resources using a round robin system for testing.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you feel this is very a important issue please reach out the maintainer of this project directly via e-mail: gekko at mvr dot me.
Most helpful comment
I've created a GA discord channel specifically for people doing GA backtesting with Gekko. Here we can share tools, knowledge, tips, tricks etc.. I would also like to maintain a server list for people who are interested in sharing system resources using a round robin system for testing.
gekkoGA