[Fix] bug in optimization with inverse mode
This commit is contained in:
parent
f74af8bce1
commit
6fc466aaf3
@ -547,7 +547,8 @@ class BacktestingEngine:
|
|||||||
self.pricetick,
|
self.pricetick,
|
||||||
self.capital,
|
self.capital,
|
||||||
self.end,
|
self.end,
|
||||||
self.mode
|
self.mode,
|
||||||
|
self.inverse
|
||||||
)))
|
)))
|
||||||
results.append(result)
|
results.append(result)
|
||||||
|
|
||||||
@ -607,6 +608,7 @@ class BacktestingEngine:
|
|||||||
global ga_capital
|
global ga_capital
|
||||||
global ga_end
|
global ga_end
|
||||||
global ga_mode
|
global ga_mode
|
||||||
|
global ga_inverse
|
||||||
|
|
||||||
ga_target_name = target_name
|
ga_target_name = target_name
|
||||||
ga_strategy_class = self.strategy_class
|
ga_strategy_class = self.strategy_class
|
||||||
@ -621,6 +623,7 @@ class BacktestingEngine:
|
|||||||
ga_capital = self.capital
|
ga_capital = self.capital
|
||||||
ga_end = self.end
|
ga_end = self.end
|
||||||
ga_mode = self.mode
|
ga_mode = self.mode
|
||||||
|
ga_inverse = self.inverse
|
||||||
|
|
||||||
# Set up genetic algorithem
|
# Set up genetic algorithem
|
||||||
toolbox = base.Toolbox()
|
toolbox = base.Toolbox()
|
||||||
@ -1212,7 +1215,8 @@ def _ga_optimize(parameter_values: tuple):
|
|||||||
ga_pricetick,
|
ga_pricetick,
|
||||||
ga_capital,
|
ga_capital,
|
||||||
ga_end,
|
ga_end,
|
||||||
ga_mode
|
ga_mode,
|
||||||
|
ga_inverse
|
||||||
)
|
)
|
||||||
return (result[1],)
|
return (result[1],)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user