[Mod] change strategy import function of pyd files

This commit is contained in:
vn.py 2019-08-06 22:40:11 +08:00
parent 7845fd7a0f
commit b5e9bdb559
2 changed files with 7 additions and 3 deletions

View File

@ -94,7 +94,11 @@ class BacktesterEngine(BaseEngine):
if filename.endswith(".py"): if filename.endswith(".py"):
strategy_module_name = ".".join( strategy_module_name = ".".join(
[module_name, filename.replace(".py", "")]) [module_name, filename.replace(".py", "")])
self.load_strategy_class_from_module(strategy_module_name) elif filename.endswith(".pyd"):
strategy_module_name = ".".join(
[module_name, filename.split(".")[0]])
self.load_strategy_class_from_module(strategy_module_name)
def load_strategy_class_from_module(self, module_name: str): def load_strategy_class_from_module(self, module_name: str):
""" """

View File

@ -755,9 +755,9 @@ class CtaEngine(BaseEngine):
if filename.endswith(".py"): if filename.endswith(".py"):
strategy_module_name = ".".join( strategy_module_name = ".".join(
[module_name, filename.replace(".py", "")]) [module_name, filename.replace(".py", "")])
elif filename.endswith(".cp37-win_amd64.pyd"): elif filename.endswith(".pyd"):
strategy_module_name = ".".join( strategy_module_name = ".".join(
[module_name, filename.replace(".cp37-win_amd64.pyd", "")]) [module_name, filename.split(".")[0]])
self.load_strategy_class_from_module(strategy_module_name) self.load_strategy_class_from_module(strategy_module_name)