fix(docs/strategy-advanced/custom_stoploss/example): check if "pair" exists in "custom_info" before requesting
This commit is contained in:
parent
c56b9cd751
commit
900deb663a
@ -261,7 +261,7 @@ class AwesomeStrategy(IStrategy):
|
|||||||
current_rate: float, current_profit: float, **kwargs) -> float:
|
current_rate: float, current_profit: float, **kwargs) -> float:
|
||||||
|
|
||||||
result = 1
|
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.
|
# 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
|
# 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'):
|
if self.dp and self.dp.runmode.value in ('backtest', 'hyperopt'):
|
||||||
|
Loading…
Reference in New Issue
Block a user