ricequant / rqalpha

A extendable, replaceable Python algorithmic backtest && trading framework supporting multiple securities
http://rqalpha.io
Other
5.39k stars 1.62k forks source link

Pycharm 运行样例代码run_file_demo.py报错 #258

Closed Yuwenqing closed 6 years ago

Yuwenqing commented 6 years ago

1. RQAlpha的版本 3,0,9

2. Python的版本 3.6 64位

3. 是Windows 10 专业版

4. 您出现问题对应的源码/或者能复现问题的简易代码 以及对应的配置

logger.py

def format_exception(exc, value, tb): formatted, colored_source = better_exceptions.format_traceback(tb)

5. 您出现的错误堆栈日志信息

C:\ProgramData\Anaconda3\python.exe D:/MyWork/rqalpha-strategy/run_file_demo.py [2018-02-22 21:52:16.174717] DEBUG: basic_system_log: {'base': {'accounts': {'STOCK': 100000.0}, 'benchmark': '000300.XSHG', 'data_bundle_path': 'C:\Users\13918/.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': './buy_and_hold.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': {'sys_accounts': {'enabled': True}, 'sys_analyser': {'enabled': True, 'plot': True}, 'sys_funcat': {'enabled': False}, 'sys_progress': {'enabled': True}, 'sys_risk': {'enabled': True}, 'sys_simulation': {'enabled': True}, 'sys_stock_realtime': {'enabled': False}}, 'validator': {'cash_return_by_stock_delisted': False, 'close_amount': True}, 'version': '0.1.6', 'whitelist': ['base', 'extra', 'validator', 'mod']} [2018-02-22 21:52:16.174717] DEBUG: system_log: 载入 Mod rqalpha.mod.rqalpha_mod_sys_accounts [2018-02-22 21:52:16.179703] DEBUG: system_log: 载入 Mod rqalpha.mod.rqalpha_mod_sys_simulation [2018-02-22 21:52:16.185707] DEBUG: system_log: 载入 Mod rqalpha.mod.rqalpha_mod_sys_progress [2018-02-22 21:52:16.187708] DEBUG: system_log: 载入 Mod rqalpha.mod.rqalpha_mod_sys_risk [2018-02-22 21:52:16.190710] DEBUG: system_log: 载入 Mod rqalpha.mod.rqalpha_mod_sys_analyser [2018-02-22 21:52:16.192730] DEBUG: basic_system_log: mod start_up [START] sys_accounts [2018-02-22 21:52:16.192730] DEBUG: basic_system_log: mod start_up [END] sys_accounts [2018-02-22 21:52:16.192730] DEBUG: basic_system_log: mod start_up [START] sys_simulation [2018-02-22 21:52:16.192730] DEBUG: basic_system_log: mod start_up [END] sys_simulation [2018-02-22 21:52:16.192730] DEBUG: basic_system_log: mod start_up [START] sys_progress [2018-02-22 21:52:16.192730] DEBUG: basic_system_log: mod start_up [END] sys_progress [2018-02-22 21:52:16.193731] DEBUG: basic_system_log: mod start_up [START] sys_risk [2018-02-22 21:52:16.193731] DEBUG: basic_system_log: mod start_up [END] sys_risk [2018-02-22 21:52:16.193731] DEBUG: basic_system_log: mod start_up [START] sys_analyser [2018-02-22 21:52:16.193731] DEBUG: basic_system_log: mod start_up [END] sys_analyser Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\rqalpha\main.py", line 201, in run env.set_data_source(BaseDataSource(config.base.data_bundle_path)) File "C:\ProgramData\Anaconda3\lib\site-packages\rqalpha\data\base_data_source.py", line 44, in init raise RuntimeError('bundle path {} not exist'.format(os.path.abspath)) RuntimeError: bundle path <function abspath at 0x000001B8729D49D8> not exist

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:/MyWork/rqalpha-strategy/run_file_demo.py", line 27, in run_file(strategy_file_path, config) File "C:\ProgramData\Anaconda3\lib\site-packages\rqalpha__init__.py", line 97, in run_file return main.run(config) File "C:\ProgramData\Anaconda3\lib\site-packages\rqalpha\main.py", line 315, in run code = _exception_handler(user_exc) File "C:\ProgramData\Anaconda3\lib\site-packages\rqalpha\main.py", line 326, in _exception_handler better_exceptions.excepthook(e.error.exc_type, e.error.exc_val, e.error.exc_tb) File "C:\ProgramData\Anaconda3\lib\site-packages\better_exceptions__init__.py", line 53, in excepthook formatted = format_exception(exc, value, tb) File "C:\ProgramData\Anaconda3\lib\site-packages\rqalpha\utils\logger.py", line 35, in format_exception formatted, colored_source = better_exceptions.format_traceback(tb) AttributeError: module 'better_exceptions' has no attribute 'format_traceback'

Process finished with exit code 1

Yuwenqing commented 6 years ago

pip install better_exceptions==0.1.8