set is_open to false on sell order
This commit is contained in:
parent
2bd51d8be3
commit
00f23af0ec
@ -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()
|
||||
|
@ -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__':
|
||||
|
Loading…
Reference in New Issue
Block a user