fix formatting

This commit is contained in:
sid 2021-10-06 13:46:05 +05:30
parent c0d01dbc26
commit 6ba46b38bd

View File

@ -5,11 +5,12 @@ This module defines the alternative HyperOptLoss class which can be used for
Hyperoptimization.
"""
from datetime import datetime
from freqtrade.data.btanalysis import calculate_max_drawdown
from freqtrade.optimize.hyperopt import IHyperOptLoss
from pandas import DataFrame
from freqtrade.data.btanalysis import calculate_max_drawdown
from freqtrade.optimize.hyperopt import IHyperOptLoss
class MaxDrawDownHyperOptLoss(IHyperOptLoss):
@ -31,7 +32,7 @@ class MaxDrawDownHyperOptLoss(IHyperOptLoss):
Uses profit ratio weighted max_drawdown when drawdown is available.
Otherwise directly optimizes profit ratio.
"""
total_profit = results['profit_ratio'].sum()
total_profit = results['profit_ratio'].sum()
try:
max_drawdown = calculate_max_drawdown(results)
except ValueError:
@ -39,4 +40,4 @@ class MaxDrawDownHyperOptLoss(IHyperOptLoss):
return -total_profit
max_drawdown_rev = 1 / max_drawdown[0]
ret = max_drawdown_rev * total_profit
return -ret
return -ret