Fix lock-loop

This commit is contained in:
Matthias 2020-11-27 17:47:15 +01:00
parent 397a15cb61
commit ad746627b3
2 changed files with 3 additions and 7 deletions

View File

@ -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)

View File

@ -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