Close all positions on demo account when exiting tests

This commit is contained in:
Mark Veidemanis 2023-01-05 17:25:22 +00:00
parent b8b39ea8d3
commit a6f9e74ee1
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
2 changed files with 10 additions and 0 deletions

View File

@ -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()

View File

@ -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.
"""