配置环境使用python 3.8,运行报错
{"fileno": "mgquant.mod:51", "level": "ERROR", "logtime": "2023-11-06 11:32:13.892", "message": ""}
{"fileno": "mgquant.mod:51", "level": "ERROR", "logtime": "2023-11-06 11:32:13.892", "message": "Mod Import Error: mgquant_mod_mindgo, error: No module named 'mgquant_mod_mindgo'"}
{"fileno": "mgquant.mod:51", "level": "ERROR", "logtime": "2023-11-06 11:32:13.892", "message": ""}
{"fileno": "main:19", "level": "ERROR", "logtime": "2023-11-06 11:32:13.892", "message": "\u7b56\u7565\u8fd0\u884c\u4ea7\u751f\u5f02\u5e38"}
Traceback (most recent call last):
File "mgquant\main.py", line 199, in mgquant.main.run
File "C:\Users\zcp\AppData\Local\Programs\Python\Python38\lib\site-packages\mgquant\mod_init_.py", line 51, in set_env
mod_module = import_mod(lib_name)
File "mgquant\utils\package_helper.py", line 28, in mgquant.utils.package_helper.import_mod
File "mgquant\utils\package_helper.py", line 23, in mgquant.utils.package_helper.import_mod
File "C:\Users\zcp\AppData\Local\Programs\Python\Python38\lib\importlib_init_.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "
File "
File "
ModuleNotFoundError: No module named 'mgquant_mod_mindgo'
{"fileno": "mgquant.mod:80", "level": "ERROR", "logtime": "2023-11-06 11:32:13.894", "message": "tear down fail for analyser"}
Traceback (most recent call last):
File "mgquant\main.py", line 199, in mgquant.main.run
File "C:\Users\zcp\AppData\Local\Programs\Python\Python38\lib\site-packages\mgquant\mod_init.py", line 51, in set_env
mod_module = import_mod(lib_name)
File "mgquant\utils\package_helper.py", line 28, in mgquant.utils.package_helper.import_mod
File "mgquant\utils\package_helper.py", line 23, in mgquant.utils.package_helper.import_mod
File "C:\Users\zcp\AppData\Local\Programs\Python\Python38\lib\importlib_init
return _bootstrap._gcd_import(name[level:], package, level)
File "
File "
File "
ModuleNotFoundError: No module named 'mgquant_mod_mindgo'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\zcp\AppData\Local\Programs\Python\Python38\lib\site-packages\mgquant\mod_init_.py", line 77, in tear_down
ret = self.mod_dict[mod_name].tear_down(*args)
KeyError: 'analyser'
{"fileno": "mgquant.mod:80", "level": "ERROR", "logtime": "2023-11-06 11:32:13.895", "message": "tear down fail for stock"}
Traceback (most recent call last):
File "mgquant\main.py", line 199, in mgquant.main.run
File "C:\Users\zcp\AppData\Local\Programs\Python\Python38\lib\site-packages\mgquant\mod_init.py", line 51, in set_env
mod_module = import_mod(lib_name)
File "mgquant\utils\package_helper.py", line 28, in mgquant.utils.package_helper.import_mod
File "mgquant\utils\package_helper.py", line 23, in mgquant.utils.package_helper.import_mod
File "C:\Users\zcp\AppData\Local\Programs\Python\Python38\lib\importlib_init_.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "
File "
File "
ModuleNotFoundError: No module named 'mgquant_mod_mindgo'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\zcp\AppData\Local\Programs\Python\Python38\lib\site-packages\mgquant\mod_init_.py", line 77, in tear_down
ret = self.mod_dict[mod_name].tear_down(*args)
KeyError: 'stock'
{"fileno": "mgquant.mod:80", "level": "ERROR", "logtime": "2023-11-06 11:32:13.898", "message": "tear down fail for mindgo"}
Traceback (most recent call last):
File "mgquant\main.py", line 199, in mgquant.main.run
File "C:\Users\zcp\AppData\Local\Programs\Python\Python38\lib\site-packages\mgquant\mod_init.py", line 51, in set_env
mod_module = import_mod(lib_name)
File "mgquant\utils\package_helper.py", line 28, in mgquant.utils.package_helper.import_mod
File "mgquant\utils\package_helper.py", line 23, in mgquant.utils.package_helper.import_mod
File "C:\Users\zcp\AppData\Local\Programs\Python\Python38\lib\importlib_init_.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "
File "
File "
ModuleNotFoundError: No module named 'mgquant_mod_mindgo'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\zcp\AppData\Local\Programs\Python\Python38\lib\site-packages\mgquant\mod_init_.py", line 77, in tear_down
ret = self.mod_dict[mod_name].tear_down(*args)
KeyError: 'mindgo'
Traceback (most recent call last):
File "D:/pyhton/project/myPyhonDemo/superMindSDK/test.py", line 19, in
btest = research_strategy(
File "mgquant\utils\lazyimport.py", line 157, in mgquant.utils.lazyimport.ScopeReplacer.call
File "supermind\mod\mindgo\utils\pyvalid.py", line 105, in supermind.mod.mindgo.utils.pyvalid.accepts.call.decorator_wrapper
File "supermind\mod\analyser\research_api.py", line 33, in supermind.mod.analyser.research_api.research_strategy
File "mgquant\main.py", line 330, in mgquant.main.run
File "mgquant\main.py", line 199, in mgquant.main.run
File "C:\Users\zcp\AppData\Local\Programs\Python\Python38\lib\site-packages\mgquant\mod_init
mod_module = import_mod(lib_name)
File "mgquant\utils\package_helper.py", line 28, in mgquant.utils.package_helper.import_mod
File "mgquant\utils\package_helper.py", line 23, in mgquant.utils.package_helper.import_mod
File "C:\Users\zcp\AppData\Local\Programs\Python\Python38\lib\importlib_init_.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "
File "
File "
ModuleNotFoundError: No module named 'mgquant_mod_mindgo'
环境下载的库如下
| Cython | 0.29.36 | |
|---|---|---|
| Logbook | 1.7.0 | 1.7.0 |
| Pillow | 10.1.0 | |
| PyYAML | 5.3.1 | 6.0.1 |
| Pygments | 2.16.1 | 2.16.1 |
| Send2Trash | 1.8.2 | |
| XlsxWriter | 3.1.9 | |
| asttokens | 2.4.1 | |
| backcall | 0.2.0 | 0.2.0 |
| bcolz-zipline | 1.2.6 | 1.2.6 |
| cachetools | 5.2.1 | 5.3.2 |
| certifi | 2023.7.22 | 2023.7.22 |
| charset-normalizer | 3.3.2 | |
| click | 8.1.7 | |
| colorama | 0.4.6 | |
| contourpy | 1.1.1 | |
| cycler | 0.12.1 | |
| decorator | 5.1.1 | |
| exceptiongroup | 1.1.3 | |
| executing | 2.0.1 | |
| fonttools | 4.43.1 | |
| idna | 3.4 | |
| importlib-resources | 6.1.0 | |
| iniconfig | 2.0.0 | |
| ipython | 8.12.3 | |
| jedi | 0.19.1 | |
| jsonpickle | 3.0.2 | |
| kiwisolver | 1.4.5 | |
| matplotlib | 3.7.3 | |
| matplotlib-inline | 0.1.6 | |
| mgquant | 3.2.0 | |
| msgpack | 1.0.7 | |
| numpy | 1.21.6 | |
| packaging | 23.2 | |
| pandas | 1.3.5 | |
| parso | 0.8.3 | |
| pickleshare | 0.7.5 | |
| pip | 19.2.3 | |
| pluggy | 1.3.0 | |
| prompt-toolkit | 3.0.39 | |
| protobuf | 3.20.3 | |
| pure-eval | 0.2.2 | |
| pyarrow | 8.0.0 | |
| pycryptodome | 3.19.0 | |
| pyparsing | 3.1.1 | |
| pytest | 7.4.3 | |
| python-dateutil | 2.8.2 | |
| python-snappy | 0.6.1 | |
| pytz | 2023.3.post1 | |
| requests | 2.28.2 | |
| setuptools | 41.2.0 | |
| simplejson | 3.19.2 | |
| six | 1.16.0 | |
| stack-data | 0.6.3 | |
| supermind | 0.2.1 | |
| tabulate | 0.9.0 | |
| tomli | 2.0.1 | |
| tqdm | 4.64.1 | |
| traitlets | 5.13.0 | |
| typing-extensions | 4.8.0 | |
| urllib3 | 1.26.18 | |
| wcwidth | 0.2.9 | |
| xarray | 2022.10.0 | |
| zipp | 3.17.0 |
策略代码如下:
source_code = """
def init(context):
context.s1 = ['000001.SZ','600000.SH']
subscribe(context.s1)
log.info('策略开始运行,初始化函数全局只运行一次')
def before_trading(context):
date = get_datetime().strftime('%Y-%m-%d %H:%M:%S')
log.info('{} 盘前运行'.format(date))
def handle_bar(context,bar_dict):
log.info(get_all_securities('stock',get_datetime().strftime('%Y-%m-%d')))
def after_trading(context):
date = get_datetime().strftime('%Y-%m-%d %H:%M:%S')
log.info('{} 盘后运行'.format(date))
"""
from supermind.api import *
btest = research_strategy(
source_code = source_code,
start_date=None,
end_date=None,
capital_base=float(10000000),
frequency='DAILY',
stock_market='STOCK',
benchmark=None
)

