Files
aiomql/tests/live/integration/test_bot.py
T

24 lines
841 B
Python
Raw Normal View History

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
2025-01-23 18:18:18 +01:00
logger = logging.getLogger(__name__)
2024-10-28 17:12:52 +01:00
2024-12-01 11:47:42 +01:00
async def test_bot():
2024-11-11 05:56:08 +01:00
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
2024-11-04 00:32:51 +01:00
syms = ["BTCUSD", "SOLUSD", "ETHUSD"]
2024-10-28 17:12:52 +01:00
symbols = [ForexSymbol(name=sym) for sym in syms]
2025-01-23 18:18:18 +01:00
strategies = [Chaos(symbol=symbol, name="test_chaos", params={"interval": 3}) for symbol in symbols]
2024-10-28 17:12:52 +01:00
bot = Bot()
2025-01-23 18:18:18 +01:00
bot.executor.timeout = 10
2024-11-04 00:32:51 +01:00
bot.add_strategies(strategies=strategies)
2024-10-28 17:12:52 +01:00
await bot.initialize()
2024-11-08 05:41:23 +01:00
bot.executor.execute()
2024-10-28 17:12:52 +01:00
assert len(bot.executor.coroutines) == 1
assert len(bot.executor.coroutine_threads) == 1
2025-01-23 18:18:18 +01:00
assert len(bot.executor.strategy_runners) == 3
2024-10-28 17:12:52 +01:00
assert bot.config.shutdown is True