set is_open to false on sell order

This commit is contained in:
Eoin 2017-09-27 23:47:17 +01:00
parent 2bd51d8be3
commit 00f23af0ec
2 changed files with 2 additions and 0 deletions

View File

@ -83,6 +83,7 @@ class Trade(Base):
self.close_profit = profit self.close_profit = profit
self.close_date = datetime.utcnow() self.close_date = datetime.utcnow()
self.open_order_id = order_id self.open_order_id = order_id
self.is_open = False
# Flush changes # Flush changes
Trade.session.flush() Trade.session.flush()

View File

@ -22,6 +22,7 @@ class TestTrade(unittest.TestCase):
self.assertEqual(trade.close_rate, 1.0) self.assertEqual(trade.close_rate, 1.0)
self.assertEqual(trade.close_profit, profit) self.assertEqual(trade.close_profit, profit)
self.assertIsNotNone(trade.close_date) self.assertIsNotNone(trade.close_date)
self.assertFalse(trade.is_open)
if __name__ == '__main__': if __name__ == '__main__':