2024-10-28 17:12:52 +01:00
|
|
|
import logging
|
|
|
|
|
|
|
|
|
|
from aiomql.lib.bot import Bot
|
2024-10-29 14:03:32 +01:00
|
|
|
from aiomql.contrib.strategies import Chaos
|
2024-10-28 17:12:52 +01:00
|
|
|
from aiomql.contrib.symbols import ForexSymbol
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def test_bot():
|
|
|
|
|
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
2024-10-29 14:03:32 +01:00
|
|
|
syms = ['BTCUSD', 'SOLUSD', 'ETHUSD']
|
2024-10-28 17:12:52 +01:00
|
|
|
symbols = [ForexSymbol(name=sym) for sym in syms]
|
|
|
|
|
stgs = [Chaos(symbol=symbol, name='test_chaos') for symbol in symbols]
|
|
|
|
|
bot = Bot()
|
|
|
|
|
assert bot.config.shutdown is False
|
|
|
|
|
bot.executor.timeout = 30
|
|
|
|
|
bot.add_strategies(strategies=stgs)
|
|
|
|
|
await bot.initialize()
|
2024-10-29 14:03:32 +01:00
|
|
|
await bot.executor.execute()
|
2024-10-28 17:12:52 +01:00
|
|
|
assert bot.executor.no_of_running_strategies == 3
|
|
|
|
|
assert len(bot.executor.coroutines) == 1
|
|
|
|
|
assert len(bot.executor.coroutine_threads) == 1
|
|
|
|
|
assert bot.config.shutdown is True
|