diff --git a/core/tests/helpers.py b/core/tests/helpers.py index c9b753a..cbd6aa3 100644 --- a/core/tests/helpers.py +++ b/core/tests/helpers.py @@ -32,6 +32,11 @@ class ElasticMock: class LiveBase: + @classmethod + def tearDownClass(cls): + cls.account.client.close_all_positions() + super(LiveBase, cls).tearDownClass() + @classmethod def setUpClass(cls): super(LiveBase, cls).setUpClass() diff --git a/core/tests/trading/test_live.py b/core/tests/trading/test_live.py index 74d15e3..27d0034 100644 --- a/core/tests/trading/test_live.py +++ b/core/tests/trading/test_live.py @@ -78,3 +78,8 @@ class LiveTradingTestCase(ElasticMock, LiveBase, TestCase): if not found: self.fail("Could not find the trade in the list of open trades") + + def test_convert_open_trades(self): + """ + Test converting open trades response to Trade-like format. + """