Home

Awesome

Gekko BacktestTool

Logo
Donate with Bitcoin
Donate with Litecoin
Donate with Ethereum
badge GitHub Release Date badge GitHub last commit badge badge GitHub closed issues GA
CLI tool that enhances the features of Gekko's Trading Bot. The tool performs a test with multiple pairs on a single run. Suppose you have a strategy that you want to test on more currency pairs. You enter all the pairs on which you want to test the strategy for the BacktestTool's configuration file. You start the application and everything happens automatically. You are just waiting for the results that appear on the screen. You will see how your strategy falls on other pairs, where it works the best, and where the worst. More detailed data is available in the .CSV file, which you can open in a spreadsheet or text editor.
Top Dataset
You can do the same with many strategies and CandleSize values. You can test all your strategies on eg BTC-USD pair and compare results, which will allow you to choose the best strategy you will use in live trade.

DEMO

Backtest machine

GBT run

Database file

CSV file

Features

<img align="center" src=http://i.imgur.com/JXjKVDT.png>

Minimal requirements

Installation

Binaries: Easiest install way

  1. Download latest version from repository's releases.
  2. Extract downloaded zip.
  3. Copy all extrated files to main Gekko's directory.

Open Source: Debian, Ubuntu, Linux Mint

  1. Clone git https://github.com/xFFFFF/Gekko-BacktestTool
  2. Copy files to Gekko's main directory
  3. Install dependies:
    $ sudo cpan install Parallel::ForkManager Time::Elapsed Getopt::Long List::MoreUtils File::chdir Statistics::Basic DBI DBD::SQLite JSON::XS TOML File::Basename File::Find::Wanted Template LWP::UserAgent LWP::Protocol::https Set::CrossProduct DBD::CSV Text::Table File::Copy

Open Source: Other Unix-like OS

  1. Clone git https://github.com/xFFFFF/Gekko-BacktestTool
  2. Copy files to Gekko's main directory
  3. Install dependies:
    $ su
    $ cpan install Parallel::ForkManager Time::Elapsed Getopt::Long List::MoreUtils File::chdir Statistics::Basic DBI DBD::SQLite JSON::XS TOML File::Basename File::Find::Wanted Template LWP::UserAgent LWP::Protocol::https Set::CrossProduct DBD::CSV Text::Table File::Copy

Open Source: MS Windows

  1. Install Strawberry Perl
  2. Download Gekko BacktestTool from here
  3. Uncompress files from master.zip to Your main Gekko's folder
  4. Find Run... in Menu Start
  5. Enter cmd.exe and press enter
  6. In appeared Window with black background enter command: cpan install Parallel::ForkManager Time::Elapsed Getopt::Long List::MoreUtils File::chdir Statistics::Basic DBI DBD::SQLite JSON::XS TOML File::Basename File::Find::Wanted Template LWP::UserAgent LWP::Protocol::https Set::CrossProduct DBD::CSV Text::Table File::Copy

Open Source: Docker container

The installation tutorial by bald123 can be found in the Wiki: Docker installation.

Run

  1. Edit backtest-config.pl in text editor.
  2. In terminal/cmd go to Your main Gekko's folder ex:
    Windows - cd C:\Users\xFFFFF\Desktop\gekko
    Linux - cd /home/xFFFFF/gekko
  3. If You are using Open Source version go to next step. For "binaries" add execution privilege: chmod +x backtest
  4. Run BacktestTool by command:
    a) Open Source version: perl backtest.pl
    b) Binaries: ./backtest

All available commands

usage: perl backtest.pl
To run backtests machine

usage: perl backtest.pl [mode] [optional parameter]
To run other features

Mode:
  -i, --import   - Import new datasets
  -g, --paper  - Start multiple sessions of PaperTrader
  -v, --convert TOMLFILE - Convert TOML file to Gekko's CLI config format, ex: backtest.pl -v MACD.toml
  -a, --analyze CSVFILE  - Perform comparision of strategies and pairs from csv file, ex: backtest.pl -a database.csv
  
Optional parameters:
  -c, --config     - BacktestTool config file. Default is backtest-config.pl
  -s, --strat STRAT_NAME - Define strategies for backtests. You can add multiple strategies seperated by commas example: backtest.pl --strat=MACD,CCI
  -p, --pair PAIR  - Define pairs to backtest in exchange:currency:asset format ex: backtest.pl --p bitfinex:USD:AVT. You can add multiple pairs seperated by commas.
  -p exchange:ALL  - Perform action on all available pairs. Other usage: exchange:USD:ALL to perform action for all USD pairs.
  -n, --candle CANDLE  - Define candleSize and warmup period for backtest in candleSize:warmup format, ex: backtest.pl -n 5:144,10:73. You can add multiple values seperated by commas.
  -ft, --period DAYS - Time range in days - perform action on period from last x days ex: backtest.pl -ft 7   
  -f, --from    - Time range for backtest datasets or import. Example: backtest.pl --from="2018-01-01 09:10" --to="2018-01-05 12:23"
  -t, --to
  -f last   - Start import from last candle available in DB. If pair not exist in DB then start from 24h ago.
  -t now    - 'now' is current time in GMT.
  -o, --output FILENAME - CSV file name.

<img align="center" src=http://i.imgur.com/OY14rKb.png>

Some examples

See also