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

description
XTP配置好,登录后,请教 哪里有XTP的DEMO?

Administrator
avatar
加入于:
帖子: 4466
声望: 255

没有专门针对XTP的DEMO,需要哪方面的功能呢?

Member
加入于:
帖子: 3
声望: 0

类似于 script_trader 的 demo_notebook.ipynb,里面的功能就行。
我现在 vnstation可以登陆 XTP模拟,并且交易。
但是 demo_notebook,调不通,不知道为啥。

=================================代码区
from vnpy.app.script_trader import init_cli_trading
from vnpy.gateway.xtp import xtp_gateway
setting = {
"账号": "XXXX",
"密码": "XXXX",
"客户号": 1,
"行情地址": "120.27.164.138",
"行情端口": 6002,
"交易地址": "120.27.164.69",
"交易端口": 6001,
"行情协议": "TCP",
"授权码": "XXXX"
}

engine = init_cli_trading([xtp_gateway])
engine.connect_gateway(setting, "XTP")

========================报错
TypeError Traceback (most recent call last)

<ipython-input-4-a235629c7b79> in <module>
----> 1 engine = init_cli_trading([xtp_gateway])
2 engine.connect_gateway(setting, "XTP")

d:\ProgramData\Anaconda3\lib\site-packages\vnpy\app\script_trader\cli.py in init_cli_trading(gateways)
22 main_engine = MainEngine(event_engine)
23 for gateway in gateways:
---> 24 main_engine.add_gateway(gateway)
25
26 script_engine = main_engine.add_engine(ScriptEngine)

d:\ProgramData\Anaconda3\lib\site-packages\vnpy\trader\engine.py in add_gateway(self, gateway_class)
77 Add gateway.
78 """
---> 79 gateway = gateway_class(self.event_engine)
80 self.gateways[gateway.gateway_name] = gateway
81

TypeError: 'module' object is not callable

Administrator
avatar
加入于:
帖子: 4466
声望: 255

from vnpy.gateway.xtp import XtpGateway

Member
加入于:
帖子: 3
声望: 0

厉害了,佩服

Member
avatar
加入于:
帖子: 14
声望: 2

中泰xtp模拟账号里面好像不能买卖吧,都是拒单

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

沪公网安备 31011502017034号