New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make gekkoga great again! It works now with gekko v0.6 #49

Open
wants to merge 9 commits into
base: stable
from

Conversation

Projects
None yet
@valentinbercot
Copy link

valentinbercot commented Jul 19, 2018

Hi,

I've update gekkoga to make it works with gekko v0.6.

As askmike saids in #48 there are some changes in the gekko v0.6 API.

Hope this PR helps you, enjoy!

@ianhord

This comment has been minimized.

Copy link

ianhord commented Jul 23, 2018

Hi,
I have copied the new index.js file to a fresh install of gekko in windows bash. The long list of errors has gone, but it seems to hang. and then timeout error - any ideas?
Running the default strategy and configs with a little bit of data.
Config and hangup error below

=======================================================
No previous run data, starting from scratch!
Starting GA with epoch populations of 20, running 5 units at a time!
{ RequestError: Error: socket hang up
at new RequestError (/home/ianhord/gekko/gekkoga/node_modules/request-promise-core/lib/errors.js:14:15)
at Request.plumbing.callback (/home/ianhord/gekko/gekkoga/node_modules/request-promise-core/lib/plumbing.js:87:29)
at Request.RP$callback [as _callback] (/home/ianhord/gekko/gekkoga/node_modules/request-promise-core/lib/plumbing.js:46:31)
at self.callback (/home/ianhord/gekko/gekkoga/node_modules/request/request.js:185:22)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at Request.onRequestError (/home/ianhord/gekko/gekkoga/node_modules/request/request.js:877: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:1064: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:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9) code: 'ECONNRESET' },
error: { 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:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9) code: 'ECONNRESET' },
options:
{ url: 'http://localhost:3000/api/backtest',
json: true,
body:
{ watch: [Object],
paperTrader: [Object],
writer: [Object],
tradingAdvisor: [Object],
trader: [Object],
backtest: [Object],
performanceAnalyzer: [Object],
valid: true,
data: [Object],
MACD: [Object] },
headers: { 'Content-Type': 'application/json' },
timeout: 1200000,
method: 'POST',
callback: [Function: RP$callback],
transform: undefined,
simple: true,
resolveWithFullResponse: false,
transform2xxOnly: false },
response: undefined }
=================================== here is the strat
const randomExt = require('random-ext');

const config = {
stratName: 'MACD',
gekkoConfig: {
watch: {
exchange: 'poloniex',
currency: 'USDT',
asset: 'BTC'
},

// daterange: 'scan',

daterange: {
  from: '2018-04-24 00:00',
  to: '2018-04-29 00:00'
},

simulationBalance: {
  'asset': 1,
  'currency': 1
},

slippage: 0.05,
feeTaker: 0.25,
feeMaker: 0.15,
feeUsing: 'taker', // maker || taker

},
apiUrl: 'http://localhost:3000',

// Population size, better reduce this for larger data
populationAmt: 20,

// How many completely new units will be added to the population (populationAmt * variation must be a whole number!!)
variation: 0.5,

// How many components maximum to mutate at once
mutateElements: 7,

// How many parallel queries to run at once
parallelqueries: 5,

// profit || score
// score = ideas? feedback?
// profit = recommended!
mainObjective: 'profit',

// optionally recieve and archive new all time high every new all time high
notifications: {
email: {
enabled: false,
receiver: 'destination@some.com',
senderservice: 'gmail',
sender: 'origin@gmail.com',
senderpass: 'password',
},
},

candleValues: [5,10,15,30,60,120,240],
getProperties: () => ({

historySize: randomExt.integer(100, 20),

short: randomExt.integer(15,5),
long: randomExt.integer(40,15),
signal: randomExt.integer(12,6),

thresholds: {
  up: randomExt.float(20,0).toFixed(2),
  down: randomExt.float(0,-20).toFixed(2),
  persistence: randomExt.integer(9,0),
},

candleSize: randomExt.pick(config.candleValues)

})
};

module.exports = config;

@battlezone100

This comment has been minimized.

Copy link

battlezone100 commented Jul 23, 2018

Thank you for this PR. I copied over the changes but I am getting no results when running the algorithm. it keeps saying all global maximum values are -5. When I enter the values of a random epoch into the backtester on the UI, I do get results. I don't know if this has anything to do with gekkoga, your modifications or gekko itself.

@valentinbercot

This comment has been minimized.

Copy link

valentinbercot commented Jul 23, 2018

Hi,

I got the same result as you @battlezone100, I fixed the issue about new request format of POST /api/backtest but didn't do anything about parsing the response.

https://gekko.wizb.it/docs/internals/server_api.html#POST-api-backtest

I think that some changed should be add in the fitnessApi() method for that.

Have you any idea of previous response format of POST /api/backtest ?

@battlezone

This comment has been minimized.

Copy link

battlezone commented Jul 24, 2018

I don't get what you mean, but I'm willing to help. I have an old installation of Gekko with GekkoGA somewhere so if you need me to run some tests then let me know.

If you do manage to solve this issue, please let me know.

@askmike askmike referenced this pull request Jul 25, 2018

Open

update for gekko 0.6 #48

@ianhord
Copy link

ianhord left a comment

I have tested these changes on a clean install of gekko v0.6 on ubuntu and have it working. Thanks @valentinbercot for your efforts. Like you mentioned Gekko is not logging the buy and sell trades on the other console.
I am not a node programmer so suggest someone more experienced review and approve. Maybe we can also get a solution for the logging of the buy and sell to help us see the algos working on Gekko.

@TeoWay

This comment has been minimized.

Copy link

TeoWay commented Aug 7, 2018

Hi. I'm trying to launch gekkoga on windows 10. I use stable, clean installed version of Gekko and rewrites my index.js and sample-config.js by files from this pull request.

But I get errors, similar like with ianhord was have. This From 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"
    at new StatusCodeError (G:\OSPanel\domains\gekkoga\node_modules\request-promise-core\lib\errors.js:32:15)
    at Request.plumbing.callback (G:\OSPanel\domains\gekkoga\node_modules\request-promise-core\lib\plumbing.js:104:33)
    at Request.RP$callback [as _callback] (G:\OSPanel\domains\gekkoga\node_modules\request-promise-core\lib\plumbing.js:46:31)
    at Request.self.callback (G:\OSPanel\domains\gekkoga\node_modules\request\request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (G:\OSPanel\domains\gekkoga\node_modules\request\request.js:1157:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (G:\OSPanel\domains\gekkoga\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,
        MACD: [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: 997,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: null,
        _server: null,
        parser: null,
        _httpMessage: [Object],
        _idleTimeout: -1,
        _idleNext: null,
        _idlePrev: null,
        _idleStart: 937,
        _destroyed: false,
        [Symbol(asyncId)]: 19,
        [Symbol(bytesRead)]: 176,
        [Symbol(asyncId)]: 62,
        [Symbol(triggerAsyncId)]: 55 },
     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: 997,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: null,
        _server: null,
        parser: null,
        _httpMessage: [Object],
        _idleTimeout: -1,
        _idleNext: null,
        _idlePrev: null,
        _idleStart: 937,
        _destroyed: false,
        [Symbol(asyncId)]: 19,
        [Symbol(bytesRead)]: 176,
        [Symbol(asyncId)]: 62,
        [Symbol(triggerAsyncId)]: 55 },
     httpVersionMajor: 1,
     httpVersionMinor: 1,
     httpVersion: '1.1',
     complete: true,
...

This From Gekko

 <-- POST /api/backtest
  <-- POST /api/backtest
  <-- POST /api/backtest
  <-- POST /api/backtest
  <-- POST /api/backtest
  xxx POST /api/backtest 500 435ms -

  Error: non-error thrown:
  This Gekko instance encountered an error and can't continue
      at Object.onerror (G:\OSPanel\domains\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 440ms -

  Error: non-error thrown:
  This Gekko instance encountered an error and can't continue
      at Object.onerror (G:\OSPanel\domains\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 464ms -
...

Can you help? I'm just not good enough in JS for now.

@jxxxst

This comment has been minimized.

Copy link

jxxxst commented Sep 1, 2018

@TeoWay I had the same issue, this fixed it for me askmike/gekko#1527 (comment)
I am on Mac though.

@kenwi

kenwi approved these changes Sep 5, 2018

Copy link

kenwi left a comment

This works for me as well.

Applied locally:

git fetch origin pull/49/head:49
checkout 49
@aketekt

aketekt approved these changes Sep 9, 2018

Copy link

aketekt left a comment

Have tested with MACD and NEO and is working

git fetch origin pull/49/head:49

git checkout 49

And thank you kind sir @kenwi :)

@Borrismorris

This comment has been minimized.

Copy link

Borrismorris commented Sep 14, 2018

I have this running and seems to work fine with the MACD strat and any other strat. Using my old parameters for the RSI BULL BEAR ADX strat it doesnt seem to work, Params:
historySize: 1300, // max possible SMA_long

SMA_long: randomExt.integer(27, 10) * 50, // From 1300 to 500 in steps of 50
SMA_short: randomExt.integer(60, 40),

BULL_RSI: randomExt.integer(13, 7),
BULL_RSI_high: randomExt.integer(85, 70),
BULL_RSI_low: randomExt.integer(65, 40),

BEAR_RSI: randomExt.integer(20, 10),
BEAR_RSI_high: randomExt.integer(60, 40),
BEAR_RSI_low: randomExt.integer(30, 10),

ADX: randomExt.integer(5, 2),
ADX_high: randomExt.integer(80, 60),
ADX_low: randomExt.integer(60, 40),

candleSize: config.candleValues[randomExt.integer(config.candleValues.length - 1, 0)]

Is there anyone that knows the new settings?

@DerBeweis

This comment has been minimized.

Copy link

DerBeweis commented Sep 19, 2018

I have an important Question for me.. It may be silly but I would love to have an answer... why did you add the profitForMinSharpe as an objective and why it is better?
and in general, I read more than one time that main objective "profit" is not the best to get a good combination and run it for live gekko, some says that score is better... can any one explain more about the logic here? I don't know a lot about generic algorithms and would love to understand gekkoGA more to use it in the right way..

thanks..

@sanitariu
Copy link

sanitariu left a comment

I tested RSI/TSI and its working as before

@ClemDelp

This comment has been minimized.

Copy link

ClemDelp commented Jan 20, 2019

Hello @valentinbercot thanks a lot for your work every call are now compatible with Gekko api :-) what about the response format? I always have a global maximum values = -5, same problem as @battlezone100 one. Did you guys fixed this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment