This commit is contained in:
Ichinga Samuel
2024-11-04 00:32:51 +01:00
parent 2c46e18528
commit d65a8db1a2
85 changed files with 5071 additions and 2512 deletions
+20 -12
View File
@@ -33,7 +33,7 @@ class TestMetaTrader:
res = await self.mt.last_error()
assert isinstance(res, tuple)
assert res[0] == 1
assert res[1] == 'Success'
assert res[1] == "Success"
async def test_version(self):
res = await self.mt.version()
@@ -111,13 +111,19 @@ class TestMetaTrader:
assert res.shape[0] == 10
async def test_copy_ticks_from(self):
res = await self.mt.copy_ticks_from(self.symbol, self.start, 10, self.mt.COPY_TICKS_ALL)
res = await self.mt.copy_ticks_from(
self.symbol, self.start, 10, self.mt.COPY_TICKS_ALL
)
assert res is not None
assert res.shape[0] == 10
async def test_copy_ticks_range(self):
res = await self.mt.copy_ticks_range(self.symbol, self.start, self.end, self.mt.COPY_TICKS_ALL)
res2 = self.mt5.copy_ticks_range(self.symbol, self.start, self.end, self.mt5.COPY_TICKS_ALL)
res = await self.mt.copy_ticks_range(
self.symbol, self.start, self.end, self.mt.COPY_TICKS_ALL
)
res2 = self.mt5.copy_ticks_range(
self.symbol, self.start, self.end, self.mt5.COPY_TICKS_ALL
)
assert res is not None
assert res.shape[0] == res2.shape[0]
@@ -132,18 +138,20 @@ class TestMetaTrader:
assert len(res) == 0
async def test_order_calc_margin(self, sell_order):
price = sell_order['price']
volume = sell_order['volume']
type_ = sell_order['type']
price = sell_order["price"]
volume = sell_order["volume"]
type_ = sell_order["type"]
res = await self.mt.order_calc_margin(type_, self.symbol, volume, price)
assert isinstance(res, float)
async def test_order_calc_profit(self, buy_order):
volume = buy_order['volume']
price_open = buy_order['price']
price_close = buy_order['tp']
type_ = buy_order['type']
res = await self.mt.order_calc_profit(type_, self.symbol, volume, price_open, price_close)
volume = buy_order["volume"]
price_open = buy_order["price"]
price_close = buy_order["tp"]
type_ = buy_order["type"]
res = await self.mt.order_calc_profit(
type_, self.symbol, volume, price_open, price_close
)
assert isinstance(res, float)
async def test_order_check(self, buy_order):