Gekko: Genetic Algorithm Implementation

Created on 8 Sep 2017  路  19Comments  路  Source: askmike/gekko

This is a simple genetic algorithm implementation for gekko.
More of an idea on how to implement GA on this bot.. actual info on readme.
Someone who actually knows about evolution methods should give a help ^^ results I already got with it are kinda ok.
https://github.com/Gab0/gekkoJaponicus

wontfix

Most helpful comment

@imkane
There is a missing comment closure around the date range selection config line.

@thegamecat The provided version doesn't report its profit unless gekkoConfig -> paperTrader -> reportInCurrency == true

Can confirm this works great though, great work !

All 19 comments

The Gekko API will spawn a new node instance for each backtest, allowing you to do as many in parallel as you want. They are pretty slow, but at least they scale linearly. I use a bunch of 32 core boxes and spawn 32 parallel backtests per endpoint from my GA. Definitely something you can play with.

Very cool stuff

haa so parallel backtesting just works this way... relevant changes have been made on the script.

@Gab0 What Python version this works with? Also can you add a requirements.txt for pip

Yes so gekko supports parallel backtesting.

@gweedobtc I use Python3.6; added requirements.txt there

@thegamecat Can you give some direction about GAs? Papers, modules.. Disclose secrets about your implementation : 3
Tonight I will work on a proper algorithm..

Also worth noting that there are plenty of excellent GA implementations in all major languages. Given you are just testing a range of float parameters you can likely use any of them without much work. e.g. https://github.com/DEAP/deap is popular for Python.

I use https://github.com/giacomelli/GeneticSharp with the FloatingPointChromosome with a c# client myself.

It is useful to pick a way to scale out the gekko database to a cluster to get reasonable performance. I just have a script that downloads the gekko folder with database to each VM when it is deployed, and in my GA client I spread the HTTP calls across the array of IP addresses of my Gekko instances.

Obviously a lot of money can be saved on compute with a more thoughtful bulk backtest API implementation on the Gekko side, but there is another thread for that and it was easier to just use more compute than help implement it right now :)

I've put my latest gekko node version up here for downloading:
http://gekkowarez.com/gekko-genetic-algorithm/

@thegamecat I try download it but that not full version. In the pack i cannot find run-ga-parallel-test-all.js

Ah, the page was incorrect - run-ga-parallel.js is the correct version.

Hey @thegamecat - thanks for sharing this :)

I'm getting an error at this step though:

[gekko]$ node run-ga-parallel.js
/home/gekko/run-ga-parallel.js:206
            "data": {
            ^^^^^^

SyntaxError: Unexpected string
    at createScript (vm.js:74:10)
    at Object.runInThisContext (vm.js:116:10)
    at Module._compile (module.js:537:28)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Function.Module.runMain (module.js:609:10)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:598:3

Any ideas?

@imkane

  1. git clone https://github.com/Gab0/gekkoJaponicus.git
  2. pip install deap requests numpy
  3. Than run gekko with the ui
  4. Finally cd into the cloned folder and python evolution.py

@krieghof I was referring to @thegamecat's node implementation here:
http://gekkowarez.com/gekko-genetic-algorithm/

Not the python one :)

@imkane can you move those questions to https://github.com/askmike/gekko/issues/1102

I think I'll get this up on it's own repo shortly.

Done :)

@imkane
There is a missing comment closure around the date range selection config line.

@thegamecat The provided version doesn't report its profit unless gekkoConfig -> paperTrader -> reportInCurrency == true

Can confirm this works great though, great work !

Thats brilliant thanks @mnoseworthy - I've updated the file.

Also the GA is now on github again in this repo: https://github.com/thegamecat/gekko-trading-stuff

Registration at http://gekkowarez.com/gekko-genetic-algorithm/ is not working. E-Mails will not be send out.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you feel this is very a important issue please reach out the maintainer of this project directly via e-mail: gekko at mvr dot me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chevinbrown picture chevinbrown  路  3Comments

yacindou picture yacindou  路  3Comments

patjk picture patjk  路  3Comments

clownfish44 picture clownfish44  路  3Comments

rcoenen picture rcoenen  路  3Comments