Apply all stops in the list, even if the first would apply already

This commit is contained in:
Matthias 2020-11-15 11:41:48 +01:00
parent 9484ee6690
commit 5133675988
1 changed files with 6 additions and 5 deletions

View File

@ -48,21 +48,22 @@ class ProtectionManager():
def global_stop(self) -> bool:
now = datetime.now(timezone.utc)
result = False
for protection_handler in self._protection_handlers:
result, until, reason = protection_handler.global_stop(now)
# Early stopping - first positive result blocks further trades
if result and until:
PairLocks.lock_pair('*', until, reason)
return True
return False
result = True
return result
def stop_per_pair(self, pair) -> bool:
now = datetime.now(timezone.utc)
result = False
for protection_handler in self._protection_handlers:
result, until, reason = protection_handler.stop_per_pair(pair, now)
if result and until:
PairLocks.lock_pair(pair, until, reason)
return True
return False
result = True
return result