Simplify tradingmode parsing
This commit is contained in:
parent
4f0a73010a
commit
8638e6fe47
@ -130,11 +130,8 @@ class Exchange:
|
||||
self._trades_pagination = self._ft_has['trades_pagination']
|
||||
self._trades_pagination_arg = self._ft_has['trades_pagination_arg']
|
||||
|
||||
self.trading_mode: TradingMode = (
|
||||
TradingMode(config.get('trading_mode'))
|
||||
if config.get('trading_mode')
|
||||
else TradingMode.SPOT
|
||||
)
|
||||
self.trading_mode = TradingMode(config.get('trading_mode', 'spot'))
|
||||
|
||||
self.collateral: Optional[Collateral] = (
|
||||
Collateral(config.get('collateral'))
|
||||
if config.get('collateral')
|
||||
|
@ -106,12 +106,9 @@ class FreqtradeBot(LoggingMixin):
|
||||
self._exit_lock = Lock()
|
||||
LoggingMixin.__init__(self, logger, timeframe_to_seconds(self.strategy.timeframe))
|
||||
|
||||
self.trading_mode: TradingMode = TradingMode.SPOT
|
||||
self.trading_mode = TradingMode(self.config.get('trading_mode', 'spot'))
|
||||
|
||||
self.collateral_type: Optional[Collateral] = None
|
||||
|
||||
if 'trading_mode' in self.config:
|
||||
self.trading_mode = TradingMode(self.config['trading_mode'])
|
||||
|
||||
if 'collateral_type' in self.config:
|
||||
self.collateral_type = Collateral(self.config['collateral_type'])
|
||||
|
||||
|
@ -18,6 +18,7 @@ from freqtrade.data.btanalysis import trade_list_to_dataframe
|
||||
from freqtrade.data.converter import trim_dataframe, trim_dataframes
|
||||
from freqtrade.data.dataprovider import DataProvider
|
||||
from freqtrade.enums import BacktestState, SellType
|
||||
from freqtrade.enums.tradingmode import TradingMode
|
||||
from freqtrade.exceptions import DependencyException, OperationalException
|
||||
from freqtrade.exchange import timeframe_to_minutes, timeframe_to_seconds
|
||||
from freqtrade.mixins import LoggingMixin
|
||||
@ -122,7 +123,8 @@ class Backtesting:
|
||||
|
||||
# TODO-lev: This should come from the configuration setting or better a
|
||||
# TODO-lev: combination of config/strategy "use_shorts"(?) and "can_short" from the exchange
|
||||
self._can_short = False
|
||||
self.trading_mode = TradingMode(config.get('trading_mode', 'spot'))
|
||||
self._can_short = self.trading_mode == TradingMode.MARGIN
|
||||
|
||||
self.progress = BTProgress()
|
||||
self.abort = False
|
||||
|
Loading…
Reference in New Issue
Block a user