This commit is contained in:
Ichinga Samuel
2025-08-25 06:31:47 +01:00
parent 7c1e7a93e5
commit b76580b86c
6 changed files with 6 additions and 13 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[project] [project]
name = "aiomql" name = "aiomql"
version = "4.0.15b2" version = "4.0.15"
readme = "README.md" readme = "README.md"
requires-python = ">=3.13" requires-python = ">=3.13"
classifiers = [ classifiers = [
@@ -38,9 +38,6 @@ class BackTestController:
cls._instance.tasks = [] cls._instance.tasks = []
return cls._instance return cls._instance
def __init__(self):
signal(SIGINT, self.sigint_handler)
@property @property
def backtest_engine(self): def backtest_engine(self):
"""Returns the backtest engine""" """Returns the backtest engine"""
@@ -64,10 +61,6 @@ class BackTestController:
"""Returns the number of parties for the barrier""" """Returns the number of parties for the barrier"""
return self.barrier.parties return self.barrier.parties
def sigint_handler(self, sig, frame):
logger.warning("SIGINT received. Stopping the controller.")
self.backtest_engine.stop_testing = True
async def control(self): async def control(self):
"""The backtest controller. It controls the backtesting engine and the tasks that are being run. """The backtest controller. It controls the backtesting engine and the tasks that are being run.
It acts as a synchronizer for the tasks and the backtesting engine. It acts as a synchronizer for the tasks and the backtesting engine.
+1 -1
View File
@@ -79,7 +79,7 @@ class Config:
if not hasattr(cls, "_instance"): if not hasattr(cls, "_instance"):
cls._lock = lock cls._lock = lock
cls._instance = super().__new__(cls) cls._instance = super().__new__(cls)
cls._instance.task_queue = TaskQueue(mode='infinite', workers=10) cls._instance.task_queue = TaskQueue(mode='infinite')
cls._instance.set_attributes(**cls._defaults) cls._instance.set_attributes(**cls._defaults)
cls._instance._backtest_engine = None cls._instance._backtest_engine = None
cls._instance.bot = None cls._instance.bot = None
-1
View File
@@ -102,7 +102,6 @@ class OrderType(Repr, IntEnum):
Properties: Properties:
opposite (int): Gets the opposite of an order type opposite (int): Gets the opposite of an order type
""" """
__enum_name__ = "ORDER_TYPE" __enum_name__ = "ORDER_TYPE"
BUY = mt5.ORDER_TYPE_BUY BUY = mt5.ORDER_TYPE_BUY
SELL = mt5.ORDER_TYPE_SELL SELL = mt5.ORDER_TYPE_SELL
+3 -2
View File
@@ -42,7 +42,7 @@ class Strategy(ABC):
config: Config config: Config
running: bool running: bool
parameters = {} parameters = {}
backtest_controller = BackTestController backtest_controller: BackTestController
current_session = Session current_session = Session
def __init__(self, *, symbol: Symbol, params: dict = None, sessions: Sessions = None, name=""): def __init__(self, *, symbol: Symbol, params: dict = None, sessions: Sessions = None, name=""):
@@ -62,7 +62,8 @@ class Strategy(ABC):
self.sessions = sessions or Sessions(sessions=[Session(start=0, end=dtime(hour=23, minute=59, second=59))]) self.sessions = sessions or Sessions(sessions=[Session(start=0, end=dtime(hour=23, minute=59, second=59))])
self.config = Config() self.config = Config()
self.mt5 = MetaTrader() if self.config.mode != "backtest" else MetaBackTester() self.mt5 = MetaTrader() if self.config.mode != "backtest" else MetaBackTester()
self.backtest_controller = BackTestController() if self.config.mode == "backtest":
self.backtest_controller = BackTestController()
def __repr__(self): def __repr__(self):
return f"{self.name}({self.symbol!r})" return f"{self.name}({self.symbol!r})"
Generated
+1 -1
View File
@@ -8,7 +8,7 @@ resolution-markers = [
[[package]] [[package]]
name = "aiomql" name = "aiomql"
version = "4.0.15b2" version = "4.0.15"
source = { virtual = "." } source = { virtual = "." }
dependencies = [ dependencies = [
{ name = "metatrader5" }, { name = "metatrader5" },