fix(docs/strategy-advanced/custom_stoploss/example): check if "pair" exists in "custom_info" before requesting

This commit is contained in:
Joe Schr 2021-03-04 19:58:43 +01:00
parent c56b9cd751
commit 900deb663a
1 changed files with 1 additions and 1 deletions

View File

@ -261,7 +261,7 @@ class AwesomeStrategy(IStrategy):
current_rate: float, current_profit: float, **kwargs) -> float:
result = 1
if self.custom_info[pair] is not None and trade is not None:
if self.custom_info and pair in self.custom_info and trade:
# using current_time directly (like below) will only work in backtesting.
# so check "runmode" to make sure that it's only used in backtesting/hyperopt
if self.dp and self.dp.runmode.value in ('backtest', 'hyperopt'):