Add rest endpoint for /locks

This commit is contained in:
Matthias
2020-10-17 17:58:07 +02:00
parent 7a9768ffa6
commit cd2866eaec
4 changed files with 49 additions and 4 deletions

View File

@@ -751,8 +751,11 @@ class PairLock(_DECL_BASE):
def to_json(self) -> Dict[str, Any]:
return {
'pair': self.pair,
'lock_time': self.lock_time,
'lock_end_time': self.lock_end_time,
'lock_time': self.lock_time.strftime("%Y-%m-%d %H:%M:%S"),
'lock_timestamp': int(self.lock_time.replace(tzinfo=timezone.utc).timestamp() * 1000),
'lock_end_time': self.lock_end_time.strftime("%Y-%m-%d %H:%M:%S"),
'lock_end_timestamp': int(self.lock_end_time.replace(tzinfo=timezone.utc
).timestamp() * 1000),
'reason': self.reason,
'active': self.active,
}