-
Notifications
You must be signed in to change notification settings - Fork 20
Optimizer
Clément edited this page Jun 11, 2019
·
1 revision
You can use the genetic optimizer to find your best setting for a strategy.
For example here we try to optimizer a MACD strategy which is using 3 options (fast/slow/signal Period)
You can use the api route: POST: /traders/optimize
{
"opts": {
"threads": 5, // number of parallele trader simulation
"generation": 200, // Generation number
"popSize": 25, // Population size
"elitism": 4, // Elitism (keep 4 best indiv unchanged for next generation)
"mutationRate": 0.5, // Mutation probabilities when breeding new generation
"envs": [ // You can use multiple environment to simulate (the fitness will be the average of the envs scores)
{
"start": "2018-07-10 00:00:00",
"stop": "2018-08-25 00:00:00"
},
{
"start": "2018-10-01 00:00:00",
"stop": "2018-11-01 00:00:00"
},
],
"genes": [
// The options to optimize in the strategy and set mutation rules
// For numeric options (min/max -- int/float)
// For string options (list of value)
{
"key": "fastPeriod",
"min": 5,
"max": 80,
"integer": true
},
{
"key": "slowPeriod",
"min": 15,
"max": 150,
"integer": true
},
{
"key": "signalPeriod",
"min": 5,
"max": 150,
"integer": true
},
{
"key": "aggTime",
"list": [
"5m",
"15m",
"30m",
"1h",
"2h",
"4h",
"6h"
]
}
]
},
"trader": {
"name": "MACD",
"test": true,
"strategie": "MACD",
"stratOpts": {
"fastPeriod": 25,
"slowPeriod": 57,
"signalPeriod": 16,
"aggTime": "5m"
},
"capital": 1000,
"percentInvest": 0.95,
"base": "BTC",
"quote": "USDT",
"exchange": {
"name": "binance"
},
"env": {
"watchList": [
{
"base": "BTC",
"quote": "USDT",
"exchange": "binance"
}
],
"aggTimes": [],
"warmup": 20000,
"batchSize": 1000,
"bufferSize": 5000,
"backtest": {
// SETTED but will not be used if opts.envs properties set in genetic params
"start": "2018-02-22 00:00:00",
"stop": "2019-03-15 00:00:00"
},
"candleSetPlugins": []
}
}
}