[TUT] Running a backtest through the CLI
#1
[I might move this guide into the docs one day]

If you are developing your own strategy or want to gain more insights in what is happening you can easily use the commandline interface (CLI) to run a backtest quickly. By default these backtests include a lot of debugging information which you can use to understand what is going on inside the strategy you are running.

This guide assumes you have historical data available (imported previously or obtained from a live gekko).

Step 1: create a config file

Copy gekko/sample-config.js into gekko/config.js

Step 2: configure your config

Open up the gekko/config.js file with a text editor (sublime is excellent, free and runs on all major OSes).

- Search for "config.watch" and replace exchange, currency and asset with the market you want to backtest over.
- Search for "config.tradingAdvisor" and set method to your strategy, candleSize to the type of candles you want (in minutes, hourly candles means filling in 60).
- [optoinally] Search for "paperTrader" and configure the slippage and spread according to the market. If you are trading on a big market (BTC/USD for example) the defaults are fine.

Step 3: run the backtest

- Open a terminal and navigate to the Gekko directory.
- Run the backtest by typing: node gekko -c config.js -b
  Reply


Forum Jump:


Users browsing this thread: