Implement global stop (First try)

This commit is contained in:
Matthias
2020-10-14 20:03:56 +02:00
parent 246b4a57a4
commit f39a534fc0
6 changed files with 23 additions and 9 deletions

View File

@@ -23,6 +23,7 @@ from freqtrade.exchange import timeframe_to_minutes
from freqtrade.misc import safe_value_fallback, safe_value_fallback2
from freqtrade.pairlist.pairlistmanager import PairListManager
from freqtrade.persistence import Order, PairLocks, Trade, cleanup_db, init_db
from freqtrade.plugins.protectionmanager import ProtectionManager
from freqtrade.resolvers import ExchangeResolver, StrategyResolver
from freqtrade.rpc import RPCManager, RPCMessageType
from freqtrade.state import State
@@ -78,6 +79,8 @@ class FreqtradeBot:
self.dataprovider = DataProvider(self.config, self.exchange, self.pairlists)
self.protections = ProtectionManager(self.config)
# Attach Dataprovider to Strategy baseclass
IStrategy.dp = self.dataprovider
# Attach Wallets to Strategy baseclass
@@ -178,7 +181,7 @@ class FreqtradeBot:
self.exit_positions(trades)
# Then looking for buy opportunities
if self.get_free_open_trades():
if self.get_free_open_trades() and not self.protections.global_stop():
self.enter_positions()
Trade.session.flush()