mirror of
https://github.com/Ichinga-Samuel/aiomql.git
synced 2026-08-17 22:08:06 +00:00
v4
This commit is contained in:
@@ -150,10 +150,10 @@ async def test_wrapup(positions, buy_order, sell_order, backtest_engine, config)
|
||||
backtest_engine.fast_forward(steps=5000)
|
||||
await backtest_engine.tracker()
|
||||
await positions.close_position_by_ticket(ticket=bo.order)
|
||||
await backtest_engine.wrap_up()
|
||||
last_balance = backtest_engine._account.balance
|
||||
last_equity = backtest_engine._account.equity
|
||||
last_profit = backtest_engine._account.profit
|
||||
await backtest_engine.wrap_up()
|
||||
tdata = GetData.load_data(name=config.backtest_dir / f"{backtest_engine.name}.pkl")
|
||||
new_bte = BackTestEngine(
|
||||
data=tdata, restart=False, assign_to_config=False, preload=False
|
||||
|
||||
@@ -22,4 +22,3 @@ def test_bot_sync():
|
||||
assert len(bot.executor.strategy_runners) == 3
|
||||
assert len(bot.executor.coroutines) == 1
|
||||
assert len(bot.executor.coroutine_threads) == 1
|
||||
assert bot.config.shutdown is True
|
||||
|
||||
@@ -144,6 +144,12 @@ class TestBackTestEngine:
|
||||
assert acc.margin_free == 62.5
|
||||
assert acc.margin_level == 2600
|
||||
|
||||
def test_account_sync(self):
|
||||
balance = 200
|
||||
self.bte.setup_account_sync(balance=balance)
|
||||
acc = self.bte.get_account_info()
|
||||
assert acc.balance == balance
|
||||
|
||||
async def test_bte2_init(self, bte2):
|
||||
assert bte2._data.fully_loaded is True
|
||||
assert bte2.span == self.bte.span
|
||||
|
||||
@@ -25,6 +25,6 @@ class TestPositions:
|
||||
|
||||
async def test_get_position_by_symbol(self):
|
||||
symbol = self.positions.positions[0].symbol
|
||||
positions = await self.positions.get_position_by_symbol(symbol=symbol)
|
||||
positions = await self.positions.get_positions_by_symbol(symbol=symbol)
|
||||
assert len(positions) >= 0
|
||||
assert positions[0].symbol == symbol
|
||||
|
||||
Reference in New Issue
Block a user