resolved mypy error
error: Signature of "hyperopt_loss_function" incompatible with supertype "IHyperOptLoss"
This commit is contained in:
parent
67e9626da1
commit
c3414c3b78
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user