Gab0 / japonicus

Genetic Algorithm for Gekko Trading Bot.
MIT License
284 stars 102 forks source link

Usage examples are not clear: how do we run the bot? #189

Open IAMtheIAM opened 5 years ago

IAMtheIAM commented 5 years ago

There are actually no examples of how to run this program. The wiki usage specifies the cli options but without giving a working example.

Please update either the Readme or the Wiki with a working example that can be copied and pasted.

I updated my configStrategy.py with the parameters needed and named it the same as my strategy name in the gekko file. I updated _Global.toml with the path and config file names (which by the way is not clearly explained in the Wiki. That info should be on the Readme or the Usage page. I had to dig through Issues here to figure out the basic info.)

I entered python3 japonicus-run -b --strat mycustomstrat

And the response

         EVOLUTIONARY GENETIC ALGORITHMS                v0.92
The profits reported here depends on backtest interpreter function; 
    interpreter v3: 
if <backtest profit> > 0: <shown profit> = <backtest profit> - <market profit> 
else <shown profit> = <backtest profit> 

found gekko @ http://localhost:3000
Run took 1 seconds.

What does that mean... did it work? Where are the results? I can't find the .csv file anywhere Thanks for any help, I'm looking forward to using this program

Gab0 commented 5 years ago

Sorry bro, bayesian optimization (-b) is deprecated. Try running python3 japonicus-run -g[c] --strat mystrat. An error message should have been printed in your case, we have some issues with error messages here ^^.

IAMtheIAM commented 5 years ago

Hey @Gab0 thanks for the tip. I had no idea -b was deprecated. So the new options are either -g or -c? What's -c

Here's what I got in -g


         EVOLUTIONARY GENETIC ALGORITHMS                                v0.92

The profits reported here depends on backtest interpreter function; 
        interpreter v3: 
if <backtest profit> > 0: <shown profit> = <backtest profit> - <market profit> 
else <shown profit> = <backtest profit> 

found gekko @ http://localhost:3000
japonicus-run -g --strat main
Evolving main strategy;

evaluated parameters ranges:

taLibRSILength.optInTimePeriod(9.8, 18.2)

gekkoRSILength.interval       (9.8, 18.2)

evolution candlestick dataset 2016-05-31 20:45:00 to 2019-07-09 00:44:00
ETH/USD @bitfinex

evolution candlestick dataset 2016-05-31 20:45:00 to 2019-07-09 00:44:00
ETH/USD @bitfinex

evaluation candlestick dataset 2016-05-31 20:45:00 to 2019-07-09 00:44:00
ETH/USD @bitfinex

Fatal: deltaDays on Settings.py set to a value bigger than current dataset.
 Edit Settings file to fit your chosen candlestick data.

I have 3 years of local data loaded for bitfinex eth:usd so it should be able to see that. Do you know what could cause this?

Gab0 commented 5 years ago

Error: config failure is raised on connection on to gekko @ evaluation/gekko/API.py... maybe gekko's output has more information about that.

IAMtheIAM commented 5 years ago

I fixed that error, apparently there were more .toml files to change. Then I got the deltaDays error where it seems to not select from the data base pair which I wanted. I deleted the other databases and now it seems to be working, but I'm not sure what to make of the output.


        ====== EPOCH 0/3000 ======
Locale1
first unevaluated: 50
0 individues removed due to equality
[50]
'performanceReport'
Population dead after trading number filter.
Population dead after roundtrip exposure filter.
Repopulating... Aborting epoch.
EPOCH 0 &50
Maximum profit 0           Average profit -5.047      
Minimum profit -6.918      Profit variation 1.632     
Population size 50         Max population size 50     
Avg trade number 2.900     Avg sharpe ratio -25.445   
Avg exposure time 25.520   

Locale2
first unevaluated: 50
0 individues removed due to equality
[50]
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
'performanceReport'
Population dead after trading number filter.
Population dead after roundtrip exposure filter.
Repopulating... Aborting epoch.
EPOCH 0 &50
Maximum profit 0         Average profit 0         
Minimum profit 0         Profit variation 0       
Population size 50       Max population size 50   
Avg trade number 0       Avg sharpe ratio 0       
Avg exposure time 0      

Locale3
first unevaluated: 50
0 individues removed due to equality
[50]
'performanceReport'
'performanceReport'
Population dead after trading number filter.
Population dead after roundtrip exposure filter.
Repopulating... Aborting epoch.
EPOCH 0 &50
Maximum profit 0          Average profit -14.475    
Minimum profit -34.985    Profit variation 12.943   
Population size 50        Max population size 50    
Avg trade number 1.640    Avg sharpe ratio 0        
Avg exposure time 1.680   

Epoch runs in 94.17 seconds;

        ====== EPOCH 1/3000 ======
Locale1

Is it working, and how do I interpret these results?

IAMtheIAM commented 5 years ago

Actually, I think I got it working. I needed to adjust my backtest length in order to get some real numbers. I'll let it run and see what happens!

Gab0 commented 5 years ago

Ok, the useful output is written at the logsfolder.

IAMtheIAM commented 5 years ago

@Gabo thanks again. I see the results. This is awesome! now I can hone in my parameters for the best results.

Next question: How do I get Japonicus to use my parameter ranges?

I put them in configStrategies.py

    "main": {
        "first": {
            "param": (1, 200)
        },
        "second": {
            "param": (1, 200)
        },
        "params": {
            "param1": (1, 20),
            "param2": (1, 20),
            "param3": (65, 90),
        },
    },

However, it did not use those, and instead referenced the settings in the .toml file I put in strategy_parameters folder. THen it generated it's own random parameter ranges:

first.param        (7.8, 16.2)

second.param        (15.7, 23.3)

params.param1       (3.5, 6.5)

So, It didn't seem to pick up my ranges.

Also, is there a doc on what all these paramters in these files mean? I see the comments but I'm not a statistical analysis wizard so stuff relating to EPOCHS, population size, density, etc is completely foreign to me :-D _generation.toml _backtest.toml _dataset.toml _evalbrak.toml

Is it very important that I learn and change all these settings or are they optimized at the default? For example, what is the need for 3 different datasets in dataset.toml... likewise, what does it mean by "Locale1, locale2, locale3?"

I really appreciate your help!

Gab0 commented 5 years ago

Hey, yeah configStrategies is deprecated. I guess your config problem is on parameter nesting at the .toml file... It should be:

[first]
param = [1, 200]

[second]
param = [1, 200]

[params]
param1 = [1, 20]

....

And we surely need better documentation lol. But I just broke the benchmark system a few releases ago, so it's not possible to quickly evaluate different GA settings. 90% of those strange parameters are experimental, so it may not be worthy to learn everything about them in this current state of development..

IAMtheIAM commented 5 years ago

ohh Lol that's good to know. I was sitting here wondering what's going on. It took my ranges when I put them in the .toml file as you said!

Also, good to know a lot of the parameters are experimental, so I'll leave them.

The main ones I'm curious about are

I'm reading through your changelog to see what else I can learn now.

As I learn more about this, I'll be happy to improve the documentation to make it better to understand.