Closed fswzb closed 7 years ago
可否把您使用 mod 的情况贴一下,主要是如何使用的以及rqalpha 的版本等。
from rqalpha.interface import AbstractMod
from .data_source import TushareKDataSource
class TushareMod(AbstractMod): def init(self): pass
def start_up(self, env, mod_config):
bundle_path = env.config.base.data_bundle_path
env.set_data_source(TushareKDataSource(bundle_path))
def tear_down(self, code, exception=None):
pass
rqalpha2.07
tushare1: lib: 'rqalpha.mod.tushare1'#rqalpha.mod. enabled: True priority: 100
多谢指导,设置rqalpha.mod.rqalpha_mod_tushare1后还有问题:
C:\Python35\python.exe C:/www/huice/rqalpha/rqalpha run -f C:\www\huice\rqalpha\rqalpha\examples\buy_and_hold.py --stock-starting-cash 100000 -s 2015-01-01 -e 2016-08-09 -mc tushare1.enable True
0000-00-00 ERROR dict must be set to a dictionary, not a 'set'
[2017-04-08 23:15:05.855694] ERROR: system_log: 策略运行产生异常
Traceback (most recent call last):
File "C:/www/huice/rqalpha/rqalpha\main.py", line 190, in run
mod_handler.set_env(env)
File "C:\www\huice\rqalpha\rqalpha\mod__init.py", line 57, in set_env
mod_config = RqAttrDict(copy.deepcopy(getattr(mod_module, "config", {})))
File "C:\www\huice\rqalpha\rqalpha\utils__init.py", line 50, in init
self.dict = d if d is not None else dict()
TypeError: dict must be set to a dictionary, not a 'set'
Traceback (most recent call last):
File "C:\Python35\lib\runpy.py", line 170, in _run_module_as_main
"main", mod_spec)
File "C:\Python35\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
�� �� {'package': '', 'generate_config': <click.core.Command object at 0x05181530>, 'update_bundle': <click.core.Command object at...
�� <code object
在./rqalpha/mod_config.yml 修改添加: tushare1: lib: 'rqalpha.mod.rqalpha_mod_tushare1'#rqalpha.mod. enabled: True priority: 100 测试不能导入tushare1的问题解决,谢谢@宝可梦的狗的指导
C:\Python35\python.exe C:/www/huice/rqalpha/rqalpha run -f C:\www\huice\rqalpha\rqalpha\examples\golden_cross.py --stock-starting-cash 100000 -s 2015-01-01 -e 2016-08-09 -mc tushare1.enable True [2017-04-08 21:46:34.427020] ERROR: system_log: ** [2017-04-08 21:46:34.427020] ERROR: system_log: Mod Import Error: [2017-04-08 21:46:34.427020] ERROR: system_log: No module named 'tushare1' [2017-04-08 21:46:34.427020] ERROR: system_log: ** 0000-00-00 ERROR [2017-04-08 21:46:34.786387] ERROR: system_log: 策略运行产生异常 Traceback (most recent call last): File "C:/www/huice/rqalpha/rqalpha\main.py", line 208, in run assert broker is not None AssertionError
Process finished with exit code 0