Optimize Jesse.trade on Google Colab

Didi27
3 min readJun 13, 2021
When Jesse meets Colab

Recently, I have been testing Jesse and get familiar with it. It was relatively easy to get used to it compare to other trading bots.

The simplicity attracts me, and the program is easy to understand, even for a person like me that only has basic Python for programming knowledge.

So hey, here is what you have been here for, a complete Google Colab notebook for Jesse.

https://swiy.io/jesse-colab

Quick Guide:

  1. File -> Save a copy in drive.
  2. Change runtime type to -> Hardware accelerator: TPU.
  3. Mount Drive to Colab.
  4. Fill in the setup details.
  5. The others are self-explaining.
  6. Optimize your bot!

Why change to TPU?

40 Freaking cores

I mean, are you sure you don’t want it?

Only the TPU hardware accelerator gives you 40 cores of CPU. Free users could get it too.

How does it work?

(Long explanation, so you could edit the code to suit your need)

The Jesse in Colab would only need Google Drive to save the optimized data. It used rsync -aP to synchronize between Colab and Drive.

The -a option is a combination flag. It stands for “archive” and syncs recursively and preserves symbolic links, special and device files, modification times, group, owner, and permissions.

The -P flag is very helpful. It combines the flags — progress and — partial. The first of these gives you a progress bar for the transfers, and the second allows you to resume interrupted transfers. So you could run it multiple times without any problem.

So by doing this, the system itself self-sufficient.

The overall picture of the system goes like this:

Colab -> Install jesse ->Setup Jesse -> Sync Drive to Colab -> Import candles -> Backtest / Optimization -> Sync Colab to Drive

Optimizing Tips

When optimizing, try not to let your Colab idle for too long when it is still populating because Jesse cannot save your progress at the populating stage.

At evolving phase, frequently stop the optimizing process and sync it to drive to save the progress, especially for the free user in Colab. It would unexpectedly disconnect a lot. If you have some buck, get the Pro for only $10/month, it’s worth it.

What could be improved?

  1. Import candles
Importing Boring Candles

Yeah, I know it’s somewhat annoying to keep download the same candles every time you run it. Right now, I’m not able to dump the candle data in the Drive because it is saved in the database. Like I said before, “basic python knowledge.” So anyone that knows how to do this could send me a message or make a pull request on Github.

It has something to do with Postgresql: pg_dump. Here is a link to it

2. Versioning with Github

Github

Sometimes, you could mess up your bot, and you will have a hard time recovering it — the solution for this adding Github to your system. Github has a versioning system that helps you recover when you mess things up.

It is complicated for the average user, so I throw it out because it tends to mess up with the files if you would like to add it, here the code for it.

3. Sync with Local PC

Install Google Drive Desktop to sync your Jesse from Google Drive to your local PC. Easy.

--

--

Didi27

A kiddo that just want to have his pocket full