Gekko Trading bot installation

Gekko installation (Linux)

Installing gekko is quite simple, everything is described on its homepage, thanks to Mike von Rossum, Gekko’s creator & maintainer.

On a standard Linux distro (I use a small Debian VM on an Intel NUC running vSphere acting as a personal server at home):

Install nodejs:

sudo apt-get install nodejs

Install git:

sudo apt-get install git

Install Pm2 (not mandatory but I like to use it to keep track of my various Gekko’s instances running):

sudo npm install pm2 -g 

Download Gekko:

git clone git://github.com/askmike/gekko.git -b stable
cd gekko

Install Gekko’s dependancies (note: after installation, do NOT run npm audit with –force as suggested by npm, I can confirm it will break Gekko and you will have to redo previous operations):

npm install --only=production

Install Gekko’s broker module dependancies:

cd exchange
npm install --only=production && cd ..

Now, as I want to access Gekko’s UI from other computers in my home network, I need to configure a few things. Edit & change:

  • <your_gekko_install_dir>/web/vue/dist/UIconfig.js

api: {

host: ‘127.0.0.1‘,

port: 3000,

timeout: 120000 // 2 minutes

},

to

api: {

host: ‘0.0.0.0‘,

port: 3000,

timeout: 600000 // 10 minutes

},

and

ui: {

ssl: false,

host: ‘localhost‘,

port: 3000,

path: ‘/’

},

to

ui: {

ssl: false,

host: ‘x.x.x.x‘, // Set this to the IP of the machine that will run Gekko

port: 3000,

path: ‘/’

},

  • <your_gekko_install_dir>/web/vue/public/UIconfig.js and only change:

api: {

host: ‘127.0.0.1’,

port: 3000,

timeout: 120000 // 2 minutes

},

to

api: {

host: ‘127.0.0.1’,

port: 3000,

timeout: 600000 // 10 minutes

},

Hint: modifying the timeout is not in standard Gekko’s documentation. But it will be useful later.

As explained in standard Gekko’s configuration, this will allow you to access the Gekko UI by going to http://x.x.x.x:3000 in a web browser (of course change x.x.x.x with the IP of the machine that will run Gekko and that you defined in
<your_gekko_install_dir>/web/vue/dist/UIconfig.js as seen above).

Beware, Gekko is absolutely NOT secured. There is no authentication mecanisms in Gekko. This configuration should ONLY be activated in a trusted internal network. If you launch it this way on a computer/server reachable from Internet, especially on port 3000, then ANYONE can access your Gekko.

Now launch gekko UI:

node gekko --ui

On http://x.x.x.x:3000 you should see something like that. Congratulations you’ve just achieved the easiest part !

Now we will make it launchable through pm2:

  • In <your_gekko_install_dir>, create a new file called start_ui.sh
  • Put this inside and save it
#!/bin/bash 
rm ui_logs/*
pm2 start gekko.js --name gekko_ui --log-date-format="YYYY-MM-DD HH:mm Z" -e ui_logs/ui_err.log -o ui_logs/ui_out.log -- --ui max_old_space_size=8096

Make it executable:

chmod 755 start_ui.sh

Now

  • When you want to launch Gekko’s UI you have to use
<your_gekko_install_dir>/start_ui.sh
  • If you want to check Gekko’s UI state you can use: pm2 ls

If you want to check Gekko’s UI logs you can use
(and note its id in the second column, and that is is also displaying the name we gave (gekko_ui) to this instance in the start_ui.sh shell script) :

pm2 log <id>
  • If you want to stop it you can use:
pm2 stop <id>
  • If you want to remove a stopped instance from pm2 list of process, you can use:
pm2 delete <id>

There are plenty more things available with pm2, please check its documentation.

Gekko installation (Windows 10)

Well this part will be quite simple as it consists in two short parts:

  1. Use W10 capacity to use a Linux sub-system to deploy a Debian or Ubuntu distro directly “runnable” inside Windows, using this documentation and then this one
  2. Once it is installed and running, you can come back at the beginning of this page and follow the exact same instructions !

3 thoughts on “Gekko Trading bot installation

Leave a Reply

%d bloggers like this: