ricequant / rqalpha-mod-ctp

RQAlpha 对接 ctp 的扩展 Mod。通过启用该 Mod 来实现期货策略的实盘交易
Apache License 2.0
233 stars 36 forks source link

ERROR NotImplementedError运行run_code_demo时候,启用了ctp mod,用的ubuntu #9

Open Albert819 opened 6 years ago

Albert819 commented 6 years ago

(rqalpha) albert@albert-ThinkPad-X240:~/Documents/rqalpha-master/rqalpha/examples$ python run_code_demo.py [2018-07-25 21:14:22.792825] DEBUG: basic_system_log: {'base': {'accounts': {'STOCK': 100000.0}, 'benchmark': '000300.XSHG', 'data_bundle_path': '/home/albert/.rqalpha/bundle', 'end_date': datetime.date(2016, 12, 1), 'frequency': '1d', 'init_positions': [], 'margin_multiplier': 1, 'persist': False, 'persist_mode': PERSIST_MODE.REAL_TIME, 'resume_mode': False, 'run_type': RUN_TYPE.BACKTEST, 'source_code': None, 'start_date': datetime.date(2016, 6, 1), 'strategy_file': 'strategy.py'}, 'extra': {'context_vars': None, 'dividend_reinvestment': False, 'enable_profiler': False, 'force_run_init_when_pt_resume': False, 'is_hold': False, 'locale': 'zh_Hans_CN', 'log_level': 'verbose', 'logger': [], 'user_log_disabled': False, 'user_system_log_disabled': False}, 'mod': {'ctp': {'enabled': True}, 'sys_accounts': {'enabled': True}, 'sys_analyser': {'enabled': True, 'plot': False}, 'sys_funcat': {'enabled': True}, 'sys_progress': {'enabled': True}, 'sys_risk': {'enabled': True}, 'sys_simulation': {'enabled': True}, 'sys_stock_realtime': {'enabled': True}}, 'validator': {'cash_return_by_stock_delisted': False, 'close_amount': True}, 'version': '0.1.6', 'whitelist': ['base', 'extra', 'validator', 'mod']} [2018-07-25 21:14:22.793176] DEBUG: system_log: 载入 Mod rqalpha.mod.rqalpha_mod_sys_stock_realtime [2018-07-25 21:14:22.797903] DEBUG: system_log: 载入 Mod rqalpha.mod.rqalpha_mod_sys_progress [2018-07-25 21:14:22.798902] DEBUG: system_log: 载入 Mod rqalpha_mod_ctp [2018-07-25 21:14:22.866060] DEBUG: system_log: 载入 Mod rqalpha.mod.rqalpha_mod_sys_analyser [2018-07-25 21:14:22.868335] DEBUG: system_log: 载入 Mod rqalpha.mod.rqalpha_mod_sys_risk [2018-07-25 21:14:22.870913] DEBUG: system_log: 载入 Mod rqalpha.mod.rqalpha_mod_sys_funcat [2018-07-25 21:14:22.872032] DEBUG: system_log: 载入 Mod rqalpha.mod.rqalpha_mod_sys_accounts [2018-07-25 21:14:22.876399] DEBUG: system_log: 载入 Mod rqalpha.mod.rqalpha_mod_sys_simulation [2018-07-25 21:14:22.881988] DEBUG: basic_system_log: mod start_up [START] sys_progress [2018-07-25 21:14:22.882208] DEBUG: basic_system_log: mod start_up [END] sys_progress [2018-07-25 21:14:22.882348] DEBUG: basic_system_log: mod start_up [START] ctp [2018-07-25 21:14:23.885803] INFO: system_log: CTP 交易服务器登录成功 [2018-07-25 21:14:23.886303] INFO: system_log: 同步数据中。 [2018-07-25 21:14:29.890243] DEBUG: system_log: 516 条合约数据返回。 [2018-07-25 21:14:30.898113] DEBUG: system_log: 账户数据返回: {'yesterday_portfolio_value': 1006723.0} [2018-07-25 21:14:31.900022] DEBUG: system_log: 持仓数据返回: dict_keys(['MA1809'])。 [2018-07-25 21:14:32.902004] DEBUG: system_log: 订单数据返回 [2018-07-25 21:14:33.906924] DEBUG: system_log: 费率数据返回 [2018-07-25 21:14:38.912597] INFO: system_log: 数据同步完成。 [2018-07-25 21:14:39.936053] INFO: system_log: CTP 行情服务器登录成功 [2018-07-25 21:14:39.940778] INFO: system_log: 数据同步完成。 [2018-07-25 21:14:41.494921] DEBUG: basic_system_log: mod start_up [END] ctp [2018-07-25 21:14:41.495154] DEBUG: basic_system_log: mod start_up [START] sys_analyser [2018-07-25 21:14:41.495346] DEBUG: basic_system_log: mod start_up [END] sys_analyser [2018-07-25 21:14:41.495490] DEBUG: basic_system_log: mod start_up [START] sys_risk [2018-07-25 21:14:41.495675] DEBUG: basic_system_log: mod start_up [END] sys_risk [2018-07-25 21:14:41.495838] DEBUG: basic_system_log: mod start_up [START] sys_funcat [2018-07-25 21:14:41.561947] DEBUG: basic_system_log: mod start_up [END] sys_funcat [2018-07-25 21:14:41.562168] DEBUG: basic_system_log: mod start_up [START] sys_accounts [2018-07-25 21:14:41.562410] DEBUG: basic_system_log: mod start_up [END] sys_accounts [2018-07-25 21:14:41.562555] DEBUG: basic_system_log: mod start_up [START] sys_simulation [2018-07-25 21:14:41.562817] DEBUG: basic_system_log: mod start_up [END] sys_simulation [2018-07-25 21:14:41.562952] DEBUG: basic_system_log: mod start_up [START] sys_stock_realtime [2018-07-25 21:14:41.563084] DEBUG: basic_system_log: mod start_up [END] sys_stock_realtime Traceback (most recent call last): File "/home/albert/.conda/envs/rqalpha/lib/python3.5/site-packages/rqalpha/main.py", line 210, in run _adjust_start_date(env.config, env.data_proxy) │ │ └ <rqalpha.environment.Environment object at 0x7feeece83860> │ └ <rqalpha.environment.Environment object at 0x7feeece83860> └ <function _adjust_start_date at 0x7feeed59e6a8> File "/home/albert/.conda/envs/rqalpha/lib/python3.5/site-packages/rqalpha/main.py", line 64, in _adjust_start_date start, end = data_proxy.available_data_range(config.base.frequency) │ └ {'base': {'accounts': {'STOCK': 100000.0}, 'benchmark': '000300.XSHG', 'data_bundle_path': '/home/albert/.rqalpha/bundle', 'e... └ <rqalpha.data.data_proxy.DataProxy object at 0x7feeece831d0> File "/home/albert/.conda/envs/rqalpha/lib/python3.5/site-packages/rqalpha/data/data_proxy.py", line 172, in available_data_range return self._data_source.available_data_range(frequency) │ └ '1d' └ <rqalpha.data.data_proxy.DataProxy object at 0x7feeece831d0> File "/home/albert/.conda/envs/rqalpha/lib/python3.5/site-packages/rqalpha_mod_ctp/ctp_data_source.py", line 43, in available_data_range raise NotImplementedError NotImplementedError 2018-07-25 ERROR [2018-07-25 21:14:41.751100] ERROR: system_log: 策略运行产生异常 Traceback (most recent call last): File "/home/albert/.conda/envs/rqalpha/lib/python3.5/site-packages/rqalpha/main.py", line 210, in run _adjust_start_date(env.config, env.data_proxy) File "/home/albert/.conda/envs/rqalpha/lib/python3.5/site-packages/rqalpha/main.py", line 64, in _adjust_start_date start, end = data_proxy.available_data_range(config.base.frequency) File "/home/albert/.conda/envs/rqalpha/lib/python3.5/site-packages/rqalpha/data/data_proxy.py", line 172, in available_data_range return self._data_source.available_data_range(frequency) File "/home/albert/.conda/envs/rqalpha/lib/python3.5/site-packages/rqalpha_mod_ctp/ctp_data_source.py", line 43, in available_data_range raise NotImplementedError NotImplementedError [2018-07-25 21:14:41.751559] DEBUG: basic_system_log: mod tear_down [START] sys_stock_realtime [2018-07-25 21:14:41.751761] DEBUG: basic_system_log: mod tear_down [END] sys_stock_realtime [2018-07-25 21:14:41.751963] DEBUG: basic_system_log: mod tear_down [START] sys_simulation [2018-07-25 21:14:41.752203] DEBUG: basic_system_log: mod tear_down [END] sys_simulation [2018-07-25 21:14:41.752404] DEBUG: basic_system_log: mod tear_down [START] sys_accounts [2018-07-25 21:14:41.752609] DEBUG: basic_system_log: mod tear_down [END] sys_accounts [2018-07-25 21:14:41.752815] DEBUG: basic_system_log: mod tear_down [START] sys_funcat [2018-07-25 21:14:41.753017] DEBUG: basic_system_log: mod tear_down [END] sys_funcat [2018-07-25 21:14:41.753211] DEBUG: basic_system_log: mod tear_down [START] sys_risk [2018-07-25 21:14:41.753402] DEBUG: basic_system_log: mod tear_down [END] sys_risk [2018-07-25 21:14:41.753591] DEBUG: basic_system_log: mod tear_down [START] sys_analyser [2018-07-25 21:14:41.753814] DEBUG: basic_system_log: mod tear_down [END] sys_analyser [2018-07-25 21:14:41.754010] DEBUG: basic_system_log: mod tear_down [START] ctp [2018-07-25 21:14:41.754243] DEBUG: basic_system_log: mod tear_down [END] ctp [2018-07-25 21:14:41.754436] DEBUG: basic_system_log: mod tear_down [START] sys_progress [2018-07-25 21:14:41.754647] DEBUG: basic_system_log: mod tear_down [END] sys_progress (rqalpha) albert@albert-ThinkPad-X240:~/Documents/rqalpha-master/rqalpha/examples$ $ rqalpha version Current Version: (3, 0, 10)