Deleting must delete orders first

This commit is contained in:
Matthias
2020-09-06 14:27:36 +02:00
parent b7662722ba
commit a78d61150c
5 changed files with 10 additions and 8 deletions

View File

@@ -446,6 +446,14 @@ class Trade(_DECL_BASE):
def update_order(self, order: Dict) -> None:
Order.update_orders(self.orders, order)
def delete(self) -> None:
for order in self.orders:
Order.session.delete(order)
Trade.session.delete(self)
Trade.session.flush()
def _calc_open_trade_price(self) -> float:
"""
Calculate the open_rate including open_fee.