[Fix] strategy_module_name may be not defined
This commit is contained in:
parent
846ea95093
commit
5bb4a7135f
@ -91,14 +91,16 @@ class BacktesterEngine(BaseEngine):
|
|||||||
"""
|
"""
|
||||||
for dirpath, dirnames, filenames in os.walk(path):
|
for dirpath, dirnames, filenames in os.walk(path):
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
|
# Load python source code file
|
||||||
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)
|
||||||
|
# Load compiled pyd binary file
|
||||||
elif filename.endswith(".pyd"):
|
elif filename.endswith(".pyd"):
|
||||||
strategy_module_name = ".".join(
|
strategy_module_name = ".".join(
|
||||||
[module_name, filename.split(".")[0]])
|
[module_name, filename.split(".")[0]])
|
||||||
|
self.load_strategy_class_from_module(strategy_module_name)
|
||||||
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):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user