pyctp
pyctp copied to clipboard
CTP 穿透式监管版本急求
6月前大部分期货商都要求使用穿透式监管CTP了,请问您有在封装6.3.15版本的pyctp么?谢谢~
没有呢。
在 2019-05-28 13:16:49,"donbalbala" [email protected] 写道:
6月前大部分期货商都要求使用穿透式监管CTP了,请问您有在封装6.3.15版本的pyctp么?谢谢~
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
ctp_se期货穿透版本,测试 13,生产15,已经编译完成,需要的请去 github.com/pyctp/ctp_se_13, github.com/pyctp/ctp_se_15 下载
您好,可以写一个新版的使用demo吗?我用的是13版本的,已经替换上最新的文件 ,但用之前的行情代码还是获取不到数据,交易的也不行。谢谢!
13版本是测试版本,只是客户端验证测试。没有提供行情和交易数据。你需要换到15版本试试。
刚才换上了,会报RegisterSpi找不到的错误,(这行去掉也不行)。我看了下对应版本的__init__.py下确实没有这个方法,我尝试手工加一个空方法,也不行。 以下是详细信息:
主接受程序main:
loader = MyMdApi(instruments=fids,
broker_id=config.ctp.broker_id,
investor_id=config.ctp.user_id,
passwd=config.ctp.password)
print(loader.GetApiVersion())
loader.Create(s2b('temp/md_'))
loader.RegisterSpi(loader) #原来旧的api是没有这行,看demo里好像需要,是刚刚新加的
loader.RegisterFront(s2b(ctp_addr['md']))
loader.Init()
MyMdApi:
from pyctp import ApiStruct, MdApi
class MyMdApi(MdApi):
def __init__(self, instruments, broker_id,
investor_id, passwd, *args, **kwargs):
self.requestid = 0
def OnRspError(self, info, RequestId, IsLast):
log(" Error", info)
self.isErrorRspInfo(info)
......
运行结果:
运行环境: Linux 3.5 64bit
2019-06-14 10:51:22 44:md fid count,2,rb1910,rb2001
2019-06-14 10:51:22 44:connect ctp url,tcp://180.168.146.187:10031,035598
b'6.3.15_20190220 15:47:00'
Traceback (most recent call last):
File "/home/user1/Documents/data_recorder/ctpDataReceiver.py", line 114, in <module>
runChildProcess()
File "/home/user1/Documents/data_recorder/ctpDataReceiver.py", line 105, in runChildProcess
loader.RegisterSpi(loader)
AttributeError: 'MyMdApi' object has no attribute 'RegisterSpi'
你连接的是simnow的模拟服务器,simnow的模拟服务还是非穿透版本。要联系期货公司,用期货公司的生产服务器。
OK,非常感谢!
我测试版本调用行情登录就坏了
ctp_se_15 更新了一下,现在simnow环境登录已经正常。