implement pairlock side further
This commit is contained in:
@@ -54,8 +54,9 @@ class ProtectionManager():
|
||||
if protection_handler.has_global_stop:
|
||||
lock = protection_handler.global_stop(date_now=now, side=side)
|
||||
if lock and lock.until:
|
||||
if not PairLocks.is_global_lock(lock.until):
|
||||
result = PairLocks.lock_pair('*', lock.until, lock.reason, now=now)
|
||||
if not PairLocks.is_global_lock(lock.until, lock.lock_side):
|
||||
result = PairLocks.lock_pair(
|
||||
'*', lock.until, lock.reason, now=now, side=lock.lock_side)
|
||||
return result
|
||||
|
||||
def stop_per_pair(self, pair, now: Optional[datetime] = None,
|
||||
@@ -68,6 +69,7 @@ class ProtectionManager():
|
||||
lock = protection_handler.stop_per_pair(
|
||||
pair=pair, date_now=now, side=side)
|
||||
if lock and lock.until:
|
||||
if not PairLocks.is_pair_locked(pair, lock.until):
|
||||
result = PairLocks.lock_pair(pair, lock.until, lock.reason, now=now)
|
||||
if not PairLocks.is_pair_locked(pair, lock.until, lock.lock_side):
|
||||
result = PairLocks.lock_pair(
|
||||
pair, lock.until, lock.reason, now=now, side=lock.lock_side)
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user