diff --git a/persistence.py b/persistence.py index dd917a750..03e245ec9 100644 --- a/persistence.py +++ b/persistence.py @@ -83,6 +83,7 @@ class Trade(Base): self.close_profit = profit self.close_date = datetime.utcnow() self.open_order_id = order_id + self.is_open = False # Flush changes Trade.session.flush() diff --git a/test/test_persistence.py b/test/test_persistence.py index 8875b0e78..850e5f6d9 100644 --- a/test/test_persistence.py +++ b/test/test_persistence.py @@ -22,6 +22,7 @@ class TestTrade(unittest.TestCase): self.assertEqual(trade.close_rate, 1.0) self.assertEqual(trade.close_profit, profit) self.assertIsNotNone(trade.close_date) + self.assertFalse(trade.is_open) if __name__ == '__main__':