use get_all_locks to get locks for backtest result

This commit is contained in:
Matthias 2021-02-07 10:49:47 +01:00
parent e32b2097f0
commit 081b9be45c
2 changed files with 9 additions and 1 deletions

View File

@ -442,7 +442,7 @@ class Backtesting:
self.all_results[self.strategy.get_strategy_name()] = {
'results': results,
'config': self.strategy.config,
'locks': PairLocks.locks,
'locks': PairLocks.get_all_locks(),
'backtest_start_time': int(backtest_start_time.timestamp()),
'backtest_end_time': int(backtest_end_time.timestamp()),
}

View File

@ -123,3 +123,11 @@ class PairLocks():
now = datetime.now(timezone.utc)
return len(PairLocks.get_pair_locks(pair, now)) > 0 or PairLocks.is_global_lock(now)
@staticmethod
def get_all_locks() -> List[PairLock]:
if PairLocks.use_db:
return PairLock.query.all()
else:
return PairLocks.locks