vn.py量化社区
By Traders, For Traders.
Member
avatar
加入于:
帖子: 2
声望: 0

Tushare 日期数据格式为 YYYYMMDD,我在VN Trander 的数据管理从CSV文件导入数据设置对话框中时间格式设为YYYYMMDD,出现以下出错信息,请问怎么处理?谢谢!
Traceback (most recent call last):
File "c:\vnstudio\lib\site-packages\vnpy\app\data_manager\ui\widget.py", line 230, in import_data
datetime_format
File "c:\vnstudio\lib\site-packages\vnpy\app\data_manager\engine.py", line 54, in import_data_from_csv
dt = datetime.strptime(item[datetime_head], datetime_format)
File "c:\vnstudio\lib_strptime.py", line 577, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "c:\vnstudio\lib_strptime.py", line 359, in _strptime
(data_string, format))
ValueError: time data 'CU1811.SHF' does not match format 'YYYYMMDD'

Member
avatar
加入于:
帖子: 2013
声望: 133
  1. 你的合约名应该是’CU1811.SHFE‘吧;
  2. 你的时间那一栏填成了合约那一栏
Member
avatar
加入于:
帖子: 2
声望: 0

对齐栏后还是出现以下出错信息,不知什么原因:

Traceback (most recent call last):
File "c:\vnstudio\lib\site-packages\vnpy\app\data_manager\ui\widget.py", line 230, in import_data
datetime_format
File "c:\vnstudio\lib\site-packages\vnpy\app\data_manager\engine.py", line 54, in import_data_from_csv
dt = datetime.strptime(item[datetime_head], datetime_format)
File "c:\vnstudio\lib_strptime.py", line 577, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "c:\vnstudio\lib_strptime.py", line 359, in _strptime
(data_string, format))
ValueError: time data '20181113' does not match format 'YYYYMMDD'

Administrator
avatar
加入于:
帖子: 4595
声望: 262

%Y%m%d,这么写

© 2015-2019 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号-3

沪公网安备 31011502017034号