don't allow short trades in spot mode

This commit is contained in:
Matthias
2022-02-21 19:19:12 +01:00
parent c3c815e794
commit 70f4305dfa
7 changed files with 15 additions and 6 deletions

View File

@@ -14,6 +14,7 @@ from pandas import DataFrame
from freqtrade.constants import ListPairsWithTimeframes
from freqtrade.data.dataprovider import DataProvider
from freqtrade.enums import CandleType, SellType, SignalDirection, SignalTagType, SignalType
from freqtrade.enums.tradingmode import TradingMode
from freqtrade.exceptions import OperationalException, StrategyError
from freqtrade.exchange import timeframe_to_minutes, timeframe_to_seconds
from freqtrade.exchange.exchange import timeframe_to_next_date
@@ -765,7 +766,8 @@ class IStrategy(ABC, HyperStrategyMixin):
if enter_long == 1 and not any([exit_long, enter_short]):
enter_signal = SignalDirection.LONG
enter_tag_value = latest.get(SignalTagType.ENTER_TAG.value, None)
if enter_short == 1 and not any([exit_short, enter_long]):
if (self.config.get('trading_mode', TradingMode.SPOT) != TradingMode.SPOT
and enter_short == 1 and not any([exit_short, enter_long])):
enter_signal = SignalDirection.SHORT
enter_tag_value = latest.get(SignalTagType.ENTER_TAG.value, None)