tommiehansen / gab Goto Github PK
View Code? Open in Web Editor NEWGekko Automated Backtests
Gekko Automated Backtests
system/post.php allows user to run with ranges that will not work.
Fix.
Basically allow server to become an array of servers.
This to make it possible for users to max out on number of threads.
Also maybe create some tool to sync primary servers Gekko history + strategies + toml's with these other slave servers or make it some sort of mandatory thing for running multi-server runs (or just add some checks for this that forces the user to keep things in sync).
Hello
Seem that someting in the parser function did't work correctly.
PHP says:
[Sat Mar 24 09:04:58.802581 2018] [php7:error] [pid 27543] [client 127.0.0.1:49124] PHP Fatal error: Uncaught Exception: Unknown primative for 'no'
on line 2. in /data/gab/system/class.toml.php:177\nStack trace:\n#0 /data/gab/system/class.toml.php(122): Toml\Parser->parseValue(''no'')\n#1 /data/gab/system/class.toml.php(79): Toml\Parser->processLine('buyImmediately ...')\n#2 /data/gab/system/class.toml.php(25): Toml\Parser->parse()\n#3 /data/gab/system/class.gab.php(131): Toml\Parser::fromString('buyImmediately ...')\n#4 /data/gab/system/class.gab.php(73): GAB\core->parse_toml('buyImmediately ...')\n#5 /data/gab/runner.php(34): GAB\core->get_strategies()\n#6 {main}\n thrown in /data/gab/system/class.toml.php on line 177
Gekko says:
--> POST /api/backtest 200 2,579ms 39.34kb
<-- POST /api/backtest
2018-03-24 10:17:51 (INFO): Setting up Gekko in backtest mode
2018-03-24 10:17:51 (INFO):
2018-03-24 10:17:51 (INFO): Setting up:
2018-03-24 10:17:51 (INFO): Trading Advisor
2018-03-24 10:17:51 (INFO): Calculate trading advice
2018-03-24 10:17:52 (INFO): Using the strategy: RSI_BULL_BEAR_ADX
2018-03-24 10:17:52 (INFO): ====================================
2018-03-24 10:17:52 (INFO): Running RSI Bull and Bear + ADX
2018-03-24 10:17:52 (INFO): ====================================
2018-03-24 10:17:52 (INFO): Make sure your warmup period matches SMA_long and that Gekko downloads data if needed
2018-03-24 10:17:52 (WARN): *** WARNING *** Your Warmup period is lower then SMA_long. If Gekko does not download data automatically when running LIVE the strategy will default to BEAR-mode until it has enough data.
2018-03-24 10:17:52 (INFO):
2018-03-24 10:17:52 (INFO): Setting up:
2018-03-24 10:17:52 (INFO): Paper Trader
2018-03-24 10:17:52 (INFO): Paper trader that simulates fake trades.
2018-03-24 10:17:52 (INFO):
2018-03-24 10:17:52 (INFO): Setting up:
2018-03-24 10:17:52 (INFO): Performance Analyzer
2018-03-24 10:17:52 (INFO): Analyzes performances of trades
2018-03-24 10:17:52 (INFO):
2018-03-24 10:17:52 (INFO): Scanning local history for backtestable dateranges.
2018-03-24 10:17:52 (DEBUG): Available 282204
2018-03-24 10:17:52 (DEBUG): Optimal 438632
2018-03-24 10:17:52 (INFO): The database has 156429 candles missing, Figuring out which ones...
2018-03-24 10:17:52 (INFO): Gekko detected multiple dateranges in the locally stored history. Please pick the daterange you are interested in testing:
2018-03-24 10:17:52 (INFO): OPTION 1:
2018-03-24 10:17:52 (INFO): from: 2017-05-23 19:15:00
2018-03-24 10:17:52 (INFO): to: 2017-09-05 01:15:00
2018-03-24 10:17:52 (INFO): OPTION 2:
2018-03-24 10:17:52 (INFO): from: 2017-12-22 15:15:00
2018-03-24 10:17:52 (INFO): to: 2018-03-22 19:15:00
2018-03-24 10:17:52 (INFO): OPTION 3:
2018-03-24 10:17:52 (INFO): from: 2018-03-22 21:15:00
2018-03-24 10:17:52 (INFO): to: 2018-03-24 09:15:00
prompt: option:
Note:
The dataset selected from the GIU is the second one, if i select it manually the simulation works correctly.
Adding a progress bar to see how much test are done and how many remain will be very useful
With further analysis of the results, it is possible to locate the sweet spot of some settings. E.g.: In the following picture there are the results of the setting threshold_buy of one of my strategies.
On the diagramm you can see, there is a limit near 0.8. So therefore it would be interesting also to have some information of the negative results. So therefore my request to show and save also the negative results. Maybe optional. What do you think?
hi!
I installed XAMPP with PHP version 7.1+ and wanted to use GA to select parameters, but I always get an error:
16:00:59 Runner.php ERROR: Running config via curl_post() did not return data.
url: http://localhost:3000/api/backtest | curl status: 0 - No data
Prompt, please, in what there can be a problem?
After switching to MySQL i noticed a mess up with the database names inside, due to the lots of sets. Therefore my suggestion to add a name in MySQL for the database like:
Example for mysql: '127.0.0.1:3306,DatabsaeName,TommieHansenIsTheBest,MySuperPassword'
Under MySQL there coud the be a singe datbase set like 'gab'.
In gekko itself there is in sample-config.js with a similar option for the postgresql database. There you can optional set a name for the databese inside postgresql. Not shure, ift this works in MySQL too.
// Postgres adapter example config (please note: requires postgres >= 9.5): config.postgresql = { path: 'plugins/postgresql', version: 0.1, connectionString: 'postgres://user:pass@localhost:5432', // if default port database: null, // if set, we'll put all tables into a single database. schema: 'public', dependencies: [{ module: 'pg', version: '6.1.0' }] }
Maybe you agree and can add this feature.
Thank you for your hard work and shareing this wonderful software.
Does it possible to set the correct value fees of the exchange we use for the backtest ?
Currently the entire form is send but this also include all strategies loaded.
Problem with this is that the user can have strategies that contain exotic values and this can cause things to basically error out.
Changing this behaviour requires the state-saving of strategies to change or that some filter is applied before doing the POST requests so that strategy params that will not be used are simply filtered out.
Basically let the user select multiple datasets and test a strategy against all these datasets in the same run and then output this combined runs in a combined database file.
Why?
Because it makes sense that one would like to test strategy params on multiple asset/currency pairs and check what generally works best for all these.
For this to work
{ exchange: Binance, currency: USD, asset: ETH }
I do have php-curl installed.
Strategy is running until that point and this error message accumulates once per run.
gekko output reads. The next out put after this is the "finished". The database result file is there but has 24kb and view.php shows the result, but "get data" crashes.
Any hint welcome!
2018-03-22 19:20:25 (INFO): ====================================
2018-03-22 19:20:25 (INFO): Running RSI Bull and Bear + ADX
2018-03-22 19:20:25 (INFO): ====================================
2018-03-22 19:20:25 (INFO): Make sure your warmup period matches SMA_long and that Gekko downloads data if needed
2018-03-22 19:20:25 (WARN): *** WARNING *** Your Warmup period is lower then SMA_long. If Gekko does not download data automatically when running LIVE the strategy will default to BEAR-mode until it has enough data.
2018-03-22 19:20:25 (INFO):
2018-03-22 19:20:25 (INFO): Setting up:
2018-03-22 19:20:25 (INFO): Paper Trader
2018-03-22 19:20:25 (INFO): Paper trader that simulates fake trades.
2018-03-22 19:20:25 (INFO):
2018-03-22 19:20:25 (INFO): Setting up:
2018-03-22 19:20:25 (INFO): Performance Analyzer
2018-03-22 19:20:25 (INFO): Analyzes performances of trades
2018-03-22 19:20:25 (INFO):
2018-03-22 19:20:26 (INFO): Scanning local history for backtestable dateranges.
2018-03-22 19:20:26 (DEBUG): Available 1184013
2018-03-22 19:20:26 (DEBUG): Optimal 1184012
2018-03-22 19:20:26 (INFO): Gekko is able to fully use the local history.
2018-03-22 19:20:26 (INFO): Gekko was able to find a single daterange in the locally stored history:
2018-03-22 19:20:26 (INFO): from: 2015-12-17 10:57:00
2018-03-22 19:20:26 (INFO): to: 2018-03-18 16:29:00
2018-03-22 19:20:26 (INFO): WARNING: BACKTESTING FEATURE NEEDS PROPER TESTING
2018-03-22 19:20:26 (INFO): WARNING: ACT ON THESE NUMBERS AT YOUR OWN RISK!
Since GEKKO supports native support for PostgreSQL out of the box, i thought why not using PostgreSQL instead of MySQL? So we could use the same database/logins for gekko AND GAB.
According to e recent test they should be similar in performance:
What do you think about adding PostgreSQL support in GAB?
Sorry to re-address this issue, but I'm encountering the same problem as in #4 :
Fatal error: Uncaught Exception: Unknown primative for `'no'` on line 2. in /var/www/html/gab/system/class.toml.php:176
Stack trace:
#0 /var/www/html/gab/system/class.toml.php(121): Toml\Parser->parseValue(''no'')
#1 /var/www/html/gab/system/class.toml.php(78): Toml\Parser->processLine('buyImmediately ...')
#2 /var/www/html/gab/system/class.toml.php(24): Toml\Parser->parse()
#3 /var/www/html/gab/system/class.gab.php(178): Toml\Parser::fromString('buyImmediately ...')
#4 /var/www/html/gab/system/class.gab.php(67): GAB\core->parse_toml('buyImmediately ...')
#5 /var/www/html/gab/system/runner.php(42): GAB\core->get_strategies()
#6 {main}
thrown in /var/www/html/gab/system/class.toml.php on line 176
Freshly installed today. Already tried a newly created dataset.
Sanity check looks happy:
PHP EXTENSIONS
OK
DIRECTORY CREATION TEST
OK
PHP VERSION
OK You are running: 7.2.10-0ubuntu0.18.04.1
PHP MEMORY
OK Your PHP has 512M available
PHP MAX EXECUTION TIME
OK Your max execution time is 900 seconds (15 minutes)
SQLITE CREATE DATABASE TEST
OK
SQLITE INSERT TEST
OK
Initially I had MySQL, same problem, so now I'm trying with sqlite.
Any ideas perhaps? And where would I find the logging that izevar mentioned:
Gekko says:
--> POST /api/backtest 200 2,579ms 39.34kb
<-- POST /api/backtest
2018-03-24 10:17:51 (INFO): Setting up Gekko in backtest mode
2018-03-24 10:17:51 (INFO):
2018-03-24 10:17:51 (INFO): Setting up:
2018-03-24 10:17:51 (INFO): Trading Advisor
I'm running gekko --ui. (v0.6.8). Backtests in Gekko UI work fine.
Hopefully someone can help me :-)
Thanks!
Expected Result:
With same strategy (RSI BULL BEAR), same strategy parameters, same dataset, the roundtrips shown in "View Run" of GAB should be the same as roundtrips shown in Gekko backtest.
Actual Result:
The roundtrips are totally different.
Steps to reproduce:
Last update forced the path /gab/ upon users.
Fix @ system/conf.php
It is easy to misjudge the number of runs you make the system do.
Would it be hard to show how many runs there are in total going to be aside the "completed".
Btw I would be willing to help here. My PHP is rusty at best and I don't know if you are looking for contributions
Notice: Undefined offset: 0 in /var/www/html/gab/view.php on line 340
Notice: Undefined property: stdClass::$market_profit in /var/www/html/gab/view.php on line 341
Notice: Undefined property: stdClass::$strategy_profit in /var/www/html/gab/view.php on line 342
Notice: Undefined property: stdClass::$sharpe in /var/www/html/gab/view.php on line 359
Notice: Undefined property: stdClass::$trades in /var/www/html/gab/view.php on line 359
Notice: Undefined property: stdClass::$trades_win_percent in /var/www/html/gab/view.php on line 359
Notice: Undefined property: stdClass::$trades_win_avg in /var/www/html/gab/view.php on line 360
Notice: Undefined property: stdClass::$trades_lose_avg in /var/www/html/gab/view.php on line 360
Notice: Undefined property: stdClass::$trades_best in /var/www/html/gab/view.php on line 361
Notice: Undefined property: stdClass::$trades_worst in /var/www/html/gab/view.php on line 361
Notice: Undefined property: stdClass::$candle_size in /var/www/html/gab/view.php on line 362
Notice: Undefined property: stdClass::$trades_per_day in /var/www/html/gab/view.php on line 362
Notice: Undefined property: stdClass::$id in /var/www/html/gab/view.php on line 364
##############################################################################
Notice: Undefined offset: 0 in /var/www/html/gab/system/functions.php on line 158
Warning: Invalid argument supplied for foreach() in /var/www/html/gab/system/functions.php on line 161
I've released gekko 0.6 which has some differences in the API. See the following links for details:
When using e.g. 2017-01-01 it might cause issues since Gekko doesn't always correctly interpret this as "the first time found for this date" even though it mostly does it. It's an odd quirk in Gekko that can cause some errors sometimes resulting in cURL 500 errors which in most cases mean that Gekko UI just returned errors.
The option could be made to simply use the standard Gekko format; y-m-d hh:mm, but the format is stupid and arcaic. Another solution is to always set the timestamp to e.g. 15:00 since Gekko's tolerance for "non-found" seem to be +/-5 hours or something similar.
I'm able to run the scripts ok, but I get this in the log for each attemp
Attempt to modify property 'daterange' of non-object in /var/www/html/gab/system/class.gab.php on line 323
also have a few lines at the top of the page -
Notice: Undefined offset: 0 in /var/www/html/gab/index.php on line 65
Notice: Trying to access array offset on value of type null in /var/www/html/gab/index.php on line 65
Notice: Undefined offset: 0 in /var/www/html/gab/index.php on line 66
Notice: Trying to access array offset on value of type null in /var/www/html/gab/index.php on line 66
Notice: Undefined offset: 0 in /var/www/html/gab/index.php on line 107
Notice: Trying to access array offset on value of type null in /var/www/html/gab/index.php on line 110
Notice: Trying to access array offset on value of type null in /var/www/html/gab/index.php on line 111
any way I can straighten these out? I appreciate the software!
Move the primary server setting out of system/conf.php.
Add some env variable or something.
sorry if you don't accept issues. I get
Notice: Trying to get property of non-object in /var/www/html/gab/system/class.gab.php on line 119
Warning: Invalid argument supplied for foreach() in /var/www/html/gab/select.php on line 83
gekko has datasets available in the ui.
At first I thought this was a missing / in the conf.php server variable, but that didn't fix it.
The only thing I have odd in my setup is that I copied gab to /var/www/html.
Using a symlink there and having it in the gekko dir doesn't make a difference though.
Any hint on what this might be?
Hi @tommiehansen,
First of all, fantastic work with the tool. The UI is just exceptional!
I am facing issues with getting the setup running. Perhaps you can help me you? This is the errors I see
And
Warning: Invalid argument supplied for foreach() in /Users/AdityaNayak/Bots/trading/gab/system/class.gab.php on line 63
I have PHP 7.1.2 on mac OS with the latest SQL lite
Allow user to set specific date range for a set and debug why it previously has not worked (and thus isn't included).
Also add a friendly datepicker to pick the ranges.
I'm using Gekko / GAB to learn more about Linux. I can find my way around, but I'm not an expert.
So this might be an easy one, but I:
========================================================
GAB CLI
http://localhost:3000/gab/system/post.php
========================================================
INFO > Running RSI_BULL_BEAR_ADX using 1 thread(s)
INFO > To quit hold CTRL+C
SETTINGS >
ETC / USDT @ poloniex
Candle: 5:15,5 min History: 10
Let's go! Lambo generator started.
bash: line 1: ./curl.sh: Permission denied
bash: line 1: ./curl.sh: Permission denied
bash: line 1: ./curl.sh: Permission denied
bash: line 1: ./curl.sh: Permission denied
bash: line 1: ./curl.sh: Permission denied
For some reason 'Strategy average' params do not work that great for values over 1000. Find the problem and bloody fix it.
Relational/inheritance for dynamic parameters.
Basically a new add-on that makes it possible for myParam 2
to inherit it's base value from myParam
.
Samples:
MIN:MAX
rangelong = 500:1000,200
short = @long/4:@long/2
long = 500:1000,200
short = @long/2
Sample result:
long = 500
short = 250
The benefit of this is that sometimes one want B to be a fraction of A which makes it unnecessary to set a static range.
There's also this obvious problem:
long = 50:500,50
short = 10:100,10
In the above case many runs will become basically useless since if e.g. long and short is SMA values the strategy and run most probably would fail miserably every time short has a higher dynamic value then long.
This could be solved with this new param modifier.
@todo Find a parsing behaviour that:
@long / 4
, @long / 4
, @long * 0.2
should work etc.Use another library for sorting tables since the current one isn't good enough and thus have problems with all sorts of values.
a plus would be to have the error log not immediately go away when something goes wrong, but mainly .... where to disable the lady?
Under "View runs" the "Laste change" date is wrong. Instead of this the date and time under logs is correct. also ubunto 18.04 LTS "time" gives the correct date/time. Also i noticed, that the date/time doesnt change after a run. I do not really what to do. Maybe it is a bug?
Edit: i just found your post here:
https://forum.gekko.wizb.it/thread-56589-post-58179.html#pid58179
I noticed that my back tests wern't working as expected, I also ran the numbers from GAB in gekko back testing and found weird issues.
I've now noticed that the Currency and Assett are switched around when importing into GAB.. i.e. currency/asset BTC/ETH now becomes currency/asset ETH/BTC and then the back test are invalid?
I'm trying to implement this on XAMPP, but get the following issue:
Warning: require(./views/header.php): failed to open stream: No such file or directory in C:\xampp\htdocs\system\conf.php on line 183
Fatal error: require(): Failed opening required './views/header.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\system\conf.php on line 183
PEAR is standard on XAMPP and there shouldn't be an issue with PEAR otherwise. I've tried a few potential workarounds by hardcoding the PEAR directory path, but no dice. Appreciate any feedback.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.