Add Trade.commit method for easy use

This commit is contained in:
Matthias
2021-04-15 07:57:52 +02:00
parent 6fb32c3594
commit a01d05997e
4 changed files with 15 additions and 10 deletions

View File

@@ -74,7 +74,7 @@ def cleanup_db() -> None:
Flushes all pending operations to disk.
:return: None
"""
Trade.query.session.commit()
Trade.commit()
def clean_dry_run_db() -> None:
@@ -86,7 +86,7 @@ def clean_dry_run_db() -> None:
# Check we are updating only a dry_run order not a prod one
if 'dry_run' in trade.open_order_id:
trade.open_order_id = None
Trade.query.session.commit()
Trade.commit()
class Order(_DECL_BASE):
@@ -711,6 +711,10 @@ class Trade(_DECL_BASE, LocalTrade):
Order.query.session.delete(order)
Trade.query.session.delete(self)
Trade.commit()
@staticmethod
def commit():
Trade.query.session.commit()
@staticmethod