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

程序并没有死,菜单栏什么的都能点开,只是行情停住了,委托列表里也没有显示已成交(OKEX的APP里显示实际已成交)

不知道大家有没有遇到过?是哪里有问题?

Administrator
avatar
加入于:
帖子: 1441
声望: 63

看看日志信息,和CMD中有没有任何报错输出?如果什么都没有突然断了,可能是OKEXF服务器那边挂了

Member
avatar
加入于:
帖子: 15
声望: 1

用Python的交易员 wrote:

看看日志信息,和CMD中有没有任何报错输出?如果什么都没有突然断了,可能是OKEXF服务器那边挂了

调试报错信息:
Traceback (most recent call last):
File "E:\vnstudio\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "E:\vnstudio\lib\threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "E:\python_work\vnpy2\vnpy\event\engine.py", line 60, in _run
self._process(event)
File "E:\python_work\vnpy2\vnpy\event\engine.py", line 73, in _process
[handler(event) for handler in self._handlers[event.type]]
File "E:\python_work\vnpy2\vnpy\event\engine.py", line 73, in <listcomp>
[handler(event) for handler in self._handlers[event.type]]
File "E:\python_work\vnpy2\vnpy\app\cta_strategy\engine.py", line 224, in process_position_event
self.offset_converter.update_position(position)
File "E:\python_work\vnpy2\vnpy\app\cta_strategy\converter.py", line 29, in update_position
holding.update_position(position)
File "E:\python_work\vnpy2\vnpy\app\cta_strategy\converter.py", line 124, in update_position
self.long_td = self.long_pos - self.long_yd
TypeError: unsupported operand type(s) for -: 'str' and 'int'

经过测试,只要开着“CTA策略”模块,哪怕里面是空的没有任何策略,行情是OKEXF的品种,此时只要有实际下单/撤单OKEXF该品种的行为(不包括本地停止单),行情就会不动,委托的状态一直都会是“提交中”。
而只要不开“CTA策略”模块,这些下单行为就不会影响行情。

其他gateway,比如说CTP也没有这样的问题。

Member
avatar
加入于:
帖子: 15
声望: 1

炉火正通红 wrote:

用Python的交易员 wrote:

看看日志信息,和CMD中有没有任何报错输出?如果什么都没有突然断了,可能是OKEXF服务器那边挂了

调试报错信息:
Traceback (most recent call last):
File "E:\vnstudio\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "E:\vnstudio\lib\threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "E:\python_work\vnpy2\vnpy\event\engine.py", line 60, in _run
self._process(event)
File "E:\python_work\vnpy2\vnpy\event\engine.py", line 73, in _process
[handler(event) for handler in self._handlers[event.type]]
File "E:\python_work\vnpy2\vnpy\event\engine.py", line 73, in <listcomp>
[handler(event) for handler in self._handlers[event.type]]
File "E:\python_work\vnpy2\vnpy\app\cta_strategy\engine.py", line 224, in process_position_event
self.offset_converter.update_position(position)
File "E:\python_work\vnpy2\vnpy\app\cta_strategy\converter.py", line 29, in update_position
holding.update_position(position)
File "E:\python_work\vnpy2\vnpy\app\cta_strategy\converter.py", line 124, in update_position
self.long_td = self.long_pos - self.long_yd
TypeError: unsupported operand type(s) for -: 'str' and 'int'

经过测试,只要开着“CTA策略”模块,哪怕里面是空的没有任何策略,行情是OKEXF的品种,此时只要有实际下单/撤单OKEXF该品种的行为(不包括本地停止单),行情就会不动,委托的状态一直都会是“提交中”。
而只要不开“CTA策略”模块,这些下单行为就不会影响行情。

其他gateway,比如说CTP也没有这样的问题。

找到原因,并修复Bug了。
把okexf_gateway里的on_query_position和on_position里的pos的volume转化为float就可以了,建议老师在主版本里修复下这个bug

pos = PositionData(
symbol=d["instrument_id"],
exchange=Exchange.OKEX,
direction=Direction.LONG,
volume=float(d["long_qty"]),
frozen=float(d["long_qty"]) - float(d["long_avail_qty"]),
price=d["long_avg_cost"],
pnl=d["realised_pnl"],
gateway_name=self.gateway_name,
)

Administrator
avatar
加入于:
帖子: 1441
声望: 63

收到,谢谢

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