From ad746627b339d243b4bcd9a15a1a54d4a4cb3051 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 27 Nov 2020 17:47:15 +0100 Subject: [PATCH] Fix lock-loop --- docs/developer.md | 4 ++-- freqtrade/freqtradebot.py | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/docs/developer.md b/docs/developer.md index ebfe8e013..6ea641edd 100644 --- a/docs/developer.md +++ b/docs/developer.md @@ -213,13 +213,13 @@ Protections can have 2 different ways to stop trading for a limited : ##### Protections - per pair Protections that implement the per pair approach must set `has_local_stop=True`. -The method `stop_per_pair()` will be called once, whenever a sell order is closed, and the trade is therefore closed. +The method `stop_per_pair()` will be called whenever a trade closed (sell order completed). ##### Protections - global protection These Protections should do their evaluation across all pairs, and consequently will also lock all pairs from trading (called a global PairLock). Global protection must set `has_global_stop=True` to be evaluated for global stops. -The method `global_stop()` will be called on every iteration, so they should not do too heavy calculations (or should cache the calculations across runs). +The method `global_stop()` will be called whenever a trade closed (sell order completed). ## Implement a new Exchange (WIP) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 1e0f5fdf0..ecc824a86 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -182,9 +182,6 @@ class FreqtradeBot(LoggingMixin): # First process current opened trades (positions) self.exit_positions(trades) - # Evaluate if protections should apply - self.protections.global_stop() - # Then looking for buy opportunities if self.get_free_open_trades(): self.enter_positions() @@ -1431,8 +1428,7 @@ class FreqtradeBot(LoggingMixin): # Updating wallets when order is closed if not trade.is_open: self.protections.stop_per_pair(trade.pair) - # Evaluate if protections should apply - # self.protections.global_stop() + self.protections.global_stop() self.wallets.update() return False