I sorted imports with isort
This commit is contained in:
parent
3834bb86ff
commit
b946f8e7f1
@ -7,10 +7,9 @@ Hyperoptimization.
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from pandas import DataFrame
|
|
||||||
|
|
||||||
from freqtrade.optimize.hyperopt import IHyperOptLoss
|
|
||||||
from freqtrade.data.btanalysis import calculate_max_drawdown
|
from freqtrade.data.btanalysis import calculate_max_drawdown
|
||||||
|
from freqtrade.optimize.hyperopt import IHyperOptLoss
|
||||||
|
from pandas import DataFrame
|
||||||
|
|
||||||
|
|
||||||
class CalmarHyperOptLoss(IHyperOptLoss):
|
class CalmarHyperOptLoss(IHyperOptLoss):
|
||||||
@ -43,10 +42,9 @@ class CalmarHyperOptLoss(IHyperOptLoss):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
max_drawdown = 0
|
max_drawdown = 0
|
||||||
|
|
||||||
if max_drawdown > 0:
|
if max_drawdown != 0 and trade_count > 1000:
|
||||||
calmar_ratio = expected_returns_mean / max_drawdown * np.sqrt(365)
|
calmar_ratio = expected_returns_mean / max_drawdown * np.sqrt(365)
|
||||||
else:
|
else:
|
||||||
calmar_ratio = -20.
|
calmar_ratio = -20.
|
||||||
|
|
||||||
# print(calmar_ratio)
|
|
||||||
return -calmar_ratio
|
return -calmar_ratio
|
||||||
|
Loading…
Reference in New Issue
Block a user