gekkowarez / gekkoga Goto Github PK
View Code? Open in Web Editor NEWGenetic Algorithm for solving optimization of trading strategies using Gekko
Genetic Algorithm for solving optimization of trading strategies using Gekko
since gekkoga is 'solving optimization of trading strategies using Gekko'.
does it mean we can use any strat called in our gekko's config?
now i am trying gekkoga with its basic config (MACD) and curious if this possible to optimize my current gekko's strat.
I get this Error sometimes and I cant figure out why. The GA works fine and suddenly I get this Error. I cant recreate it or find any reason why I get this one so randomly. The GA can run for 12 hours and suddenly I get this Error, but sometimes after 5 minutes I get this error.
I tried diffrent strats and diffrent parameter, nothing helps.
Maybe someone had this Error too and has a solution.
First CMD:
{ StatusCodeError: 500 - "Internal Server Error"
at new StatusCodeError (C:\Users\threi\Gekko\gekko-stable\node_modules\request-promise-core\lib\errors.js:32:15)
at Request.plumbing.callback (C:\Users\threi\Gekko\gekko-stable\node_modules\request-promise-core\lib\plumbing.js:104:33)
at Request.RP$callback [as _callback] (C:\Users\threi\Gekko\gekko-stable\node_modules\request-promise-core\lib\plumbing.js:46:31)
at Request.self.callback (C:\Users\threi\Gekko\gekko-stable\node_modules\request\request.js:185:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request. (C:\Users\threi\Gekko\gekko-stable\node_modules\request\request.js:1157:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at IncomingMessage. (C:\Users\threi\Gekko\gekko-stable\node_modules\request\request.js:1079:12)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
name: 'StatusCodeError',
statusCode: 500,
message: '500 - "Internal Server Error"',
error: 'Internal Server Error',
options:
{ url: 'http://localhost:3000/api/backtest',
json: true,
body:
{ watch: [Object],
paperTrader: [Object],
writer: [Object],
tradingAdvisor: [Object],
trader: [Object],
backtest: [Object],
backtestResultExporter: [Object],
performanceAnalyzer: [Object],
valid: true,
RSI_BULL_BEAR_ADX: [Object] },
headers: { 'Content-Type': 'application/json' },
timeout: 3600000,
method: 'POST',
callback: [Function: RP$callback],
transform: undefined,
simple: true,
resolveWithFullResponse: false,
transform2xxOnly: false },
response:
IncomingMessage {
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: [Object],
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: false,
domain: null,
_events:
{ end: [Array],
close: [Array],
data: [Function],
error: [Function] },
_eventsCount: 4,
_maxListeners: undefined,
socket:
Socket {
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'localhost',
_readableState: [Object],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 9,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 1129,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [Object],
_idleTimeout: -1,
_idleNext: null,
_idlePrev: null,
_idleStart: 2449889,
_destroyed: false,
[Symbol(asyncId)]: 58391,
[Symbol(bytesRead)]: 176,
[Symbol(asyncId)]: 58400,
[Symbol(triggerAsyncId)]: 58398 },
connection:
Socket {
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'localhost',
_readableState: [Object],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 9,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 1129,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [Object],
_idleTimeout: -1,
_idleNext: null,
_idlePrev: null,
_idleStart: 2449889,
_destroyed: false,
[Symbol(asyncId)]: 58391,
[Symbol(bytesRead)]: 176,
[Symbol(asyncId)]: 58400,
[Symbol(triggerAsyncId)]: 58398 },
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers:
{ 'content-type': 'text/plain; charset=utf-8',
'content-length': '21',
date: 'Mon, 13 Aug 2018 12:12:29 GMT',
connection: 'close' },
rawHeaders:
[ 'Content-Type',
'text/plain; charset=utf-8',
'Content-Length',
'21',
'Date',
'Mon, 13 Aug 2018 12:12:29 GMT',
'Connection',
'close' ],
trailers: {},
rawTrailers: [],
upgrade: false,
url: '',
method: null,
statusCode: 500,
statusMessage: 'Internal Server Error',
client:
Socket {
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'localhost',
_readableState: [Object],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 9,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 1129,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [Object],
_idleTimeout: -1,
_idleNext: null,
_idlePrev: null,
_idleStart: 2449889,
_destroyed: false,
[Symbol(asyncId)]: 58391,
[Symbol(bytesRead)]: 176,
[Symbol(asyncId)]: 58400,
[Symbol(triggerAsyncId)]: 58398 },
_consuming: true,
_dumped: false,
req:
ClientRequest {
domain: null,
_events: [Object],
_eventsCount: 6,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
upgrading: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Object],
connection: [Object],
_header: 'POST /api/backtest HTTP/1.1\r\nContent-Type: application/json\r\nhost: localhost:3000\r\naccept: application/json\r\ncontent-length: 978\r\nConnection: close\r\n\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Object],
socketPath: undefined,
timeout: undefined,
method: 'POST',
path: '/api/backtest',
_ended: true,
res: [Circular],
aborted: undefined,
timeoutCb: [Function: emitTimeout],
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
[Symbol(outHeadersKey)]: [Object] },
request:
Request {
domain: null,
_events: [Object],
_eventsCount: 5,
_maxListeners: undefined,
body: '{"watch":{"exchange":"kraken","currency":"USD","asset":"BCH"},"paperTrader":{"slippage":0.05,"feeTaker":0.25,"feeMaker":0.15,"feeUsing":"taker","simulationBalance":{"asset":0,"currency":100},"reportRoundtrips":true,"enabled":true},"writer":{"enabled":false,"logpath":""},"tradingAdvisor":{"enabled":true,"method":"RSI_BULL_BEAR_ADX","candleSize":19,"historySize":1440},"trader":{"enabled":false},"backtest":{"daterange":{"from":"2017-09-30 22:00","to":"2018-08-12 10:00"}},"backtestResultExporter":{"enabled":true,"writeToDisk":false,"data":{"stratUpdates":false,"roundtrips":false,"stratCandles":true,"stratCandleProps":["close","start"],"trades":false}},"performanceAnalyzer":{"riskFreeReturn":5,"enabled":true},"valid":true,"RSI_BULL_BEAR_ADX":{"ADX":{"low":44,"adx":5,"high":80},"BULL":{"rsi":20,"low":55,"high":80,"mod_low":-26,"mod_high":13},"SMA":{"long":165,"short":43},"BEAR":{"low":15,"rsi":25,"high":45,"mod_low":-16,"mod_high":5},"candleSize":19,"historySize":1440}}',
headers: [Object],
timeout: 3600000,
method: 'POST',
readable: true,
writable: true,
explicitMethod: true,
_qs: [Object],
_auth: [Object],
_oauth: [Object],
_multipart: [Object],
_redirect: [Object],
_tunnel: [Object],
_rp_resolve: [Function],
_rp_reject: [Function],
_rp_promise: [Object],
_rp_callbackOrig: undefined,
callback: [Function],
_rp_options: [Object],
setHeader: [Function],
hasHeader: [Function],
getHeader: [Function],
removeHeader: [Function],
localAddress: undefined,
pool: {},
dests: [],
__isRequestRequest: true,
_callback: [Function: RP$callback],
uri: [Object],
proxy: null,
tunnel: false,
setHost: true,
originalCookieHeader: undefined,
_disableCookies: true,
_jar: undefined,
port: '3000',
host: 'localhost',
path: '/api/backtest',
_json: true,
httpModule: [Object],
agentClass: [Object],
agent: [Object],
_started: true,
href: 'http://localhost:3000/api/backtest',
req: [Object],
ntick: true,
timeoutTimer: null,
response: [Circular],
originalHost: 'localhost:3000',
originalHostHeaderName: 'host',
responseContent: [Circular],
_destdata: true,
_ended: true,
_callbackCalled: true },
toJSON: [Function: responseToJSON],
caseless: Caseless { dict: [Object] },
read: [Function],
body: 'Internal Server Error' } }
Second CMD:
<-- POST /api/backtest
xxx POST /api/backtest 500 777ms -
Error: non-error thrown: Child process has died.
at Object.onerror (C:\Users\threi\Gekko\gekko-stable\node_modules\koa\lib\context.js:105:40)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
I have tried on 4 different systems to get this to run, but it will not.
this is just a snippet of the output.
No previous run data, starting from scratch!
Starting training with: 4 units
{ StatusCodeError: 500 - "Internal Server Error"
at new StatusCodeError (/home/jjude/gekko/node_modules/request-promise-core/lib/errors.js:32:15)
at Request.plumbing.callback (/home/jjude/gekko/node_modules/request-promise-core/lib/plumbing.js:104:33)
at Request.RP$callback [as _callback] (/home/jjude/gekko/node_modules/request-promise-core/lib/plumbing.js:46:31)
at Request.self.callback (/home/jjude/gekko/node_modules/request/request.js:188:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request. (/home/jjude/gekko/node_modules/request/request.js:1171:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at IncomingMessage. (/home/jjude/gekko/node_modules/request/request.js:1091:12)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1056:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
name: 'StatusCodeError',
statusCode: 500,
message: '500 - "Internal Server Error"',
error: 'Internal Server Error',
options:
{ url: 'http://kodi-livingroom:3001/api/backtest',
json: true,
body: { gekkoConfig: [Object], data: [Object] },
headers: { 'Content-Type': 'application/json' },
timeout: 900000,
method: 'POST',
callback: [Function: RP$callback],
transform: undefined,
simple: true,
resolveWithFullResponse: false,
transform2xxOnly: false },
Hi ! I'm getting the following error when testing
Starting GA with epoch populations of 20, running 5 units at a time!
{ RequestError: Error: socket hang up
at new RequestError (/Users/Grun7/dev/gekko/gekkoga/node_modules/request-promise-core/lib/errors.js:14:15)
at Request.plumbing.callback (/Users/Grun7/dev/gekko/gekkoga/node_modules/request-promise-core/lib/plumbing.js:87:29)
at Request.RP$callback [as _callback] (/Users/Grun7/dev/gekko/gekkoga/node_modules/request-promise-core/lib/plumbing.js:46:31)
at self.callback (/Users/Grun7/dev/gekko/gekkoga/node_modules/request/request.js:186:22)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at Request.onRequestError (/Users/Grun7/dev/gekko/gekkoga/node_modules/request/request.js:878:8)
at emitOne (events.js:121:20)
at ClientRequest.emit (events.js:211:7)
at Socket.socketOnEnd (_http_client.js:423:9)
at emitNone (events.js:111:20)
at Socket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1056:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
name: 'RequestError',
message: 'Error: socket hang up',
cause: { Error: socket hang up
at createHangUpError (_http_client.js:331:15)
at Socket.socketOnEnd (_http_client.js:423:23)
at emitNone (events.js:111:20)
at Socket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1056:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9) code: 'ECONNRESET' },
Any idea what it could be ? I'm using the following settings :
const config = {
stratName: 'XXX',
gekkoConfig: {
watch: {
exchange: 'poloniex',
currency: 'BTC',
asset: 'LTC'
},
daterange: 'scan',
simulationBalance: {
'asset': 1,
'currency': 1
},
slippage: 0.05,
feeTaker: 0.25,
feeMaker: 0.15,
feeUsing: 'taker', // maker || taker
},
I don't have any particular problem with my gekko process, I tested several backtests with this set of data and didn't get any issue ๐ค
It seems to happen when using > 1months set of data. I tried to use the same settings with a range limited to a couple of weeks and it worked.
Thanks !
I've tried installing gekkoga in Win10 and Ubuntu 16.04 and 17.10 and tried with different strategies and configurations. Still I get zero trades every time. How can I troubleshoot this?
--------------------------------------------------------------
Epoch number: 31
Time it took (seconds): 58.211
Max score: 0
Max profit: 0 EUR
Max sharpe: 0
Max profit position: 0
Max parameters:
{ diplus: '14.6',
diminus: '27.6',
candleSize: 180,
optInTimePeriod: 10 }
Other metrics:
{ balance: 9000,
profit: 0,
sharpe: 0,
market: -34.84376158503933,
relativeProfit: 0,
yearlyProfit: '0.00000000',
relativeYearlyProfit: '0.00000000',
startPrice: 12138.5,
endPrice: 7908.99,
trades: 0 }
--------------------------------------------------------------
Global Maximums:
Score: 0
Profit: 0 EUR
Sharpe: 0
parameters:
{ diplus: '14.6',
diminus: '27.6',
candleSize: 180,
optInTimePeriod: 10 }
Global maximum so far:
{ balance: 9000,
profit: 0,
sharpe: 0,
market: -34.84376158503933,
relativeProfit: 0,
yearlyProfit: '0.00000000',
relativeYearlyProfit: '0.00000000',
startPrice: 12138.5,
endPrice: 7908.99,
trades: 0 }
--------------------------------------------------------------
Hello
Would it be possible to add a feature to run GA analyses against multiple coin pairs?
e.g provide a list of coins in the config file and then run gekkoga in batch (creating different output files for each coin pairs)
assuming i am using the same strategy for every coin which requires different settings this would be very nice
thanks
Would it be possible to add in a small function to change the max fitness to be
max profit * sharpe ratio * number of trades ?
This I think should give a better estimation of good vs bad genomes and help to find ones that are better suited to the market they are competing on, especially with the sharpe ratio. It also avoids those earlier epochs that seem to stick around with 1-2 trades.
i have got following error when trying to run gekkoga using any strat
also tried macd strat.
Gekko
StatusCodeError: 500 - "Internal Server Error
GA
xxx POST /api/backtest 500 302ms -
Error: non-error thrown: Child process has died.
at Object.onerror (/home/elmolinger/gekko/node_modules/koa/lib/context.js:105:40)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
node run.js -c config/your-new.js
No previous run data, starting from scratch!
Starting GA with epoch populations of 20, running 8 units at a time!
{ StatusCodeError: 500 - "Internal Server Error"
at new StatusCodeError (/home/elmolinger/gekko/gekkoga/node_modules/request-promise-core/lib/errors.js:32:15)
at Request.plumbing.callback (/home/elmolinger/gekko/gekkoga/node_modules/request-promise-core/lib/plumbing.js:104:33)
at Request.RP$callback [as _callback] (/home/elmolinger/gekko/gekkoga/node_modules/request-promise-core/lib/plumbing.js:46:31)
at Request.self.callback (/home/elmolinger/gekko/gekkoga/node_modules/request/request.js:186:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request.<anonymous> (/home/elmolinger/gekko/gekkoga/node_modules/request/request.js:1163:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at IncomingMessage.<anonymous> (/home/elmolinger/gekko/gekkoga/node_modules/request/request.js:1085:12)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1055:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
name: 'StatusCodeError',
statusCode: 500,
message: '500 - "Internal Server Error"',
error: 'Internal Server Error',
options:
{ url: 'http://localhost:3000/api/backtest',
json: true,
body: { gekkoConfig: [Object], data: [Object] },
headers: { 'Content-Type': 'application/json' },
timeout: 1200000,
method: 'POST',
callback: [Function: RP$callback],
transform: undefined,
simple: true,
resolveWithFullResponse: false,
transform2xxOnly: false },
response:
IncomingMessage {
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: [Object],
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: false,
domain: null,
_events:
{ end: [Array],
close: [Array],
data: [Function],
error: [Function] },
_eventsCount: 4,
_maxListeners: undefined,
socket:
Socket {
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'localhost',
_readableState: [Object],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 9,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 1055,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [Object],
read: [Function],
_consuming: true,
_idleTimeout: -1,
_idleNext: null,
_idlePrev: null,
_idleStart: 809,
_destroyed: false,
[Symbol(asyncId)]: 28,
[Symbol(bytesRead)]: 176,
[Symbol(asyncId)]: 86,
[Symbol(triggerAsyncId)]: 82 },
connection:
Socket {
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'localhost',
_readableState: [Object],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 9,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 1055,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [Object],
read: [Function],
_consuming: true,
_idleTimeout: -1,
_idleNext: null,
_idlePrev: null,
_idleStart: 809,
_destroyed: false,
[Symbol(asyncId)]: 28,
[Symbol(bytesRead)]: 176,
[Symbol(asyncId)]: 86,
[Symbol(triggerAsyncId)]: 82 },
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers:
{ 'content-type': 'text/plain; charset=utf-8',
'content-length': '21',
date: 'Sun, 25 Feb 2018 21:20:23 GMT',
connection: 'close' },
rawHeaders:
[ 'Content-Type',
'text/plain; charset=utf-8',
'Content-Length',
'21',
'Date',
'Sun, 25 Feb 2018 21:20:23 GMT',
'Connection',
'close' ],
trailers: {},
rawTrailers: [],
upgrade: false,
url: '',
method: null,
statusCode: 500,
statusMessage: 'Internal Server Error',
client:
Socket {
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'localhost',
_readableState: [Object],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 9,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 1055,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [Object],
read: [Function],
_consuming: true,
_idleTimeout: -1,
_idleNext: null,
_idlePrev: null,
_idleStart: 809,
_destroyed: false,
[Symbol(asyncId)]: 28,
[Symbol(bytesRead)]: 176,
[Symbol(asyncId)]: 86,
[Symbol(triggerAsyncId)]: 82 },
_consuming: true,
_dumped: false,
req:
ClientRequest {
domain: null,
_events: [Object],
_eventsCount: 6,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
upgrading: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Object],
connection: [Object],
_header: 'POST /api/backtest HTTP/1.1\r\nContent-Type: application/json\r\nhost: localhost:3000\r\naccept: application/json\r\ncontent-length: 904\r\nConnection: close\r\n\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Object],
socketPath: undefined,
timeout: undefined,
method: 'POST',
path: '/api/backtest',
_ended: true,
res: [Circular],
aborted: undefined,
timeoutCb: [Function: emitTimeout],
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
[Symbol(outHeadersKey)]: [Object] },
request:
Request {
domain: null,
_events: [Object],
_eventsCount: 5,
_maxListeners: undefined,
body: '{"gekkoConfig":{"watch":{"exchange":"bitfinex","currency":"USD","asset":"LTC"},"paperTrader":{"slippage":0.05,"feeTaker":0.25,"feeMaker":0.15,"feeUsing":"taker","simulationBalance":{"asset":0,"currency":100},"reportRoundtrips":true,"enabled":true},"writer":{"enabled":false,"logpath":""},"tradingAdvisor":{"enabled":true,"method":"RSI_Bull_Bear_Adx","candleSize":20,"historySize":100},"trader":{"enabled":false},"backtest":{"daterange":{"from":"2017-08-25 14:10:00","to":"2017-11-11107:10:41"}},"performanceAnalyzer":{"riskFreeReturn":5,"enabled":true},"valid":true,"RSI_Bull_Bear_Adx":{"historySize":100,"SMA_long":1300,"SMA_short":44,"BULL_RSI":9,"BULL_RSI_high":70,"BULL_RSI_low":55,"BEAR_RSI":17,"BEAR_RSI_high":59,"BEAR_RSI_low":11,"ADX":2,"ADX_high":77,"ADX_low":44,"candleSize":20}},"data":{"candleProps":["close","start"],"indicatorResults":false,"report":true,"roundtrips":false,"trades":false}}',
headers: [Object],
timeout: 1200000,
method: 'POST',
readable: true,
writable: true,
explicitMethod: true,
_qs: [Object],
_auth: [Object],
_oauth: [Object],
_multipart: [Object],
_redirect: [Object],
_tunnel: [Object],
_rp_resolve: [Function],
_rp_reject: [Function],
_rp_promise: [Object],
_rp_callbackOrig: undefined,
callback: [Function],
_rp_options: [Object],
setHeader: [Function],
hasHeader: [Function],
getHeader: [Function],
removeHeader: [Function],
localAddress: undefined,
pool: {},
dests: [],
__isRequestRequest: true,
_callback: [Function: RP$callback],
uri: [Object],
proxy: null,
tunnel: false,
setHost: true,
originalCookieHeader: undefined,
_disableCookies: true,
_jar: undefined,
port: '3000',
host: 'localhost',
path: '/api/backtest',
_json: true,
httpModule: [Object],
agentClass: [Object],
agent: [Object],
_started: true,
href: 'http://localhost:3000/api/backtest',
req: [Object],
ntick: true,
timeoutTimer: null,
response: [Circular],
originalHost: 'localhost:3000',
originalHostHeaderName: 'host',
responseContent: [Circular],
_destdata: true,
_ended: true,
_callbackCalled: true },
toJSON: [Function: responseToJSON],
caseless: Caseless { dict: [Object] },
read: [Function],
`body:` 'Internal Server Error' } }
2018-02-25 22:20:23 (INFO): Setting up Gekko in backtest mode
2018-02-25 22:20:23 (INFO):
2018-02-25 22:20:23 (INFO): Setting up:
2018-02-25 22:20:23 (INFO): Trading Advisor
2018-02-25 22:20:23 (INFO): Calculate trading advice
2018-02-25 22:20:23 (INFO): Setting up Gekko in backtest mode
2018-02-25 22:20:23 (INFO):
2018-02-25 22:20:23 (INFO): Setting up Gekko in backtest mode
2018-02-25 22:20:23 (INFO):
2018-02-25 22:20:23 (INFO): Setting up:
2018-02-25 22:20:23 (INFO): Trading Advisor
2018-02-25 22:20:23 (INFO): Calculate trading advice
2018-02-25 22:20:23 (INFO): Setting up:
2018-02-25 22:20:23 (INFO): Trading Advisor
2018-02-25 22:20:23 (INFO): Calculate trading advice
2018-02-25 22:20:23 (INFO): Setting up Gekko in backtest mode
2018-02-25 22:20:23 (INFO):
2018-02-25 22:20:23 (INFO): Setting up Gekko in backtest mode
2018-02-25 22:20:23 (INFO):
2018-02-25 22:20:23 (INFO): Setting up:
2018-02-25 22:20:23 (INFO): Trading Advisor
2018-02-25 22:20:23 (INFO): Calculate trading advice
2018-02-25 22:20:23 (INFO): Setting up:
2018-02-25 22:20:23 (INFO): Trading Advisor
2018-02-25 22:20:23 (INFO): Calculate trading advice
xxx POST /api/backtest 500 394ms -
Error: non-error thrown: Child process has died.
at Object.onerror (/home/elmolinger/gekko/node_modules/koa/lib/context.js:105:40)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
xxx POST /api/backtest 500 336ms -
Error: non-error thrown: Child process has died.
at Object.onerror (/home/elmolinger/gekko/node_modules/koa/lib/context.js:105:40)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
xxx POST /api/backtest 500 302ms -
Error: non-error thrown: Child process has died.
at Object.onerror (/home/elmolinger/gekko/node_modules/koa/lib/context.js:105:40)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
xxx POST /api/backtest 500 262ms -
Error: non-error thrown: Child process has died.
at Object.onerror (/home/elmolinger/gekko/node_modules/koa/lib/context.js:105:40)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
xxx POST /api/backtest 500 234ms -
Error: non-error thrown: Child process has died.
at Object.onerror (/home/elmolinger/gekko/node_modules/koa/lib/context.js:105:40)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
xxx POST /api/backtest 500 205ms -
Error: non-error thrown: Child process has died.
at Object.onerror (/home/elmolinger/gekko/node_modules/koa/lib/context.js:105:40)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
2018-02-25 22:20:23 (INFO): Setting up Gekko in backtest mode
2018-02-25 22:20:23 (INFO):
2018-02-25 22:20:23 (INFO): Setting up:
2018-02-25 22:20:23 (INFO): Trading Advisor
2018-02-25 22:20:23 (INFO): Calculate trading advice
2018-02-25 22:20:23 (INFO): Setting up Gekko in backtest mode
2018-02-25 22:20:23 (INFO):
2018-02-25 22:20:23 (INFO): Setting up:
2018-02-25 22:20:23 (INFO): Trading Advisor
2018-02-25 22:20:23 (INFO): Calculate trading advice
xxx POST /api/backtest 500 206ms -
Error: non-error thrown: Child process has died.
at Object.onerror (/home/elmolinger/gekko/node_modules/koa/lib/context.js:105:40)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
2018-02-25 22:20:23 (INFO): Setting up Gekko in backtest mode
2018-02-25 22:20:23 (INFO):
2018-02-25 22:20:23 (INFO): Setting up:
2018-02-25 22:20:23 (INFO): Trading Advisor
2018-02-25 22:20:23 (INFO): Calculate trading advice
xxx POST /api/backtest 500 212ms -
Error: non-error thrown: Child process has died.
at Object.onerror (/home/elmolinger/gekko/node_modules/koa/lib/context.js:105:40)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)```
I'm submitting a ...
[X] bug report
[ ] question about the decisions made in the repository
Action taken (what you did)
Start my config.js on gekkoga genetic plugin (mac osx 10.13
Expected result (what you hoped would happen)
launch backtest for my strategy and help me to improve it.
Actual result (unexpected outcome)
gekkoga josephmichel$ node run -c config/config.js
internal/modules/cjs/loader.js:550
throw err;
^
Error: Cannot find module './web/isWindows.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15)
at Function.Module._load (internal/modules/cjs/loader.js:475:25)
at Module.require (internal/modules/cjs/loader.js:598:17)
at require (internal/modules/cjs/helpers.js:11:18)
at Object. (/Users/josephineboutron/gekko/gekkoga/config/config.js:282:16)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Module.require (internal/modules/cjs/loader.js:598:17)
at require (internal/modules/cjs/helpers.js:11:18)
at Object. (/Users/josephineboutron/gekko/gekkoga/run.js:16:16)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
at startup (internal/bootstrap/node.js:201:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc)
isWindows.js is actually here in the gekko/web folder
I used bitcoin-scraper (as instructed on the gekkowarez page) to download 2011 - 2017 bitstamp BTC/USD data. It went through the whole process of downloading, then fixing the holes, and then ended up spitting out a ~250 megabyte DB file. I threw that into gekko, and tried gekko's backtesting feature, and that worked great.
I then tried to use gekkoga on that data, and it's giving me strange errors - gekko keeps dying, and the error given on gekkoga is a 500 internal service error.
Any idea what could cause this? I'm not seeing any other useful information...
Update
I forgot to mention, I'm only using the 2017 part of the data to backtest against. The strange part is that the backtesting works great in Gekko...
hello again,
I tried your GA on a DEMA strategy, making it working on short and long parameters :
stratName: 'DEMA',
candleValues: [60,120],
getProperties: () => ({
// Here add the indicators and the ranges you want to handle
// In this case my strategy wants to test RSI and MACD ranges
historySize: 3,
short: randomExt.integer(20, 5),
long: randomExt.integer(30, 10),
signal: 9,
thresholds: {
up: 0.025,
down: -0.025,
},
candleSize: config.candleValues[randomExt.integer(config.candleValues.length -1, 0)]
})
};
Here's the console log :
Epoch number: 69
Time it took (seconds): 7.344
Max profit: 0.0026593000000709986 $ max profit position: 0
Max parametars:
{ historySize: 3,
short: 5,
long: 24,
signal: 9,
thresholds: { up: 0.025, down: -0.025 },
candleSize: 120 }
Other metrics:
{ balance: 0.012659300000070999,
profit: 0.0026593000000709986,
sharpe: 0.9521211772395055,
market: 48.95572263952417,
relativeProfit: 26.593000000709992,
yearlyProfit: '0.01260930',
relativeYearlyProfit: '126.09298054',
startPrice: 1197.00000001,
endPrice: 1783.00000001,
trades: 36 }-------------------------------------------------------------- Global maximum: 0.006328200000000001 $, parameters: { historySize: 3,
short: 18,
long: 19,
signal: 9,
thresholds: { up: 0.025, down: -0.025 },
candleSize: 60 }
Other metrics of global maximum:
Global maximum so far:
{ balance: 0.0163282,
profit: 0.006328200000000001,
sharpe: 4.7603449785054766,
market: 78.78028404194839,
relativeProfit: 63.28200000000001,
yearlyProfit: '0.02607705',
relativeYearlyProfit: '260.77052113',
startPrice: 1197.00000001,
endPrice: 2140,
trades: 23 }
---------------------------------------------------------------------------------------------------------------------------- Epoch number: 70 Time it took (seconds): 7.387 Max profit: 0.003414219999999999 $ max profit position: 3 Max parametars: { historySize: 3,
short: 11,
long: 28,
signal: 9,
thresholds: { up: 0.025, down: -0.025 },
candleSize: 60 }
Other metrics:
{ balance: 0.01341422,
profit: 0.003414219999999999,
sharpe: 0.5341688637892175,
market: 77.22857584897889,
relativeProfit: 34.1422,
yearlyProfit: '0.01358318',
relativeYearlyProfit: '135.83175251',
startPrice: 1197.00000001,
endPrice: 2121.42605293,
trades: 53 }-------------------------------------------------------------- Global maximum: 0.006328200000000001 $, parameters: { historySize: 3,
short: 18,
long: 19,
signal: 9,
thresholds: { up: 0.025, down: -0.025 },
candleSize: 60 }
Other metrics of global maximum:
Global maximum so far:
{ balance: 0.0163282,
profit: 0.006328200000000001,
sharpe: 4.7603449785054766,
market: 78.78028404194839,
relativeProfit: 63.28200000000001,
yearlyProfit: '0.02607705',
relativeYearlyProfit: '260.77052113',
startPrice: 1197.00000001,
endPrice: 2140,
trades: 23 }
---------------------------------------------------------------------------------------------------------------------------- Epoch number: 71 Time it took (seconds): 8.049 Max profit: 0.0023482316258675983 $ max profit position: 0 Max parametars: { historySize: 3,
short: 11,
long: 28,
signal: 9,
thresholds: { up: 0.025, down: -0.025 },
candleSize: 120 }
Other metrics:
{ balance: 0.012348231625867599,
profit: 0.0023482316258675983,
sharpe: 1.7577594135726766,
market: 49.07489853927257,
relativeProfit: 23.48231625867598,
yearlyProfit: '0.01109431',
relativeYearlyProfit: '110.94306848',
startPrice: 1197.00000001,
endPrice: 1784.42653553,
trades: 28 }-------------------------------------------------------------- Global maximum: 0.006328200000000001 $, parameters: { historySize: 3,
short: 18,
long: 19,
signal: 9,
thresholds: { up: 0.025, down: -0.025 },
candleSize: 60 }
Other metrics of global maximum:
Global maximum so far:
{ balance: 0.0163282,
profit: 0.006328200000000001,
sharpe: 4.7603449785054766,
market: 78.78028404194839,
relativeProfit: 63.28200000000001,
yearlyProfit: '0.02607705',
relativeYearlyProfit: '260.77052113',
startPrice: 1197.00000001,
endPrice: 2140,
trades: 23 }
---------------------------------------------------------------------------------------------------------------------------- Epoch number: 72 Time it took (seconds): 7.579 Max profit: 0.0034560800000000003 $ max profit position: 0 Max parametars: { historySize: 3,
short: 11,
long: 25,
signal: 9,
thresholds: { up: 0.025, down: -0.025 },
candleSize: 60 }
Other metrics:
{ balance: 0.01345608,
profit: 0.0034560800000000003,
sharpe: 0.5121780203231062,
market: 77.22857584897889,
relativeProfit: 34.5608,
yearlyProfit: '0.01374971',
relativeYearlyProfit: '137.49711595',
startPrice: 1197.00000001,
endPrice: 2121.42605293,
trades: 59 }-------------------------------------------------------------- Global maximum: 0.006328200000000001 $, parameters: { historySize: 3,
short: 18,
long: 19,
signal: 9,
thresholds: { up: 0.025, down: -0.025 },
candleSize: 60 }
Other metrics of global maximum:
Global maximum so far:
{ balance: 0.0163282,
profit: 0.006328200000000001,
sharpe: 4.7603449785054766,
market: 78.78028404194839,
relativeProfit: 63.28200000000001,
yearlyProfit: '0.02607705',
relativeYearlyProfit: '260.77052113',
startPrice: 1197.00000001,
endPrice: 2140,
trades: 23 }
--------------------------------------------------------------
So if im correct, the recomended parameters for DEMA strategy is short 18 long 19 on 60 minutes candles ?
When I try to run the GA with Score as mainObjective I get a wierd output:
No previous run data, starting from scratch!
Starting GA with epoch populations of 10, running 5 units at a time!
--------------------------------------------------------------
Epoch number: 1
Time it took (seconds): 19.318
Max score: 1
Max profit: 183.8186868776 EUR
Max sharpe: 38.20463404372513
Max profit position: 1
Max parameters:
{ SMA_long: 1090,
BULL_RSI: 5,
BEAR_RSI: 24,
SMA_short: 40,
candleSize: 27,
historySize: 1440,
BULL_RSI_low: 55,
BEAR_RSI_low: 21,
BULL_RSI_high: 85,
BEAR_RSI_high: 47 }
Other metrics:
{ balance: 283.8186868776,
profit: 183.8186868776,
sharpe: 38.20463404372513,
market: 191.22174455692692,
relativeProfit: 183.8186868776,
yearlyProfit: 309.40244473350873,
relativeYearlyProfit: 309.40244473350873,
startPrice: 0.28844,
endPrice: 0.84,
trades: 140 }
--------------------------------------------------------------
Global Maximums:
Score: 1
Profit: 183.8186868776 EUR
Sharpe: 38.20463404372513
parameters:
{ SMA_long: 1090,
BULL_RSI: 5,
BEAR_RSI: 24,
SMA_short: 40,
candleSize: 27,
historySize: 1440,
BULL_RSI_low: 55,
BEAR_RSI_low: 21,
BULL_RSI_high: 85,
BEAR_RSI_high: 47 }
Global maximum so far:
{ balance: 283.8186868776,
profit: 183.8186868776,
sharpe: 38.20463404372513,
market: 191.22174455692692,
relativeProfit: 183.8186868776,
yearlyProfit: 309.40244473350873,
relativeYearlyProfit: 309.40244473350873,
startPrice: 0.28844,
endPrice: 0.84,
trades: 140 }
--------------------------------------------------------------
Epoch number: 2
Time it took (seconds): 25.181
Max score: 1
Max profit: 188.75188774256122 EUR
Max sharpe: 41.33514192426096
Max profit position: 2
Max parameters:
{ SMA_long: 480,
BULL_RSI: 5,
BEAR_RSI: 11,
SMA_short: 150,
candleSize: 15,
historySize: 1440,
BULL_RSI_low: 51,
BEAR_RSI_low: 17,
BULL_RSI_high: 89,
BEAR_RSI_high: 43 }
Other metrics:
{ balance: 288.7518877425612,
profit: 188.75188774256122,
sharpe: 41.33514192426096,
market: 208.05020108168077,
relativeProfit: 188.75188774256122,
yearlyProfit: 317.72733031425787,
relativeYearlyProfit: 317.72733031425787,
startPrice: 0.28844,
endPrice: 0.88854,
trades: 219 }
So as max score, I get always a 1. Profit or sharpe aren't improving ether. It's just a coincidence that the profit from epoch 2 is higher than epoch 1.
Am I doing something wrong?
I have ran Gekkoga for quite a while (over 1000 epochs) on a dataset of about 5 months with random numbers for most variables. However, there hasn't been a single strategy that did any trades. If I backtest via the webGUI, I do get trades. Any ideas?
I get these errors when trying to run Gekkoga
Terminal 2
No previous run data, starting from scratch!
Starting GA with epoch populations of 20, running 5 units at a time!
{ StatusCodeError: 500 - "Internal Server Error"
at new StatusCodeError (/home/oikonen/gekko/node_modules/request-promise-core/lib/errors.js:32:15)
at Request.plumbing.callback (/home/oikonen/gekko/node_modules/request-promise-core/lib/plumbing.js:104:33)
at Request.RP$callback [as _callback] (/home/oikonen/gekko/node_modules/request-promise-core/lib/plumbing.js:46:31)
at Request.self.callback (/home/oikonen/gekko/node_modules/request/request.js:186:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request.<anonymous> (/home/oikonen/gekko/node_modules/request/request.js:1163:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at IncomingMessage.<anonymous> (/home/oikonen/gekko/node_modules/request/request.js:1085:12)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1055:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
name: 'StatusCodeError',
statusCode: 500,
message: '500 - "Internal Server Error"',
error: 'Internal Server Error',
options:
{ url: 'http://localhost:3000/api/backtest',
json: true,
body: { gekkoConfig: [Object], data: [Object] },
headers: { 'Content-Type': 'application/json' },
timeout: 1200000,
method: 'POST',
callback: [Function: RP$callback],
transform: undefined,
simple: true,
resolveWithFullResponse: false,
transform2xxOnly: false },
response:
IncomingMessage {
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: [Object],
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: false,
domain: null,
_events:
{ end: [Array],
close: [Array],
data: [Function],
error: [Function] },
_eventsCount: 4,
_maxListeners: undefined,
socket:
Socket {
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'localhost',
_readableState: [Object],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 9,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 942,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [Object],
read: [Function],
_consuming: true,
_idleTimeout: -1,
_idleNext: null,
_idlePrev: null,
_idleStart: 1671,
_destroyed: false,
[Symbol(asyncId)]: 23,
[Symbol(bytesRead)]: 176,
[Symbol(asyncId)]: 63,
[Symbol(triggerAsyncId)]: 57 },
connection:
Socket {
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'localhost',
_readableState: [Object],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 9,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 942,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [Object],
read: [Function],
_consuming: true,
_idleTimeout: -1,
_idleNext: null,
_idlePrev: null,
_idleStart: 1671,
_destroyed: false,
[Symbol(asyncId)]: 23,
[Symbol(bytesRead)]: 176,
[Symbol(asyncId)]: 63,
[Symbol(triggerAsyncId)]: 57 },
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers:
{ 'content-type': 'text/plain; charset=utf-8',
'content-length': '21',
date: 'Fri, 26 Jan 2018 11:31:13 GMT',
connection: 'close' },
rawHeaders:
[ 'Content-Type',
'text/plain; charset=utf-8',
'Content-Length',
'21',
'Date',
'Fri, 26 Jan 2018 11:31:13 GMT',
'Connection',
'close' ],
trailers: {},
rawTrailers: [],
upgrade: false,
url: '',
method: null,
statusCode: 500,
statusMessage: 'Internal Server Error',
client:
Socket {
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'localhost',
_readableState: [Object],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 9,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 942,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [Object],
read: [Function],
_consuming: true,
_idleTimeout: -1,
_idleNext: null,
_idlePrev: null,
_idleStart: 1671,
_destroyed: false,
[Symbol(asyncId)]: 23,
[Symbol(bytesRead)]: 176,
[Symbol(asyncId)]: 63,
[Symbol(triggerAsyncId)]: 57 },
_consuming: true,
_dumped: false,
req:
ClientRequest {
domain: null,
_events: [Object],
_eventsCount: 6,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
upgrading: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Object],
connection: [Object],
_header: 'POST /api/backtest HTTP/1.1\r\nContent-Type: application/json\r\nhost: localhost:3000\r\naccept: application/json\r\ncontent-length: 791\r\nConnection: close\r\n\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Object],
socketPath: undefined,
timeout: undefined,
method: 'POST',
path: '/api/backtest',
_ended: true,
res: [Circular],
aborted: undefined,
timeoutCb: [Function: emitTimeout],
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
[Symbol(outHeadersKey)]: [Object] },
request:
Request {
domain: null,
_events: [Object],
_eventsCount: 5,
_maxListeners: undefined,
body: '{"gekkoConfig":{"watch":{"exchange":"binance","currency":"BTC","asset":"ETH"},"paperTrader":{"slippage":0.05,"feeTaker":0.1,"feeMaker":0.1,"feeUsing":"taker","simulationBalance":{"asset":1,"currency":1},"reportRoundtrips":true,"enabled":true},"writer":{"enabled":false,"logpath":""},"tradingAdvisor":{"enabled":true,"method":"StochRSI_MACD","candleSize":60,"historySize":31},"trader":{"enabled":false},"backtest":{"daterange":"scan"},"performanceAnalyzer":{"riskFreeReturn":5,"enabled":true},"valid":true,"StochRSI_MACD":{"historySize":31,"short":8,"long":17,"signal":7,"up":"0.000000081","down":"-0.000000383","persistence":5,"low":30,"high":72,"interval":1,"candleSize":60}},"data":{"candleProps":["close","start"],"indicatorResults":false,"report":true,"roundtrips":false,"trades":false}}',
headers: [Object],
timeout: 1200000,
method: 'POST',
readable: true,
writable: true,
explicitMethod: true,
_qs: [Object],
_auth: [Object],
_oauth: [Object],
_multipart: [Object],
_redirect: [Object],
_tunnel: [Object],
_rp_resolve: [Function],
_rp_reject: [Function],
_rp_promise: [Object],
_rp_callbackOrig: undefined,
callback: [Function],
_rp_options: [Object],
setHeader: [Function],
hasHeader: [Function],
getHeader: [Function],
removeHeader: [Function],
localAddress: undefined,
pool: {},
dests: [],
__isRequestRequest: true,
_callback: [Function: RP$callback],
uri: [Object],
proxy: null,
tunnel: false,
setHost: true,
originalCookieHeader: undefined,
_disableCookies: true,
_jar: undefined,
port: '3000',
host: 'localhost',
path: '/api/backtest',
_json: true,
httpModule: [Object],
agentClass: [Object],
agent: [Object],
_started: true,
href: 'http://localhost:3000/api/backtest',
req: [Object],
ntick: true,
timeoutTimer: null,
response: [Circular],
originalHost: 'localhost:3000',
originalHostHeaderName: 'host',
responseContent: [Circular],
_destdata: true,
_ended: true,
_callbackCalled: true },
toJSON: [Function: responseToJSON],
caseless: Caseless { dict: [Object] },
read: [Function],
body: 'Internal Server Error' } }
Terminal 1
2018-01-26 13:31:13 (INFO): Trading Advisor
/home/oikonen/gekko/node_modules/sqlite3/lib/trace.js:27
throw err;
^
TypeError: Cannot read property 'up' of undefined
at Base.method.check (/home/oikonen/gekko/strategies/StochRSI_MACD.js:79:56)
at Base.bound [as check] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Base.propogateTick (/home/oikonen/gekko/plugins/tradingAdvisor/baseTradingMethod.js:233:10)
at Base.bound [as propogateTick] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Base.tick (/home/oikonen/gekko/plugins/tradingAdvisor/baseTradingMethod.js:150:10)
at Base.bound [as tick] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Actor.processCustomCandle (/home/oikonen/gekko/plugins/tradingAdvisor/tradingAdvisor.js:79:15)
at CandleBatcher.bound (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at emitOne (events.js:116:13)
at CandleBatcher.emit (events.js:211:7)
--> in Database#all('\n SELECT * from candles_BTC_ETH\n WHERE start <= 1500037799 AND start >= 1500034800\n ORDER BY start ASC\n ', [Function])
at Reader.get (/home/oikonen/gekko/plugins/sqlite/reader.js:98:11)
at Reader.bound [as get] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Market.get (/home/oikonen/gekko/core/markets/backtest.js:61:15)
at Market.bound [as get] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Market.processCandles (/home/oikonen/gekko/core/markets/backtest.js:105:10)
at bound (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Statement.<anonymous> (/home/oikonen/gekko/plugins/sqlite/reader.js:108:5)
2018-01-26 13:31:13 (INFO): Calculate trading advice
/home/oikonen/gekko/node_modules/sqlite3/lib/trace.js:27
throw err;
^
TypeError: Cannot read property 'up' of undefined
at Base.method.check (/home/oikonen/gekko/strategies/StochRSI_MACD.js:79:56)
at Base.bound [as check] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Base.propogateTick (/home/oikonen/gekko/plugins/tradingAdvisor/baseTradingMethod.js:233:10)
at Base.bound [as propogateTick] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Base.tick (/home/oikonen/gekko/plugins/tradingAdvisor/baseTradingMethod.js:150:10)
at Base.bound [as tick] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Actor.processCustomCandle (/home/oikonen/gekko/plugins/tradingAdvisor/tradingAdvisor.js:79:15)
at CandleBatcher.bound (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at emitOne (events.js:116:13)
at CandleBatcher.emit (events.js:211:7)
--> in Database#all('\n SELECT * from candles_BTC_ETH\n WHERE start <= 1500085799 AND start >= 1500082800\n ORDER BY start ASC\n ', [Function])
at Reader.get (/home/oikonen/gekko/plugins/sqlite/reader.js:98:11)
at Reader.bound [as get] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Market.get (/home/oikonen/gekko/core/markets/backtest.js:61:15)
at Market.bound [as get] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Market.processCandles (/home/oikonen/gekko/core/markets/backtest.js:105:10)
at bound (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Statement.<anonymous> (/home/oikonen/gekko/plugins/sqlite/reader.js:108:5)
2018-01-26 13:31:13 (INFO): Using the strategy: StochRSI_MACD
2018-01-26 13:31:13 (INFO):
2018-01-26 13:31:13 (INFO): Setting up:
2018-01-26 13:31:13 (INFO): Paper Trader
2018-01-26 13:31:13 (INFO): Paper trader that simulates fake trades.
/home/oikonen/gekko/node_modules/sqlite3/lib/trace.js:27
throw err;
^
TypeError: Cannot read property 'up' of undefined
at Base.method.check (/home/oikonen/gekko/strategies/StochRSI_MACD.js:79:56)
at Base.bound [as check] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Base.propogateTick (/home/oikonen/gekko/plugins/tradingAdvisor/baseTradingMethod.js:233:10)
at Base.bound [as propogateTick] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Base.tick (/home/oikonen/gekko/plugins/tradingAdvisor/baseTradingMethod.js:150:10)
at Base.bound [as tick] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Actor.processCustomCandle (/home/oikonen/gekko/plugins/tradingAdvisor/tradingAdvisor.js:79:15)
at CandleBatcher.bound (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at emitOne (events.js:116:13)
at CandleBatcher.emit (events.js:211:7)
--> in Database#all('\n SELECT * from candles_BTC_ETH\n WHERE start <= 1500118799 AND start >= 1500115800\n ORDER BY start ASC\n ', [Function])
at Reader.get (/home/oikonen/gekko/plugins/sqlite/reader.js:98:11)
at Reader.bound [as get] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Market.get (/home/oikonen/gekko/core/markets/backtest.js:61:15)
at Market.bound [as get] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Market.processCandles (/home/oikonen/gekko/core/markets/backtest.js:105:10)
at bound (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Statement.<anonymous> (/home/oikonen/gekko/plugins/sqlite/reader.js:108:5)
2018-01-26 13:31:13 (INFO):
2018-01-26 13:31:13 (INFO): Setting up:
2018-01-26 13:31:13 (INFO): Performance Analyzer
2018-01-26 13:31:13 (INFO): Analyzes performances of trades
2018-01-26 13:31:13 (INFO):
2018-01-26 13:31:13 (INFO):
2018-01-26 13:31:13 (INFO): Setting up:
2018-01-26 13:31:13 (INFO): Paper Trader
2018-01-26 13:31:13 (INFO): Paper trader that simulates fake trades.
2018-01-26 13:31:13 (INFO):
2018-01-26 13:31:13 (INFO): Setting up:
2018-01-26 13:31:13 (INFO): Performance Analyzer
2018-01-26 13:31:13 (INFO): Analyzes performances of trades
2018-01-26 13:31:13 (INFO):
2018-01-26 13:31:13 (INFO): Scanning local history for backtestable dateranges.
2018-01-26 13:31:13 (DEBUG): Available 281940
2018-01-26 13:31:13 (DEBUG): Optimal 281939
2018-01-26 13:31:13 (INFO): Gekko is able to fully use the local history.
2018-01-26 13:31:13 (INFO): Gekko was able to find a single daterange in the locally stored history:
2018-01-26 13:31:13 (INFO): from: 2017-07-14 04:00:00
2018-01-26 13:31:13 (INFO): to: 2018-01-25 22:59:00
2018-01-26 13:31:13 (INFO): WARNING: BACKTESTING FEATURE NEEDS PROPER TESTING
2018-01-26 13:31:13 (INFO): WARNING: ACT ON THESE NUMBERS AT YOUR OWN RISK!
2018-01-26 13:31:13 (DEBUG): calculated StochRSI properties for candle:
2018-01-26 13:31:13 (DEBUG): rsi: 26.09637070
2018-01-26 13:31:13 (DEBUG): StochRSI min: 14.22780031
2018-01-26 13:31:13 (DEBUG): StochRSI max: 44.69161716
2018-01-26 13:31:13 (DEBUG): StochRSI Value: 38.96
2018-01-26 13:31:13 (DEBUG): calculated MACD properties for candle:
2018-01-26 13:31:13 (DEBUG): short: 0.08804481
2018-01-26 13:31:13 (DEBUG): long: 0.08786576
2018-01-26 13:31:13 (DEBUG): macd: 0.00017905
2018-01-26 13:31:13 (DEBUG): signal: 0.00069582
2018-01-26 13:31:13 (DEBUG): macdiff: -0.00051677
2018-01-26 13:31:13 (INFO):
2018-01-26 13:31:13 (INFO): Setting up:
2018-01-26 13:31:13 (INFO): Performance Analyzer
2018-01-26 13:31:13 (INFO): Analyzes performances of trades
2018-01-26 13:31:13 (INFO):
2018-01-26 13:31:13 (INFO): Scanning local history for backtestable dateranges.
2018-01-26 13:31:13 (DEBUG): Available 281940
2018-01-26 13:31:13 (DEBUG): Optimal 281939
2018-01-26 13:31:13 (INFO): Gekko is able to fully use the local history.
2018-01-26 13:31:13 (INFO): Gekko was able to find a single daterange in the locally stored history:
2018-01-26 13:31:13 (INFO): from: 2017-07-14 04:00:00
2018-01-26 13:31:13 (INFO): to: 2018-01-25 22:59:00
2018-01-26 13:31:13 (INFO): WARNING: BACKTESTING FEATURE NEEDS PROPER TESTING
2018-01-26 13:31:13 (INFO): WARNING: ACT ON THESE NUMBERS AT YOUR OWN RISK!
2018-01-26 13:31:13 (DEBUG): calculated StochRSI properties for candle:
2018-01-26 13:31:13 (DEBUG): rsi: 88.80666015
2018-01-26 13:31:13 (DEBUG): StochRSI min: 79.35127642
2018-01-26 13:31:13 (DEBUG): StochRSI max: 89.00618820
2018-01-26 13:31:13 (DEBUG): StochRSI Value: 97.93
2018-01-26 13:31:13 (DEBUG): calculated MACD properties for candle:
2018-01-26 13:31:13 (DEBUG): short: 0.09031696
2018-01-26 13:31:13 (DEBUG): long: 0.08947514
2018-01-26 13:31:13 (DEBUG): macd: 0.00084182
2018-01-26 13:31:13 (DEBUG): signal: 0.00065743
2018-01-26 13:31:13 (DEBUG): macdiff: 0.00018439
2018-01-26 13:31:13 (INFO): Scanning local history for backtestable dateranges.
2018-01-26 13:31:13 (DEBUG): Available 281940
2018-01-26 13:31:13 (DEBUG): Optimal 281939
2018-01-26 13:31:13 (INFO): Gekko is able to fully use the local history.
2018-01-26 13:31:13 (INFO): Gekko was able to find a single daterange in the locally stored history:
2018-01-26 13:31:13 (INFO): from: 2017-07-14 04:00:00
2018-01-26 13:31:13 (INFO): to: 2018-01-25 22:59:00
2018-01-26 13:31:13 (INFO): WARNING: BACKTESTING FEATURE NEEDS PROPER TESTING
2018-01-26 13:31:13 (INFO): WARNING: ACT ON THESE NUMBERS AT YOUR OWN RISK!
2018-01-26 13:31:13 (DEBUG): calculated StochRSI properties for candle:
2018-01-26 13:31:13 (DEBUG): rsi: 100.00000000
2018-01-26 13:31:13 (DEBUG): StochRSI min: 100.00000000
2018-01-26 13:31:13 (DEBUG): StochRSI max: 100.00000000
2018-01-26 13:31:13 (DEBUG): StochRSI Value: NaN
2018-01-26 13:31:13 (DEBUG): calculated MACD properties for candle:
2018-01-26 13:31:13 (DEBUG): short: 0.09173718
2018-01-26 13:31:13 (DEBUG): long: 0.09085331
2018-01-26 13:31:13 (DEBUG): macd: 0.00088387
2018-01-26 13:31:13 (DEBUG): signal: 0.00093745
2018-01-26 13:31:13 (DEBUG): macdiff: -0.00005358
2018-01-26 13:31:13 (INFO): Scanning local history for backtestable dateranges.
2018-01-26 13:31:13 (DEBUG): Available 281940
2018-01-26 13:31:13 (DEBUG): Optimal 281939
2018-01-26 13:31:13 (INFO): Gekko is able to fully use the local history.
2018-01-26 13:31:13 (INFO): Gekko was able to find a single daterange in the locally stored history:
2018-01-26 13:31:13 (INFO): from: 2017-07-14 04:00:00
2018-01-26 13:31:13 (INFO): to: 2018-01-25 22:59:00
2018-01-26 13:31:13 (INFO): WARNING: BACKTESTING FEATURE NEEDS PROPER TESTING
2018-01-26 13:31:13 (INFO): WARNING: ACT ON THESE NUMBERS AT YOUR OWN RISK!
xxx POST /api/backtest 500 1,184ms -
Error: non-error thrown: Child process has died.
at Object.onerror (/home/oikonen/gekko/node_modules/koa/lib/context.js:105:40)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
xxx POST /api/backtest 500 1,130ms -
Error: non-error thrown: Child process has died.
at Object.onerror (/home/oikonen/gekko/node_modules/koa/lib/context.js:105:40)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
xxx POST /api/backtest 500 1,099ms -
Error: non-error thrown: Child process has died.
at Object.onerror (/home/oikonen/gekko/node_modules/koa/lib/context.js:105:40)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
2018-01-26 13:31:14 (DEBUG): calculated StochRSI properties for candle:
2018-01-26 13:31:14 (DEBUG): rsi: 54.11224964
/home/oikonen/gekko/node_modules/sqlite3/lib/trace.js:27
throw err;
^
TypeError: Cannot read property 'up' of undefined
at Base.method.check (/home/oikonen/gekko/strategies/StochRSI_MACD.js:79:56)
at Base.bound [as check] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Base.propogateTick (/home/oikonen/gekko/plugins/tradingAdvisor/baseTradingMethod.js:233:10)
at Base.bound [as propogateTick] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Base.tick (/home/oikonen/gekko/plugins/tradingAdvisor/baseTradingMethod.js:150:10)
at Base.bound [as tick] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Actor.processCustomCandle (/home/oikonen/gekko/plugins/tradingAdvisor/tradingAdvisor.js:79:15)
at CandleBatcher.bound (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at emitOne (events.js:116:13)
at CandleBatcher.emit (events.js:211:7)
--> in Database#all('\n SELECT * from candles_BTC_ETH\n WHERE start <= 1500523799 AND start >= 1500520800\n ORDER BY start ASC\n ', [Function])
at Reader.get (/home/oikonen/gekko/plugins/sqlite/reader.js:98:11)
at Reader.bound [as get] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Market.get (/home/oikonen/gekko/core/markets/backtest.js:61:15)
at Market.bound [as get] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Market.processCandles (/home/oikonen/gekko/core/markets/backtest.js:105:10)
at bound (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Statement.<anonymous> (/home/oikonen/gekko/plugins/sqlite/reader.js:108:5)
2018-01-26 13:31:14 (DEBUG): StochRSI min: 4.00676355
2018-01-26 13:31:14 (DEBUG): StochRSI max: 54.11224964
2018-01-26 13:31:14 (DEBUG): StochRSI Value: 100.00
2018-01-26 13:31:14 (DEBUG): calculated MACD properties for candle:
2018-01-26 13:31:14 (DEBUG): short: 0.09348475
2018-01-26 13:31:14 (DEBUG): long: 0.09252072
2018-01-26 13:31:14 (DEBUG): macd: 0.00096403
2018-01-26 13:31:14 (DEBUG): signal: 0.00132428
2018-01-26 13:31:14 (DEBUG): macdiff: -0.00036025
xxx POST /api/backtest 500 1,633ms -
Error: non-error thrown: Child process has died.
at Object.onerror (/home/oikonen/gekko/node_modules/koa/lib/context.js:105:40)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
2018-01-26 13:31:14 (DEBUG): calculated StochRSI properties for candle:
2018-01-26 13:31:14 (DEBUG): rsi: 42.74704366
2018-01-26 13:31:14 (DEBUG): StochRSI min: 27.68607296
2018-01-26 13:31:14 (DEBUG): StochRSI max: 55.40647411
2018-01-26 13:31:14 (DEBUG): StochRSI Value: 54.33
2018-01-26 13:31:14 (DEBUG): calculated MACD properties for candle:
2018-01-26 13:31:14 (DEBUG): short: 0.09378403
2018-01-26 13:31:14 (DEBUG): long: 0.09096356
2018-01-26 13:31:14 (DEBUG): macd: 0.00282047
/home/oikonen/gekko/node_modules/sqlite3/lib/trace.js:27
throw err;
^
TypeError: Cannot read property 'up' of undefined
at Base.method.check (/home/oikonen/gekko/strategies/StochRSI_MACD.js:79:56)
at Base.bound [as check] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Base.propogateTick (/home/oikonen/gekko/plugins/tradingAdvisor/baseTradingMethod.js:233:10)
at Base.bound [as propogateTick] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Base.tick (/home/oikonen/gekko/plugins/tradingAdvisor/baseTradingMethod.js:150:10)
at Base.bound [as tick] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Actor.processCustomCandle (/home/oikonen/gekko/plugins/tradingAdvisor/tradingAdvisor.js:79:15)
at CandleBatcher.bound (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at emitOne (events.js:116:13)
at CandleBatcher.emit (events.js:211:7)
--> in Database#all('\n SELECT * from candles_BTC_ETH\n WHERE start <= 1500523799 AND start >= 1500520800\n ORDER BY start ASC\n ', [Function])
at Reader.get (/home/oikonen/gekko/plugins/sqlite/reader.js:98:11)
at Reader.bound [as get] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Market.get (/home/oikonen/gekko/core/markets/backtest.js:61:15)
at Market.bound [as get] (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Market.processCandles (/home/oikonen/gekko/core/markets/backtest.js:105:10)
at bound (/home/oikonen/gekko/node_modules/lodash/dist/lodash.js:729:21)
at Statement.<anonymous> (/home/oikonen/gekko/plugins/sqlite/reader.js:108:5)
2018-01-26 13:31:14 (DEBUG): signal: 0.00358610
2018-01-26 13:31:14 (DEBUG): macdiff: -0.00076563
xxx POST /api/backtest 500 1,654ms -
Error: non-error thrown: Child process has died.
at Object.onerror (/home/oikonen/gekko/node_modules/koa/lib/context.js:105:40)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
My config
candleValues: [5,10,15,30,60,120,240],
getProperties: () => ({
// Strat settings must be flattened and cannot be nested for mutation to work properly!
historySize: randomExt.integer(100, 20),
short: randomExt.integer(15,5),
long: randomExt.integer(40,15),
signal: randomExt.integer(12,6),
up: randomExt.float(0.0000005,0).toFixed(9),
down: randomExt.float(0,-0.0000005).toFixed(9),
persistence: randomExt.integer(10,0),
low: randomExt.integer(30,5),
high: randomExt.integer(80,60),
interval: randomExt.integer(8,1),
candleSize: config.candleValues[randomExt.integer(config.candleValues.length -1, 0)]
Problem is this line:
let position = randomExt.integer(0, a.length);
Should be:
let position = randomExt.integer(a.length, 0);
Does the current setup of the GA operate on random intervals of the backtesting data? When I run the GA, I think the results are overfit for my backtesting data. Are there any ways of solving this issue?
I know others have spoken about this, but I was wondering too if it was possible to automatically construct strategies from random assortments of indicators to fit the best ones for a market, and found this on github:
https://github.com/Gab0/gekkoJaponicus
I can't seem to get it to work as the python imports are all over the place, but maybe it could be a start towards something like this idea, maybe ported into this project somewhere?
Hi gekkowarez,
gekkoga was running fine with 0.5.10 but with latest 0.5.11 update, gekkoga starting to throw errors.
gekkoga log:
/gekko/gekkoga# node run -c config/downtrend.js
Previous config found, loading...
Loaded previous config from downtrend-BTC_ETH.json
Resuming previous run...
Starting training with: 4 units
{ StatusCodeError: 500 - "Internal Server Error"
at new StatusCodeError (/gekko/gekkoga/node_modules/request-promise-core/lib/errors.js:32:15)
at Request.plumbing.callback (/gekko/gekkoga/node_modules/request-promise-core/lib/plumbing.js:104:33)
at Request.RP$callback [as _callback] (/gekko/gekkoga/node_modules/request-promise-core/lib/plumbing.js:46:31)
at Request.self.callback (/gekko/gekkoga/node_modules/request/request.js:186:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:194:7)
at Request. (/gekko/gekkoga/node_modules/request/request.js:1163:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:191:7)
at IncomingMessage. (/gekko/gekkoga/node_modules/request/request.js:1085:12)
at Object.onceWrapper (events.js:293:19)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:188:7)
at endReadableNT (_stream_readable.js:975:12)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
name: 'StatusCodeError',
statusCode: 500,
message: '500 - "Internal Server Error"',
error: 'Internal Server Error',
gekko web server error:
Error: non-error thrown: Child process has died.
at Object.onerror (/gekko/node_modules/koa/lib/context.js:105:40)
at process._tickCallback (internal/process/next_tick.js:109:7)
i have got following error when trying to run gekkoga using talib-macd rather than gekko nativemacd.
node run.js -c config/configd.js
Previous config found, loading...
Loaded previous config from configd-USD_BTC.json
Resuming previous run...
Starting training with: 4 units
{ StatusCodeError: 500 - "Internal Server Error"
at new StatusCodeError (/home/danns/gekkoga/node_modules/request-promise-core/lib/errors.js:32:15)
at Request.plumbing.callback (/home/danns/gekkoga/node_modules/request-promise-core/lib/plumbing.js:104:33)
at Request.RP$callback [as _callback] (/home/danns/gekkoga/node_modules/request-promise-core/lib/plumbing.js:46:31)
at Request.self.callback (/home/danns/gekkoga/node_modules/request/request.js:186:22)
at Request.emit (events.js:159:13)
at Request. (/home/danns/gekkoga/node_modules/request/request.js:1163:10)
at Request.emit (events.js:159:13)
at IncomingMessage. (/home/danns/gekkoga/node_modules/request/request.js:1085:12)
at Object.onceWrapper (events.js:254:19)
at IncomingMessage.emit (events.js:164:20)
at endReadableNT (_stream_readable.js:1062:12)
at process._tickCallback (internal/process/next_tick.js:152:19)
name: 'StatusCodeError',
statusCode: 500,
message: '500 - "Internal Server Error"',
error: 'Internal Server Error',
options:
{ url: 'http://localhost:3000/api/backtest',
json: true,
body: { gekkoConfig: [Object], data: [Object] },
headers: { 'Content-Type': 'application/json' },
timeout: 900000,
method: 'POST',
callback: [Function: RP$callback],
transform: undefined,
simple: true,
resolveWithFullResponse: false,
transform2xxOnly: false },
response:
IncomingMessage {
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: [BufferList],
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: false,
domain: null,
_events:
{ end: [Array],
close: [Array],
data: [Function],
error: [Function] },
_eventsCount: 4,
_maxListeners: undefined,
socket:
Socket {
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'localhost',
_readableState: [ReadableState],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 9,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 979,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [ClientRequest],
read: [Function],
_consuming: true,
_idleTimeout: -1,
_idleNext: null,
_idlePrev: null,
_idleStart: 13637,
_destroyed: false,
[Symbol(asyncId)]: 24,
[Symbol(bytesRead)]: 176,
[Symbol(asyncId)]: 59,
[Symbol(triggerAsyncId)]: 53 },
connection:
Socket {
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'localhost',
_readableState: [ReadableState],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 9,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 979,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [ClientRequest],
read: [Function],
_consuming: true,
_idleTimeout: -1,
_idleNext: null,
_idlePrev: null,
_idleStart: 13637,
_destroyed: false,
[Symbol(asyncId)]: 24,
[Symbol(bytesRead)]: 176,
[Symbol(asyncId)]: 59,
[Symbol(triggerAsyncId)]: 53 },
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers:
{ 'content-type': 'text/plain; charset=utf-8',
'content-length': '21',
date: 'Sat, 30 Dec 2017 12:42:17 GMT',
connection: 'close' },
rawHeaders:
[ 'Content-Type',
'text/plain; charset=utf-8',
'Content-Length',
'21',
'Date',
'Sat, 30 Dec 2017 12:42:17 GMT',
'Connection',
'close' ],
trailers: {},
rawTrailers: [],
upgrade: false,
url: '',
method: null,
statusCode: 500,
statusMessage: 'Internal Server Error',
client:
Socket {
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'localhost',
_readableState: [ReadableState],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 9,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 979,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [ClientRequest],
read: [Function],
_consuming: true,
_idleTimeout: -1,
_idleNext: null,
_idlePrev: null,
_idleStart: 13637,
_destroyed: false,
[Symbol(asyncId)]: 24,
[Symbol(bytesRead)]: 176,
[Symbol(asyncId)]: 59,
[Symbol(triggerAsyncId)]: 53 },
_consuming: true,
_dumped: false,
req:
ClientRequest {
domain: null,
_events: [Object],
_eventsCount: 6,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
upgrading: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Socket],
connection: [Socket],
_header: 'POST /api/backtest HTTP/1.1\r\nContent-Type: application/json\r\nhost: localhost:3000\r\naccept: application/json\r\ncontent-length: 828\r\nConnection: close\r\n\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
timeout: undefined,
method: 'POST',
path: '/api/backtest',
_ended: true,
res: [Circular],
aborted: undefined,
timeoutCb: [Function: emitTimeout],
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
[Symbol(outHeadersKey)]: [Object] },
request:
Request {
domain: null,
_events: [Object],
_eventsCount: 5,
_maxListeners: undefined,
body: '{"gekkoConfig":{"watch":{"exchange":"bitfinex","currency":"USD","asset":"BTC"},"paperTrader":{"slippage":0.05,"feeTaker":0.25,"feeMaker":0.25,"feeUsing":"taker","simulationBalance":{"asset":1,"currency":100},"reportRoundtrips":true,"enabled":true},"writer":{"enabled":false,"logpath":""},"tradingAdvisor":{"enabled":true,"method":"talib-macdori","candleSize":15,"historySize":66},"trader":{"enabled":false},"backtest":{"daterange":{"from":"2017-07-05 11:58","to":"2017-09-06 01:58"}},"performanceAnalyzer":{"riskFreeReturn":5,"enabled":true},"valid":true,"talib-macdori":{"historySize":66,"optInFastPeriod":5,"optInSlowPeriod":22,"optInSignalPeriod":22,"thresholds":{"up":"13.69","down":"-2.63"},"candleSize":15}},"data":{"candleProps":["close","start"],"indicatorResults":false,"report":true,"roundtrips":false,"trades":false}}',
headers: [Object],
timeout: 900000,
method: 'POST',
readable: true,
writable: true,
explicitMethod: true,
_qs: [Querystring],
_auth: [Auth],
_oauth: [OAuth],
_multipart: [Multipart],
_redirect: [Redirect],
_tunnel: [Tunnel],
_rp_resolve: [Function],
_rp_reject: [Function],
_rp_promise: [Promise],
_rp_callbackOrig: undefined,
callback: [Function],
_rp_options: [Object],
setHeader: [Function],
hasHeader: [Function],
getHeader: [Function],
removeHeader: [Function],
localAddress: undefined,
pool: {},
dests: [],
__isRequestRequest: true,
_callback: [Function: RP$callback],
uri: [Url],
proxy: null,
tunnel: false,
setHost: true,
originalCookieHeader: undefined,
_disableCookies: true,
_jar: undefined,
port: '3000',
host: 'localhost',
path: '/api/backtest',
_json: true,
httpModule: [Object],
agentClass: [Function],
agent: [Agent],
_started: true,
href: 'http://localhost:3000/api/backtest',
req: [ClientRequest],
ntick: true,
timeoutTimer: null,
response: [Circular],
originalHost: 'localhost:3000',
originalHostHeaderName: 'host',
responseContent: [Circular],
_destdata: true,
_ended: true,
_callbackCalled: true },
toJSON: [Function: responseToJSON],
caseless: Caseless { dict: [Object] },
read: [Function],
body: 'Internal Server Error' } }
danns@danns-VirtualBox:~/gekkoga$
i also got another error in terminal1 which running gekko ui as follows :
node gekko --config config.js --backtest --ui
______ ________ __ __ __ __ ______
/ \ / |/ | / |/ | / | /
/$$$$$$ |$$$$$$$$/ $$ | /$$/ $$ | /$$/ /$$$$$$ |
$$ | $$/ $$ |_ $$ |/$$/ $$ |/$$/ $$ | $$ |
$$ |/ |$$ | $$$$< $$ $$< $$ | $$ |
$$ |$$$$ |$$$$$/ $$$$$ \ $$$$$ \ $$ | $$ |
$$ _$$ |$$ |_____ $$ |$$ \ $$ |$$ \ $$ _$$ |
$$$$/ $$ |$$ | $$ |$$ | $$ |$$ $$/
$$$$$$/ $$$$$$$$/$$/ $$ /$$/ $$ / $$$$$$/Gekko v0.5.11
I'm gonna make you rich, Bud Fox.Serving Gekko UI on http://localhost:3000/
<-- POST /api/backtest
<-- POST /api/backtest
<-- POST /api/backtest
<-- POST /api/backtest
2017-12-30 19:42:15 (INFO): Setting up Gekko in backtest mode
2017-12-30 19:42:15 (INFO):
2017-12-30 19:42:15 (INFO): Setting up:
2017-12-30 19:42:15 (INFO): Trading Advisor
2017-12-30 19:42:15 (INFO): Calculate trading advice
2017-12-30 19:42:16 (INFO): Setting up Gekko in backtest mode
2017-12-30 19:42:16 (INFO):
2017-12-30 19:42:16 (INFO): Setting up:
2017-12-30 19:42:16 (INFO): Trading Advisor
2017-12-30 19:42:16 (INFO): Calculate trading advice
2017-12-30 19:42:16 (INFO): Using the strategy: talib-macdori
2017-12-30 19:42:16 (INFO): Setting up Gekko in backtest mode
2017-12-30 19:42:16 (INFO): Setting up Gekko in backtest mode
2017-12-30 19:42:16 (INFO):
2017-12-30 19:42:16 (INFO):
2017-12-30 19:42:16 (INFO): Setting up:
2017-12-30 19:42:16 (INFO): Trading Advisor
2017-12-30 19:42:16 (INFO): Calculate trading advice
2017-12-30 19:42:16 (INFO): Setting up:
2017-12-30 19:42:16 (INFO): Trading Advisor
2017-12-30 19:42:16 (INFO): Calculate trading advice
2017-12-30 19:42:16 (INFO): Using the strategy: talib-macdori
2017-12-30 19:42:16 (WARN): TULIP indicators could not be loaded, they will be unavailable.
2017-12-30 19:42:17 (INFO): Using the strategy: talib-macdori
2017-12-30 19:42:17 (INFO): Using the strategy: talib-macdori
2017-12-30 19:42:17 (WARN): TULIP indicators could not be loaded, they will be unavailable./home/danns/gekko/core/talib.js:40
throw talibError + methodName + ' requires ' + paramName + '.';
^
Gekko was unable to configure talib indicator:
macd requires optInFastPeriod.
xxx POST /api/backtest 500 7,206ms -Error: non-error thrown: Child process has died.
at Object.onerror (/home/danns/gekko/node_modules/koa/lib/context.js:105:40)
at
at process._tickCallback (internal/process/next_tick.js:160:7)/home/danns/gekko/core/talib.js:40
throw talibError + methodName + ' requires ' + paramName + '.';
^
Gekko was unable to configure talib indicator:
macd requires optInFastPeriod.
2017-12-30 19:42:17 (WARN): TULIP indicators could not be loaded, they will be unavailable.
2017-12-30 19:42:17 (WARN): TULIP indicators could not be loaded, they will be unavailable.
xxx POST /api/backtest 500 7,544ms -Error: non-error thrown: Child process has died.
at Object.onerror (/home/danns/gekko/node_modules/koa/lib/context.js:105:40)
at
at process._tickCallback (internal/process/next_tick.js:160:7)/home/danns/gekko/core/talib.js:40
throw talibError + methodName + ' requires ' + paramName + '.';
^
Gekko was unable to configure talib indicator:
macd requires optInFastPeriod./home/danns/gekko/core/talib.js:40
throw talibError + methodName + ' requires ' + paramName + '.';
^
Gekko was unable to configure talib indicator:
macd requires optInFastPeriod.
xxx POST /api/backtest 500 7,652ms -Error: non-error thrown: Child process has died.
at Object.onerror (/home/danns/gekko/node_modules/koa/lib/context.js:105:40)
at
at process._tickCallback (internal/process/next_tick.js:160:7)xxx POST /api/backtest 500 7,585ms -
Error: non-error thrown: Child process has died.
at Object.onerror (/home/danns/gekko/node_modules/koa/lib/context.js:105:40)
at
at process._tickCallback (internal/process/next_tick.js:160:7)
although error in terminal1 indicates that something wrong with my params definition, actually everything works fine when i running 'node gekko --config config.js --backtest'.
no error generated with message 'Gekko was unable to configure talib indicator'.
why is there any differences?has it something todo with how gekkoga connect to gekko config?
i have also defined params value for macd i gekko's config.
Hello, what is everyone's thoughts on adding a Walk Forward analysis option to GekkoGA to help manage overfitting strategies to in-sample data? This could help automate cross-validation of the epoch on out-of-sample data.
"A properly fit and robust trading strategy should achieve out-of-sample performance at levels similar to those achieved in-sample. A trading strategy is likely overfit if it has a low Walk-Forward Efficiency; in other words, if the rate of return of out-of-sample trading is decidedly lower than that of in-sample trading."
If the config file included a secondary "walk forward date range", then for each epoch GekkoGA would run a second backtest against the "walk forward" date range too. Then, GekkoGA would provide an additional 2 metrics to every epoch result that measures the epoch's out-of-sample robustness:
Config file would perhaps have an optional "walk_forward_daterange", like this:
const config = {
gekkoConfig: {
watch: {
exchange: 'poloniex',
currency: 'USDT',
asset: 'BTC'
},
daterange: {
from: '2017-10-12 00:00',
to: '2017-11-21 11:16'
},
// optional walk forward analysis
walk_forward_daterange: {
from: '2017-11-22 00:00',
to: '2017-12-22 11:16'
},
What's everyones thoughts?
If possible please consider adding Sharpe Ratio as a mainObjective.
// profit || score || sharpeRatio
mainObjective: 'sharpeRatio',
Thanks
Any way to make it work with RSI? constantly get zero trades, even with the sample-config it nets zero trades everytime...
When gekkoga is used on a strategy with nested parameters like the example below, the mutation and crossover only count the top level keys in the properties object.
getProperties: () => {
historySize: randomExt.integer(5,0),
candleSize: randomExt.integer(5,1),
parameters:{
optInTimePeriod: randomExt.integer(10,2),
optInFastPeriod: randomExt.integer(5,1),
optInSlowPeriod: randomExt.integer(15,6),
optInSignalPeriod: randomExt.float(100,2),
},
thresholds:{
up: randomExt.float(100,0),
down: randomExt.float(100,0),
macd_up: randomExt.float(100,0),
macd_down: randomExt.float(0,-100),
},
}
This will only count 4 keys: historySize, candleSize, parameters, thresholds. There are 10 random params, so I set mutateElements: 10. Checking the code in crossover() and mutate(), they both do this:
// mutate
let allProps = Object.keys(a);
// crossover
let len = Object.keys(a).length;
My solution was to change the gekko strategies.js files to just accept flat settings, while also using this in my gekkoga config now. This natively works with mutateElements: 10:
getProperties: () => {
historySize: randomExt.integer(5,0),
candleSize: randomExt.integer(5,1),
optInTimePeriod: randomExt.integer(10,2),
optInFastPeriod: randomExt.integer(5,1),
optInSlowPeriod: randomExt.integer(15,6),
optInSignalPeriod: randomExt.float(100,2),
up: randomExt.float(100,0),
down: randomExt.float(100,0),
macd_up: randomExt.float(100,0),
macd_down: randomExt.float(0,-100),
}
Hi,
First of all, thank you very much for this tool ! ๐
Is it possible to add to gekkoga the capability to save all the backtests it performs ? (e.g., in a csv file)
The interesting information would be something like:
Thank you very much !
Xavier
It would be awesome if the app would test a single strategy configuration against multiple smaller date ranges within a larger data set.
For example your larger date range is all of 2017. When the test starts it would randomly pick X amount of date ranges and run each configuration test against the same set of date ranges to find the best overall results.
Possible new config options:
numberOfDateRanges = X // the number of random date ranges per test cycle. possibly determined dynamically.
dateRangeLength = [1 month, 2 months, 2 weeks, etc] // length of the random date ranges. value could not be greater than larger range
.
This would help reduce curve fitting.
What units are used for all the parameters?
History/candle size in minutes?
Balance/startprice/endprice in USD?
I want to backtest my results from gekkoga in gekko itself, and I can't get it to work.
Kind regards
Hello,
I am trying to import data into Gekko but I can't seem to file the script to convert the JSON to a sqlite db file. I'd really appreciate anyone's help!
Hi! I noticed that when a run has net negative fitness sum, negative profits are assigned high fitness.
The problem is this line in index.js:
selectionProb[j] = populationProfits[j] / fitnessSum;
Example: population with two members that have profits of -1 and -2:
-1 / -3 = 0.333
-2 / -3 = 0.667
I changed mine to read:
if (populationProfits[j] > 0) {
selectionProb[j] = populationProfits[j] / fitnessSum;
}
else {
selectionProb[j] = 1 / (populationProfits[j] * fitnessSum);
}
Additionally, the "best performer" is chosen wrong when negative profits are involved.
let maxFitness = [0, 0, 0, 0];
if (populationProfits[i] > maxFitness[0]) {
// Store the top performer
maxFitness = [populationProfits[i], populationSharpes[i], populationScores[i], i];
}
My quick fix is to make this change:
let maxFitness = [-1000, 0, 0, 0];
Thanks!
What do these outputs exactly mean in context to each other?
relativeProfit: 194.30317355494043, yearlyProfit: '48315.58376075', relativeYearlyProfit: '1030.38514508',
and
max profit position: 0
See here for details: I am doing some updates to the backtest API (in 0.6), see this thread for more info: https://forum.gekko.wizb.it/thread-56603.html
Very open for discussion on how we can make the backtester as fast as possible!
I'm interested in optimizing the sharpe ratio, or weighing sharpe optimization against profit. Seems like this would be a useful feature.
Hi there,
I have a bunch of general questions to this project and I hope someone can answer them all. I hope this is the right place for such questions.
How exactly am I supposed to make use of gekkoga? Should I use it to run backtests to find out the best parameters for a strategy? After X epochs I have good enough parameters which I should use then in gekko itself? Is this assumption correct? Or can I also let gekkoga do the live trading with real values?
What exactly happens within one epoche? Does it run through the whole duration of your backdata (in my case the last 3 months of bitcoin history)?
Kind regards
Hey Guys,
My gekko version 0.6 & gekkoga is the latest stable version - as of date.
When i run, i am following errors :
Gekko :
uncaughtException TypeError: Cannot read property 'exchange' of undefined
at Object.<anonymous> (/Users/CryptoCoeus/gekko-geneticAlgo/plugins/sqlite/handle.js:28:27)
gekkoga :
No previous run data, starting from scratch! Starting GA with epoch populations of 20, running 5 units at a time! { StatusCodeError: 500 - "Internal Server Error"
Does anybody have any idea what is wrong ?
Hello,
Is there a way to configure paper trader? It would be really handy for sims that trade often.
Correct in the sample the macd long short signal are hard coded.. So it's only doing candles thresholds and history size.
You reminded me.. I'm going to move the timeout setting into the config. Keep in mind when this happens it will break configs.. So keep an eye out for commits where Sample-config.js has new stuff added to it.. Because you will need to add them to your config in the event you update
putting this here so it doesnt mix with thread #2
what do you mean by "it will break configs" ?
about the hard coded long short signal, i guess i just have to add 'randomExt' function to "short", and to ajust "long" with something like long: short + randomExt ?
First of all, thank you for this great repo.
I started tinkering with different GA's for different indicators and I would like to contribute to this project. This is kind of a noob question, but I'm unable to figure out how to debug your code. Putting breakpoints / a debugger; or tweaking with launch/attach to process in vs code didn't really work out. I'd appreciate if you could point me in the right direction. Thanks.
The idea of this project is awesome. But I am not sure if it is successful or not because the output is not easy to interpret. There are many open questions about it.
For example:
What exactly is the Global maximum section? Why does the content change with every epoche? Why is my profit, relativeProfit, yearlyProfit, relativeYearlyProfit with every epoche the very same?
I really like about gekko, that you can easily see how much profit in % you made when you backtest. Would be great if you could implement that with your GA approach.
I think it would help if we had a general detailed explanation of every single point of the output. I am very thankful that you guys created this and I am of course in no position to ask you guys to give even more than you already did. But I would be very thankful for a documentation.
Kind regards
Any Idea What's wrong here?
/home/oikonen/gekko/gekkoga/config/RSIMACD.js:73
candleSize: config.candleValues[randomExt.integer(config.candleValues.length -1, 0)]
^^^^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/oikonen/gekko/gekkoga/run.js:16:16)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
Here is my config
candleValues: [5,10,15,30,60], //,120,240],
getProperties: () => ({
// Strat settings must be flattened and cannot be nested for mutation to work properly!
historySize: randomExt.integer(100, 10),
interval: randomExt.integer(8, 1),
short: randomExt.integer(15, 5),
long: randomExt.integer(30, 15),
signal:randomExt.integer(12, 4),
up: randomExt.float(0.0002, 0).toFixed(5),
down: randomExt.float(0, -0.0002).toFixed(5),
low: randomExt.integer(30, 5),
high: randomExt.integer(80, 60),
persistence: randomExt.integer(10, 0)
candleSize: config.candleValues[randomExt.integer(config.candleValues.length -1, 0)]
})
};
While trying some different strategies I found that there is no stratName in the result file.
So there is no way to find the strategie in older files.
Also the daterange is missing.
I've installed the latest version of gekko, imported some data and can run a backtest on it. But when I try gekkoga I get the following error:
No previous run data, starting from scratch!
Starting GA with epoch populations of 20, running 5 units at a time!
{ StatusCodeError: 500 - "Internal Server Error"
at new StatusCodeError (/Users/jimmy/Sites/gekko/gekkoga/node_modules/request-promise-core/lib/errors.js:32:15)
at Request.plumbing.callback (/Users/jimmy/Sites/gekko/gekkoga/node_modules/request-promise-core/lib/plumbing.js:104:33)
at Request.RP$callback [as _callback] (/Users/jimmy/Sites/gekko/gekkoga/node_modules/request-promise-core/lib/plumbing.js:46:31)
at Request.self.callback (/Users/jimmy/Sites/gekko/gekkoga/node_modules/request/request.js:186:22)
at Request.emit (events.js:160:13)
at Request.<anonymous> (/Users/jimmy/Sites/gekko/gekkoga/node_modules/request/request.js:1163:10)
at Request.emit (events.js:160:13)
at IncomingMessage.<anonymous> (/Users/jimmy/Sites/gekko/gekkoga/node_modules/request/request.js:1085:12)
at Object.onceWrapper (events.js:255:19)
at IncomingMessage.emit (events.js:165:20)
at endReadableNT (_stream_readable.js:1101:12)
at process._tickCallback (internal/process/next_tick.js:152:19)
name: 'StatusCodeError',
statusCode: 500,
message: '500 - "Internal Server Error"',
error: 'Internal Server Error',
options:
{ url: 'http://192.168.1.4:3002/api/backtest',
json: true,
body: { gekkoConfig: [Object], data: [Object] },
headers: { 'Content-Type': 'application/json' },
timeout: 1200000,
method: 'POST',
callback: [Function: RP$callback],
transform: undefined,
simple: true,
resolveWithFullResponse: false,
transform2xxOnly: false },
response:
IncomingMessage {
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: [BufferList],
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: false,
domain: null,
_events:
{ end: [Array],
close: [Array],
data: [Function],
error: [Function] },
_eventsCount: 4,
_maxListeners: undefined,
socket:
Socket {
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: null,
_readableState: [ReadableState],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 9,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 958,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [ClientRequest],
read: [Function],
_consuming: true,
_idleTimeout: -1,
_idleNext: null,
_idlePrev: null,
_idleStart: 1009,
_destroyed: false,
[Symbol(asyncId)]: 19,
[Symbol(bytesRead)]: 176,
[Symbol(asyncId)]: 62,
[Symbol(triggerAsyncId)]: 34 },
connection:
Socket {
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: null,
_readableState: [ReadableState],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 9,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 958,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [ClientRequest],
read: [Function],
_consuming: true,
_idleTimeout: -1,
_idleNext: null,
_idlePrev: null,
_idleStart: 1009,
_destroyed: false,
[Symbol(asyncId)]: 19,
[Symbol(bytesRead)]: 176,
[Symbol(asyncId)]: 62,
[Symbol(triggerAsyncId)]: 34 },
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers:
{ 'content-type': 'text/plain; charset=utf-8',
'content-length': '21',
date: 'Fri, 19 Jan 2018 13:20:49 GMT',
connection: 'close' },
rawHeaders:
[ 'Content-Type',
'text/plain; charset=utf-8',
'Content-Length',
'21',
'Date',
'Fri, 19 Jan 2018 13:20:49 GMT',
'Connection',
'close' ],
trailers: {},
rawTrailers: [],
upgrade: false,
url: '',
method: null,
statusCode: 500,
statusMessage: 'Internal Server Error',
client:
Socket {
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: null,
_readableState: [ReadableState],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 9,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 958,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [ClientRequest],
read: [Function],
_consuming: true,
_idleTimeout: -1,
_idleNext: null,
_idlePrev: null,
_idleStart: 1009,
_destroyed: false,
[Symbol(asyncId)]: 19,
[Symbol(bytesRead)]: 176,
[Symbol(asyncId)]: 62,
[Symbol(triggerAsyncId)]: 34 },
_consuming: true,
_dumped: false,
req:
ClientRequest {
domain: null,
_events: [Object],
_eventsCount: 6,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
upgrading: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Socket],
connection: [Socket],
_header: 'POST /api/backtest HTTP/1.1\r\nContent-Type: application/json\r\nhost: 192.168.1.4:3002\r\naccept: application/json\r\ncontent-length: 805\r\nConnection: close\r\n\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
timeout: undefined,
method: 'POST',
path: '/api/backtest',
_ended: true,
res: [Circular],
aborted: undefined,
timeoutCb: [Function: emitTimeout],
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
[Symbol(outHeadersKey)]: [Object] },
request:
Request {
domain: null,
_events: [Object],
_eventsCount: 5,
_maxListeners: undefined,
body: '{"gekkoConfig":{"watch":{"exchange":"poloniex","currency":"USDT","asset":"BTC"},"paperTrader":{"slippage":0.05,"feeTaker":0.25,"feeMaker":0.15,"feeUsing":"taker","simulationBalance":{"asset":1,"currency":1},"reportRoundtrips":true,"enabled":true},"writer":{"enabled":false,"logpath":""},"tradingAdvisor":{"enabled":true,"method":"custom_macd","candleSize":240,"historySize":60},"trader":{"enabled":false},"backtest":{"daterange":{"from":"2018-01-18 00:00","to":"2018-01-18 23:58"}},"performanceAnalyzer":{"riskFreeReturn":5,"enabled":true},"valid":true,"custom_macd":{"historySize":60,"macd_short":15,"macd_long":21,"macd_signal":12,"macd_up":"10.51","macd_down":"-18.79","candleSize":240}},"data":{"candleProps":["close","start"],"indicatorResults":false,"report":true,"roundtrips":false,"trades":false}}',
headers: [Object],
timeout: 1200000,
method: 'POST',
readable: true,
writable: true,
explicitMethod: true,
_qs: [Querystring],
_auth: [Auth],
_oauth: [OAuth],
_multipart: [Multipart],
_redirect: [Redirect],
_tunnel: [Tunnel],
_rp_resolve: [Function],
_rp_reject: [Function],
_rp_promise: [Promise],
_rp_callbackOrig: undefined,
callback: [Function],
_rp_options: [Object],
setHeader: [Function],
hasHeader: [Function],
getHeader: [Function],
removeHeader: [Function],
localAddress: undefined,
pool: {},
dests: [],
__isRequestRequest: true,
_callback: [Function: RP$callback],
uri: [Url],
proxy: null,
tunnel: false,
setHost: true,
originalCookieHeader: undefined,
_disableCookies: true,
_jar: undefined,
port: '3002',
host: '192.168.1.4',
path: '/api/backtest',
_json: true,
httpModule: [Object],
agentClass: [Function],
agent: [Agent],
_started: true,
href: 'http://192.168.1.4:3002/api/backtest',
req: [ClientRequest],
ntick: true,
timeoutTimer: null,
response: [Circular],
originalHost: '192.168.1.4:3002',
originalHostHeaderName: 'host',
responseContent: [Circular],
_destdata: true,
_ended: true,
_callbackCalled: true },
toJSON: [Function: responseToJSON],
caseless: Caseless { dict: [Object] },
read: [Function],
body: 'Internal Server Error' } }
The same error 500 "Internal Server Error" everyone's getting.
It's clearly running fine in the ui - https://pastebin.com/raw/3rJxqC0t with no errors that I can see anywhere.
Yet gekkoga still falls on its face.
I'm using strat NEO..
Runs well in Gekko UI but get the follow error in gekkoga.. Not sure if it's user error or bug..
The Talib error get thrown also when run successfully in gekko ui.. " TALIB indicators could not be loaded, they will be unavailable."
Which makes me think this is not my issue.
So Seems like it's specifically not passing a value to gekko params throw tulindError + paramName + ' needs to be a number';
Would really appreciate some help.
Config is
Error :
err.txt
I have email notifications enabled for new all time highs, but I keep getting notifications about ATHs that are worse than running the default values specified in the .toml. It would be nice if Gekkoga ran the defaults first and only notified me if it managed to do better than that result.
Anyone knows why node run -c config/config.js is requesting data each second from gekko making the CPU on 100% ?
Is there any place we can change refresh interval or something like that ?
Hi,
It seems that gekkoga computes the yearlyProfit value with this formula:
yearlyProfit=profit * year_duration / backtest_duration
This formula is not correct.
I think the correct one is:
yearlyProfit (in %)=(end_balance/start_balance) ^(year_duration / backtest_duration) -1
Duration can be in days, hours or minutes, as you prefer.
Xavier
Am I missing something?
gekkoGA works great with the MACD example,
I'm having some issue where the backtest is returning sharpe: null
and also, max globals are an empty object since they don't pass the sharpe condition,
down the rabbit hole I see the performanceAnalyzer uses stdev on this.roundTrips.map(r=> r.profit), which in the MACD case is an array of multiple values, and in this other strat its mostly an empty array and sometimes an array with a single number in it.. tried to fix and dig for an answer but getting lost and thought maybe someone here faced this before? thanks
So I wanted to have one random number generated for the historySize
and for the min_predictions
(from neuralnet strategy).
I tried it with
predictions: [randomExt.integer(240, 1)]
getProperties: () => ({
min_predictions: randomExt.pick(config.predictions)
historySize: randomExt.pick(config.predictions)
})
It didn't work...
Both had the same random number but each epoch hat the same.
I think that the random number that is calculated ones stays the same for the whole time the config is executed.
Do one of you know a solution for my problem?
Thanks!
I've released gekko 0.6 which has some differences in the API. See the following links for details:
Getting error:
async loadBreakPoint() {
^^^^^^^^^^^^^^
SyntaxError: Unexpected identifier```
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.