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

vnpy版本1.9.2
回测的时候把tb下的csv文件导入mongo一直显示No such file or directory: 'rb888_15min.csv。
文件名是没问题的,用loadCsv试了,也是一样的错。
请问要怎么处理?

代码:
from vnpy.trader.app.ctaStrategy.ctaHistoryData import loadTbCsv
if name == 'main':
loadMcCsv('rb888_15min.csv', 'VnTrader_15Min_DB', 'rb888')

报错:
IOError Traceback (most recent call last)

<ipython-input-17-d1383676aa80> in <module>()
1 from vnpy.trader.app.ctaStrategy.ctaHistoryData import loadTbCsv
2 if name == 'main':
----> 3 loadTbCsv('rb888_15min.csv', 'VnTrader_15Min_DB', 'rb888')

C:\Users\Administrator\Anaconda2\lib\site-packages\vnpy-1.9.2-py2.7.egg\vnpy\trader\app\ctaStrategy\ctaHistoryData.pyc in loadTbCsv(fileName, dbName, symbol)
118
119 # 读取数据和插入到数据库
--> 120 reader = csv.reader(file(fileName, 'r'))
121 for d in reader:
122 bar = VtBarData()

IOError: [Errno 2] No such file or directory: 'rb888_15min.csv'

Administrator
avatar
加入于:
帖子: 1899
声望: 85

请在csv所在的目录下来启动加载程序

Member
avatar
加入于:
帖子: 4
声望: 0

在csv所在目录下启动还是不可以
报错:
?级寥SV文件rb000_15min.csv中的数据插入到VnTrader_15Min_DB的rb000中
Traceback (most recent call last):
File "loadTbCsv.py", line 11, in <module>
loadTbCsv('rb000_15min.csv', 'VnTrader_15Min_DB', 'rb000')
File "C:\Users\Administrator\Anaconda2\lib\site-packages\vnpy-1.8.1-py2.7.egg\vnpy\trader\app\ctaStrategy\ctaHistoryData.py", line 126, in loadTbCsv
bar.open = float(d[1])
ValueError: could not convert string to float: 开盘价

Member
avatar
加入于:
帖子: 4
声望: 0

运行loadCsv.py
也会报错。
数据下载到20170714 15:00:00就停了,然后报错
?迦胪瓯希氖保?11.075000048Traceback (most recent call last):
File "loadCsv.py", line 12, in <module>
loadMcCsv('IF0000_1min.csv', MINUTE_DB_NAME, 'IF0000')
File "C:\Users\Administrator\Anaconda2\lib\site-packages\vnpy-1.8.1-py2.7.egg\vnpy\trader\app\ctaStrategy\ctaHistoryData.py", line 105, in loadMcCsv
print u'鎻掑叆瀹屾瘯锛岃€楁椂锛?s' % (time()-start)
IOError: [Errno 0] Error

Administrator
avatar
加入于:
帖子: 1899
声望: 85

CSV文件的表头格式,和loadMcCsv函数中的不一致导致的

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