use get_all_locks to get locks for backtest result
This commit is contained in:
parent
e32b2097f0
commit
081b9be45c
@ -442,7 +442,7 @@ class Backtesting:
|
|||||||
self.all_results[self.strategy.get_strategy_name()] = {
|
self.all_results[self.strategy.get_strategy_name()] = {
|
||||||
'results': results,
|
'results': results,
|
||||||
'config': self.strategy.config,
|
'config': self.strategy.config,
|
||||||
'locks': PairLocks.locks,
|
'locks': PairLocks.get_all_locks(),
|
||||||
'backtest_start_time': int(backtest_start_time.timestamp()),
|
'backtest_start_time': int(backtest_start_time.timestamp()),
|
||||||
'backtest_end_time': int(backtest_end_time.timestamp()),
|
'backtest_end_time': int(backtest_end_time.timestamp()),
|
||||||
}
|
}
|
||||||
|
@ -123,3 +123,11 @@ class PairLocks():
|
|||||||
now = datetime.now(timezone.utc)
|
now = datetime.now(timezone.utc)
|
||||||
|
|
||||||
return len(PairLocks.get_pair_locks(pair, now)) > 0 or PairLocks.is_global_lock(now)
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user