From 6290f059ab9d5722371baeda87e2c3bd560edfea Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Fri, 27 Apr 2018 16:02:23 +0800 Subject: [PATCH] [Fix]Close #827 --- vnpy/trader/app/ctaStrategy/strategy/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vnpy/trader/app/ctaStrategy/strategy/__init__.py b/vnpy/trader/app/ctaStrategy/strategy/__init__.py index cdf0cb1a..7a14afa9 100644 --- a/vnpy/trader/app/ctaStrategy/strategy/__init__.py +++ b/vnpy/trader/app/ctaStrategy/strategy/__init__.py @@ -32,8 +32,8 @@ def loadStrategyModule(moduleName): path = os.path.abspath(os.path.dirname(__file__)) for root, subdirs, files in os.walk(path): for name in files: - # 只有文件名中包含strategy且非.pyc的文件,才是策略文件 - if 'strategy' in name and '.pyc' not in name: + # 只有文件名中包含strategy且以.py结尾的文件,才是策略文件 + if 'strategy' in name and name[-3:] == '.py': # 模块名称需要模块路径前缀 moduleName = 'vnpy.trader.app.ctaStrategy.strategy.' + name.replace('.py', '') loadStrategyModule(moduleName) @@ -43,8 +43,8 @@ for root, subdirs, files in os.walk(path): workingPath = os.getcwd() for root, subdirs, files in os.walk(workingPath): for name in files: - # 只有文件名中包含strategy且非.pyc的文件,才是策略文件 - if 'strategy' in name and '.pyc' not in name: + # 只有文件名中包含strategy且以.py结尾的文件,才是策略文件 + if 'strategy' in name and name[-3:] == '.py': # 模块名称无需前缀 moduleName = name.replace('.py', '') loadStrategyModule(moduleName)