-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Isolation of backtests #840
Comments
I'm working on something similar (#831) but it sounds like you've gotten further. Are you willing to share your code with the community? |
Hi @imkane . It's really just a separate nodejs project I put together for testing - So not really shareable. I could put one together that reproduces these issues? |
Ahh gotcha :) If you want to do that I can help test. |
Great 👍 |
It should work. |
Yes, if you start a server and use the REST api to run backtests, each one runs in an individual child process. See here for the implementation.
I have never seen this before, are you able to provide a reproducible example? |
@askmike Thanks for reacting to this. I will create a nodejs project you can run towards a existing gekko server. |
So, I've written down some code that reproduces the error. Sorry for the looong block of code, but I wanted to do it without external deps, so you could run it with the current gekko package.json If you do try so run it yourself, you will need to have the data imported.
Gives the output:
|
Did you test it @askmike ? |
I get the same issue: test1: Trades: 1 Balance: 5131.545330278262 Used a different currency pair, but worked just fine. I'm not on the latest code base though. Also, I think this may be a node thing rather than a gekko thing but I could be wrong. |
@thegamecat The node engine runnning the gekko server, or the node running the test? |
Your code. |
I fixed it, was a very subtle bug: Even though the backtests run in isolation, I build a config file in the shared (UI server) process. When setting up a new backtest I pass this config to the child process (after the process started). But your code hits the backtest API so fast that by the time the child processes are ready to receive the config, I've overwritten the config 3 times and pass the same config to all child processes. Damn hoisted require in combination with _.merge... |
Keep in mind that the current backtester is not very fast (not designed to be), and doing 20 at the same time will probably bring your computer (cpu & IO) to a grind. I would recommand using as the adapter postgresql. But still it won't be very fast.. |
@Froelund did you update your code because the above isnt working and I cant test the fix. |
Same here, I am receiving report: false regardless of the interval I pick |
@thegamecat @Froelund @marcuslopes Since 0.5.0 the code that calculates performance (and thus is responsible for the report) is not part of the paperTrader anymore, this way it can also be used for the live trader. To fix
|
Wonderful, works like a charm. |
Remote.js code from @askmike and @Froelund taken from askmike#840
Thanks Mike! Got it working as well. |
Hi!
I'm running backtests automated, and my results shows me that when running multiple backtests with completely different strategy-parameters(but the same simulationBalance and daterange), I'm getting the exact same result for every backtest?
My approach is to use the rest api, and send 20 different calls in parallel.
Is every backtest run isolated from other backtests?
Do Gekko support parallel backtests via the rest-api?
The text was updated successfully, but these errors were encountered: