VeighNa量化社区
你的开源社区量化交易平台
Member
avatar
加入于:
帖子: 31
声望: 0

群主,您好

使用历史测试,数据量大概只有5万左右,tick模式,在for d in self.dbCursor:的位置报错的,比较难找出如何进行优化处理的,数据量小的时候大概2、3万没出这个错误的。
请帮忙指导下如何解决,谢谢!(我从ctaBacktesting.py拷贝的这个文件拷贝了引擎类,没动核心的东西的。)
截图如下:
enter image description here

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

数据量:70553

Member
avatar
加入于:
帖子: 141
声望: 57

self.dbCursor = collection.find(flt,no_cursor_timeout = True).sort('datetime').batch_size(100) #设置no_cursor_timeout = True,永不超时,游标连接不会主动关闭,需要手动关闭.设置batch_size返回文档数find(flt,max_time_ms=5000) #限制超时时间毫秒
for d in self.dbCursor:
data = dataClass()
data.dict = d
func(data)
self.dbCursor.close()

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

上弦之月 wrote:

self.dbCursor = collection.find(flt,no_cursor_timeout = True).sort('datetime').batch_size(100) #设置no_cursor_timeout = True,永不超时,游标连接不会主动关闭,需要手动关闭.设置batch_size返回文档数find(flt,max_time_ms=5000) #限制超时时间毫秒
for d in self.dbCursor:
data = dataClass()
data.dict = d
func(data)
self.dbCursor.close()

======

大佬您好,
按照您提示的,分别作了对应设置,还是报错的,其中no_cursor_timeout = True 和 .batch_size(1) (查询过来的数据量没变的) 都做了设置的,还是在for d in self.dbCursor:的位置报错了。
恳请您百忙中再指导下,谢谢!

截图分别如下:
图1:
enter image description here
图2:
enter image description here

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

沪公网安备 31011502017034号

【用户协议】
【隐私政策】
【免责条款】