Another thing I am thinking about: When you run a backtest this is basically the work that needs to be done:
1. load 1min candles from disk.
2. convert them into 1h candles (assuming candle size is 60).
3. calculate indicators
4. run the strategy
5. simulate trades
6. calculate performance
I have a feeling the first 2 items take up a lot of time. If you build a GA tool that tries to figure out the best MACD params (example) there is little reason to do step 1 and 2 on every iteration (if you have enough memory to store them). If you want to test strategies with different tresholds (keeping all indicator params intact) we can even include step 3 here. What about some new endpoints like this:
After the first call Gekko has stored all of these candles and keeps them in memory to very quickly feed them into a backtest. This might be able to speed up the backtests by a ton since a lot of heavy lifting will just be done once.
1. load 1min candles from disk.
2. convert them into 1h candles (assuming candle size is 60).
3. calculate indicators
4. run the strategy
5. simulate trades
6. calculate performance
I have a feeling the first 2 items take up a lot of time. If you build a GA tool that tries to figure out the best MACD params (example) there is little reason to do step 1 and 2 on every iteration (if you have enough memory to store them). If you want to test strategies with different tresholds (keeping all indicator params intact) we can even include step 3 here. What about some new endpoints like this:
Code:
POST prepareBacktestData { watch, candleSize, etc. } -> returns some ID
POST backtest { the id you just got } -> returns backtest result
After the first call Gekko has stored all of these candles and keeps them in memory to very quickly feed them into a backtest. This might be able to speed up the backtests by a ton since a lot of heavy lifting will just be done once.