From 2eb33707c93379a5a40bf7d2e6f6270d47563db8 Mon Sep 17 00:00:00 2001 From: incrementby1 Date: Wed, 27 Oct 2021 15:58:41 +0200 Subject: [PATCH] Undo changes --- freqtrade/configuration/configuration.py | 7 +------ freqtrade/freqtradebot.py | 18 ++++++------------ 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/freqtrade/configuration/configuration.py b/freqtrade/configuration/configuration.py index d4cf09821..9aa4b794e 100644 --- a/freqtrade/configuration/configuration.py +++ b/freqtrade/configuration/configuration.py @@ -137,12 +137,6 @@ class Configuration: setup_logging(config) def _process_trading_options(self, config: Dict[str, Any]) -> None: - - # Allow_position_stacking defaults to False - if not config.get('allow_position_stacking'): - config['allow_position_stacking'] = False - logger.info('Allow_position_stacking is set to ' + str(config['allow_position_stacking'])) - if config['runmode'] not in TRADING_MODES: return @@ -504,3 +498,4 @@ class Configuration: config['pairs'] = load_file(pairs_file) if 'pairs' in config: config['pairs'].sort() + diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 850cd1700..4def3747c 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -4,7 +4,7 @@ Freqtrade is the main module of this bot. It contains the class Freqtrade() import copy import logging import traceback -from datetime import datetime, timedelta, timezone +from datetime import datetime, timezone from math import isclose from threading import Lock from typing import Any, Dict, List, Optional @@ -359,12 +359,10 @@ class FreqtradeBot(LoggingMixin): logger.info("Active pair whitelist is empty.") return trades_created # Remove pairs for currently opened trades from the whitelist - # Allow rebuying of the same pair if allow_position_stacking is set to True - if not self.config['allow_position_stacking']: - for trade in Trade.get_open_trades(): - if trade.pair in whitelist: - whitelist.remove(trade.pair) - logger.debug('Ignoring %s in pair whitelist', trade.pair) + for trade in Trade.get_open_trades(): + if trade.pair in whitelist: + whitelist.remove(trade.pair) + logger.debug('Ignoring %s in pair whitelist', trade.pair) if not whitelist: logger.info("No currency pair in active pair whitelist, " @@ -594,11 +592,6 @@ class FreqtradeBot(LoggingMixin): self._notify_enter(trade, order_type) - # Lock pair for 1 timeframe duration to prevent immediate rebuys - if self.config['allow_position_stacking']: - self.strategy.lock_pair(trade.pair, datetime.now(timezone.utc) + timedelta(minutes=timeframe_to_minutes(self.config['timeframe'])), - reason='Prevent immediate rebuys') - return True def _notify_enter(self, trade: Trade, order_type: str) -> None: @@ -1436,3 +1429,4 @@ class FreqtradeBot(LoggingMixin): return max( min(valid_custom_price, max_custom_price_allowed), min_custom_price_allowed) +