gekkowarez / gekkoga

Genetic Algorithm for solving optimization of trading strategies using Gekko
307 stars 106 forks source link

500 - "Internal Server Error" #50

Open 123qweas opened 5 years ago

123qweas commented 5 years ago

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(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)

amigoni commented 5 years ago

I have the same still trying to figure this out

CryptoCoeus commented 5 years ago

I am having the same, as well..

Any help ?

mizio85 commented 5 years ago

same issue

matthhong commented 5 years ago

This is the same issue as #53 except #53 is more specific.

matthhong commented 5 years ago

Just resolved #53, please refer to solution over there.

The POST requests from gekkoga are not compatible with gekko's backtest api.

Stefan-Stefan1 commented 4 years ago

Solved it by deleting the result. I dont know why but when the backtest is not not finding a better solution (score: -5, profit: -5, sharpe: -5) and i run the run.js again, it will break after the first run.