From 110c7c39c7b7b0030ee806c3375cac1bbbdcebbb Mon Sep 17 00:00:00 2001 From: Ichinga Samuel Date: Sun, 10 Nov 2024 13:34:10 +0100 Subject: [PATCH] v4 --- ruff.toml | 4 ++++ src/aiomql/lib/candle.py | 2 -- tests/live/integration/test_bot.py | 2 +- tests/live/integration/test_bot_sync.py | 2 +- tests/live/unit/test_backtest_engine.py | 4 ++-- 5 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 ruff.toml diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..f60458b --- /dev/null +++ b/ruff.toml @@ -0,0 +1,4 @@ +line-length = 150 +target-version = "py311" +[format] +skip-magic-trailing-comma=true diff --git a/src/aiomql/lib/candle.py b/src/aiomql/lib/candle.py index 7f97d8e..87ea65d 100644 --- a/src/aiomql/lib/candle.py +++ b/src/aiomql/lib/candle.py @@ -4,9 +4,7 @@ from typing import Type, Self, Iterable from logging import getLogger from pandas import DataFrame, Series -import pandas as pd import pandas_ta as ta -import mplfinance as mplt from ..core.constants import TimeFrame diff --git a/tests/live/integration/test_bot.py b/tests/live/integration/test_bot.py index c03203b..bbc679d 100644 --- a/tests/live/integration/test_bot.py +++ b/tests/live/integration/test_bot.py @@ -14,7 +14,7 @@ async def test_bot(): symbols = [ForexSymbol(name=sym) for sym in syms] strategies = [Chaos(symbol=symbol, name="test_chaos") for symbol in symbols] bot = Bot() - assert bot.config.shutdown is False + bot.config.task_queue.worker_timeout = 2 bot.executor.timeout = 10 bot.add_strategies(strategies=strategies) await bot.initialize() diff --git a/tests/live/integration/test_bot_sync.py b/tests/live/integration/test_bot_sync.py index 5b6c26f..9bf8a75 100644 --- a/tests/live/integration/test_bot_sync.py +++ b/tests/live/integration/test_bot_sync.py @@ -14,7 +14,7 @@ def test_bot_sync(): symbols = [ForexSymbol(name=sym) for sym in syms] strategies = [Chaos(symbol=symbol, name="test_chaos") for symbol in symbols] bot = Bot() - assert bot.config.shutdown is False + bot.config.task_queue.worker_timeout = 2 bot.executor.timeout = 10 bot.add_strategies(strategies=strategies) bot.initialize_sync() diff --git a/tests/live/unit/test_backtest_engine.py b/tests/live/unit/test_backtest_engine.py index 39e3034..9b83a03 100644 --- a/tests/live/unit/test_backtest_engine.py +++ b/tests/live/unit/test_backtest_engine.py @@ -1,5 +1,5 @@ from datetime import datetime, UTC - +from math import ceil from aiomql import TimeFrame from aiomql.core.backtesting import BackTestEngine from aiomql.core.backtesting.get_data import GetData @@ -304,7 +304,7 @@ class TestBackTestEngine: price_open=sym_info2.ask, price_close=tp2, ) - assert profit == profit2 + assert ceil(profit) == ceil(profit2) async def test_order_margin(self, bte2): moment = datetime(2024, 2, 3, 12, 12, tzinfo=UTC)