Don't fail if strategy doesn't contain sell signal

This commit is contained in:
Matthias
2021-08-02 20:17:58 +02:00
parent d8d8261f1b
commit c981641441
2 changed files with 26 additions and 7 deletions

View File

@@ -483,8 +483,6 @@ class IStrategy(ABC, HyperStrategyMixin):
message = "No dataframe returned (return statement missing?)."
elif 'buy' not in dataframe:
message = "Buy column not set."
elif 'sell' not in dataframe:
message = "Sell column not set."
elif df_len != len(dataframe):
message = message_template.format("length")
elif df_close != dataframe["close"].iloc[-1]:
@@ -531,7 +529,11 @@ class IStrategy(ABC, HyperStrategyMixin):
return False, False, None
buy = latest[SignalType.BUY.value] == 1
sell = latest[SignalType.SELL.value] == 1
sell = False
if SignalType.SELL.value in latest:
sell = latest[SignalType.SELL.value] == 1
buy_tag = latest.get(SignalTagType.BUY_TAG.value, None)
logger.debug('trigger: %s (pair=%s) buy=%s sell=%s',