resolved mypy error

error: Signature of "hyperopt_loss_function" incompatible with supertype "IHyperOptLoss"
This commit is contained in:
Robert Roman 2021-09-27 17:32:49 -05:00 committed by GitHub
parent 67e9626da1
commit c3414c3b78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,8 @@ class CalmarHyperOptLoss(IHyperOptLoss):
trade_count: int, trade_count: int,
min_date: datetime, min_date: datetime,
max_date: datetime, max_date: datetime,
config: Dict,
processed: Dict[str, DataFrame],
backtest_stats: Dict[str, Any], backtest_stats: Dict[str, Any],
*args, *args,
**kwargs **kwargs
@ -52,7 +54,7 @@ class CalmarHyperOptLoss(IHyperOptLoss):
except ValueError: except ValueError:
max_drawdown = 0 max_drawdown = 0
if max_drawdown != 0: if max_drawdown != 0 and trade_count > 2000:
calmar_ratio = expected_returns_mean / max_drawdown * msqrt(365) calmar_ratio = expected_returns_mean / max_drawdown * msqrt(365)
else: else:
# Define high (negative) calmar ratio to be clear that this is NOT optimal. # Define high (negative) calmar ratio to be clear that this is NOT optimal.