From f606d90107abe8186861f1caa404bddb50ed8e02 Mon Sep 17 00:00:00 2001 From: Joe Schr Date: Thu, 4 Mar 2021 19:30:12 +0100 Subject: [PATCH] fix(TrailingSL): check if `pair` exists in `custom_info` before accessing --- user_data/strategies/trailing_sl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_data/strategies/trailing_sl.py b/user_data/strategies/trailing_sl.py index dc166d4..00bd857 100644 --- a/user_data/strategies/trailing_sl.py +++ b/user_data/strategies/trailing_sl.py @@ -33,7 +33,7 @@ class TrailingSL(IStrategy): SL_INDICATOR_NAME = 'atr' 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/hyperopt. # in live / dry-run, it'll be really the current time relative_sl = None