Add integration test for Result and TradeRecords classes

rename unittests to unit
change TradeRecords.get_csv_records and TradeRecord.get_json_records methods to non-async.
This commit is contained in:
Ichinga Samuel
2024-10-09 00:16:40 +01:00
parent 76a947640f
commit 06061ec917
18 changed files with 116 additions and 15 deletions
+22
View File
@@ -0,0 +1,22 @@
from aiomql.lib.ram import RAM
class TestRAM:
@classmethod
def setup_class(cls):
cls.ram = RAM(min_amount=5, max_amount=10, loss_limit=3, open_limit=5)
async def test_get_amount(self):
res = await self.ram.get_amount()
assert self.ram.min_amount <= res <= self.ram.max_amount
async def test_checks(self, buy_order, sell_order, mt):
for i in range(self.ram.open_limit+1):
if i % 2 == 0:
await mt.order_send(buy_order)
else:
await mt.order_send(sell_order)
res1 = await self.ram.check_losing_positions()
res2 = await self.ram.check_open_positions()
assert res2 is False
assert isinstance(res1, bool)