diff --git a/.gitignore b/.gitignore
index 549c1cb..1be6991 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,9 @@
__pycache__/
*.py[cod]
*$py.class
+*.cpp
+*.con
+ctpwrapper/*.so
# Distribution / packaging
diff --git a/.travis.yml b/.travis.yml
index cded803..e4b04b9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,7 +3,7 @@ language: python
matrix:
include:
# others still work and don't install python3.7
- - python: pypy3
+ - python: pypy3.6-7.3.1
sudo: required
- python: 3.5
sudo: required
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..e8703cd
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,3 @@
+FROM python:3.8
+RUN pip3 install cython pip setuptools --upgrade
+WORKDIR /code
diff --git a/README.md b/README.md
index 867f769..9983ffb 100644
--- a/README.md
+++ b/README.md
@@ -9,9 +9,9 @@
[![implementation](https://img.shields.io/pypi/implementation/ctpwrapper.svg)](https://pypi.python.org/pypi/ctpwrapper)
[![Downloads](https://pepy.tech/badge/ctpwrapper)](https://pepy.tech/project/ctpwrapper)
-[CTP Website](http://www.sfit.com.cn/5_2_DocumentDown.htm)
+[CTP Website](http://www.sfit.com.cn/5_2_DocumentDown_1.htm)
-Version: v6.3.19 P1
+Version: v6.3.19 P1(v6.3.19_P1_20200106)
Platform: Linux 64bit, Windows 64bit
@@ -34,196 +34,16 @@ already install cython package.
+## ⚠️⚠️ notice ⚠️⚠️
+ sometimes quote the market futures data, but there is no trading data from the API stream,
+ better just add `time.sleep(2)` func call after `Init()` method invoked, this could help to solve no data response issue.
+
+## Demo
+sample code [samples](samples/)
-# Usage
-
- MdApi Class Wrapper
-
-```python
-import sys
-
-from ctpwrapper import ApiStructure
-from ctpwrapper import MdApiPy
-
-
-class Md(MdApiPy):
- """
- """
-
- def __init__(self, broker_id, investor_id, password, request_id=1):
-
- self.broker_id = broker_id
- self.investor_id = investor_id
- self.password = password
- self.request_id = request_id
-
- def OnRspError(self, pRspInfo, nRequestID, bIsLast):
-
- self.ErrorRspInfo(pRspInfo, nRequestID)
-
- def ErrorRspInfo(self, info, request_id):
- """
- :param info:
- :return:
- """
- if info.ErrorID != 0:
- print('request_id=%s ErrorID=%d, ErrorMsg=%s',
- request_id, info.ErrorID, info.ErrorMsg.decode('gbk'))
- return info.ErrorID != 0
-
- def OnFrontConnected(self):
- """
- :return:
- """
-
- user_login = ApiStructure.ReqUserLoginField(BrokerID=self.broker_id,
- UserID=self.investor_id,
- Password=self.password)
- self.ReqUserLogin(user_login, self.request_id)
-
- def OnFrontDisconnected(self, nReason):
-
- print("Md OnFrontDisconnected %s", nReason)
- sys.exit()
-
- def OnHeartBeatWarning(self, nTimeLapse):
- """心跳超时警告。当长时间未收到报文时,该方法被调用。
- @param nTimeLapse 距离上次接收报文的时间
- """
- print('Md OnHeartBeatWarning, time = %s', nTimeLapse)
-
- def OnRspUserLogin(self, pRspUserLogin, pRspInfo, nRequestID, bIsLast):
- """
- 用户登录应答
- :param pRspUserLogin:
- :param pRspInfo:
- :param nRequestID:
- :param bIsLast:
- :return:
- """
- if pRspInfo.ErrorID != 0:
- print("Md OnRspUserLogin failed error_id=%s msg:%s",
- pRspInfo.ErrorID, pRspInfo.ErrorMsg.decode('gbk'))
- else:
- print("Md user login successfully")
- print(pRspUserLogin)
- print(pRspInfo)
-
-
-BORDKER_ID = ""
-INVESTOR_ID = ""
-PASSWORD = ""
-SERVER = ""
-
-md = Md(BORDKER_ID, INVESTOR_ID, PASSWORD)
-md.Create()
-md.RegisterFront(SERVER)
-md.Init()
-day = md.GetTradingDay()
-
-print(day)
-print("api worker!")
-```
-
-Trader Class Wrapper
-
-```python
-
-from ctpwrapper import ApiStructure
-from ctpwrapper import TraderApiPy
-
-class Trader(TraderApiPy):
-
- def __init__(self, broker_id, investor_id, password, request_id=1):
- self.request_id = request_id
- self.broker_id = broker_id.encode()
- self.investor_id = investor_id.encode()
- self.password = password.encode()
-
- def OnRspError(self, pRspInfo, nRequestID, bIsLast):
-
- self.ErrorRspInfo(pRspInfo, nRequestID)
-
- def ErrorRspInfo(self, info, request_id):
- """
- :param info:
- :return:
- """
- if info.ErrorID != 0:
- print('request_id=%s ErrorID=%d, ErrorMsg=%s',
- request_id, info.ErrorID, info.ErrorMsg.decode('gbk'))
- return info.ErrorID != 0
-
- def OnHeartBeatWarning(self, nTimeLapse):
- """心跳超时警告。当长时间未收到报文时,该方法被调用。
- @param nTimeLapse 距离上次接收报文的时间
- """
- print("on OnHeartBeatWarning time: ", nTimeLapse)
-
- def OnFrontDisconnected(self, nReason):
- print("on FrontDisConnected disconnected", nReason)
-
- def OnFrontConnected(self):
-
- req = ApiStructure.ReqUserLoginField(BrokerID=self.broker_id,
- UserID=self.investor_id,
- Password=self.password)
- self.ReqUserLogin(req, self.request_id)
- print("trader on front connection")
-
- def OnRspUserLogin(self, pRspUserLogin, pRspInfo, nRequestID, bIsLast):
-
- if pRspInfo.ErrorID != 0:
- print("Md OnRspUserLogin failed error_id=%s msg:%s",
- pRspInfo.ErrorID, pRspInfo.ErrorMsg.decode('gbk'))
- else:
- print("Md user login successfully")
-
- inv = ApiStructure.QryInvestorField(BrokerID=self.broker_id, InvestorID=self.investor_id)
-
- self.ReqQryInvestor(inv, self.inc_request_id())
- req = ApiStructure.SettlementInfoConfirmField.from_dict({"BrokerID": self.broker_id,
- "InvestorID": self.investor_id})
-
- self.ReqSettlementInfoConfirm(req, self.inc_request_id())
-
- def OnRspSettlementInfoConfirm(self, pSettlementInfoConfirm, pRspInfo, nRequestID, bIsLast):
- print(pSettlementInfoConfirm, pRspInfo)
- print(pRspInfo.ErrorMsg.decode("GBK"))
-
- def inc_request_id(self):
- self.request_id += 1
- return self.request_id
-
- def OnRspQryInvestor(self, pInvestor, pRspInfo, nRequestID, bIsLast):
- print(pInvestor, pRspInfo)
-
-if __name__ == "__main__":
- investor_id = ""
- broker_id = ""
- password = ""
- server = ""
-
- user_trader = Trader(broker_id=broker_id, investor_id=investor_id, password=password)
-
- user_trader.Create()
- user_trader.RegisterFront(server)
- user_trader.SubscribePrivateTopic(2) # 只传送登录后的流内容
- user_trader.SubscribePrivateTopic(2) # 只传送登录后的流内容
-
- user_trader.Init()
-
- print("trader started")
- print(user_trader.GetTradingDay())
-
- user_trader.Join()
-
-```
# Documentation
- CTP's documentation can be found in the [docs](doc/ctp/)
-
-
+ CTP documentation can be found in the [docs](doc/ctp/)
# Contact
diff --git a/ctpwrapper/ApiStructure.py b/ctpwrapper/ApiStructure.py
index 5ce2412..a1724a6 100644
--- a/ctpwrapper/ApiStructure.py
+++ b/ctpwrapper/ApiStructure.py
@@ -162,11 +162,11 @@ class AuthenticationInfoField(Base):
('IsResult', ctypes.c_int), # 是否为认证结果
('AppID', ctypes.c_char * 33), # App代码
('AppType', ctypes.c_char), # App类型
- ('ClientIPAddress', ctypes.c_char * 16) # 终端IP地址
+ ('ClientIPAddress', ctypes.c_char * 16), # 终端IP地址
]
- def __init__(self, BrokerID='', UserID='', UserProductInfo='', AuthInfo='',
- IsResult=0, AppID='', AppType='', ClientIPAddress=''):
+ def __init__(self, BrokerID='', UserID='', UserProductInfo='', AuthInfo='', IsResult=0, AppID='', AppType='',
+ ClientIPAddress=''):
super(AuthenticationInfoField, self).__init__()
self.BrokerID = self._to_bytes(BrokerID)
self.UserID = self._to_bytes(UserID)
@@ -911,7 +911,7 @@ class InvestorPositionField(Base):
('InvestUnitID', ctypes.c_char * 17), # 投资单元代码
('PositionCostOffset', ctypes.c_double), # 大商所持仓成本差值,只有大商所使用
('TasPosition', ctypes.c_int), # tas持仓手数
- ("TasPositionCost", ctypes.c_double) # tas持仓成本
+ ('TasPositionCost', ctypes.c_double), # tas持仓成本
]
def __init__(self, InstrumentID='', BrokerID='', InvestorID='', PosiDirection='', HedgeFlag='', PositionDate='',
@@ -990,7 +990,6 @@ class InstrumentMarginRateField(Base):
('IsRelative', ctypes.c_int), # 是否相对交易所收取
('ExchangeID', ctypes.c_char * 9), # 交易所代码
('InvestUnitID', ctypes.c_char * 17), # 投资单元代码
-
]
def __init__(self, InstrumentID='', InvestorRange='', BrokerID='', InvestorID='', HedgeFlag='',
@@ -2629,8 +2628,7 @@ class SyncingInvestorPositionField(Base):
('InvestUnitID', ctypes.c_char * 17), # 投资单元代码
('PositionCostOffset', ctypes.c_double), # 大商所持仓成本差值,只有大商所使用
('TasPosition', ctypes.c_int), # tas持仓手数
- ("TasPositionCost", ctypes.c_double) # tas持仓成本
-
+ ('TasPositionCost', ctypes.c_double), # tas持仓成本
]
def __init__(self, InstrumentID='', BrokerID='', InvestorID='', PosiDirection='', HedgeFlag='', PositionDate='',
@@ -2852,11 +2850,11 @@ class QryTradingAccountField(Base):
('BrokerID', ctypes.c_char * 11), # 经纪公司代码
('InvestorID', ctypes.c_char * 13), # 投资者代码
('CurrencyID', ctypes.c_char * 4), # 币种代码
- ('BizType', ctypes.c_char), # 业务类型
+ ('BizType', ctypes.c_char), # 业务类型 1 期货 2 证券
('AccountID', ctypes.c_char * 13), # 投资者帐号
]
- def __init__(self, BrokerID='', InvestorID='', CurrencyID='', BizType='', AccountID=''):
+ def __init__(self, BrokerID='', InvestorID='', CurrencyID='', BizType='1', AccountID=''):
super(QryTradingAccountField, self).__init__()
self.BrokerID = self._to_bytes(BrokerID)
self.InvestorID = self._to_bytes(InvestorID)
@@ -6495,7 +6493,7 @@ class InvestorPositionDetailField(Base):
('CloseAmount', ctypes.c_double), # 平仓金额
('TimeFirstVolume', ctypes.c_int), # 先开先平剩余数量(DCE)
('InvestUnitID', ctypes.c_char * 17), # 投资单元代码
- ('SpecPosiType', ctypes.c_char) # 特殊持仓标志
+ ('SpecPosiType', ctypes.c_char), # 特殊持仓标志
]
def __init__(self, InstrumentID='', BrokerID='', InvestorID='', HedgeFlag='', Direction='', OpenDate='', TradeID='',
@@ -8293,19 +8291,17 @@ def __init__(self, ExchangeID='', BulletinID=0, SequenceNo=0, NewsType='', NewsU
class MulticastInstrumentField(Base):
- """
- """
+ """MulticastInstrument"""
_fields_ = [
- ("TopicID", ctypes.c_int), # 主题号
- ("InstrumentID", ctypes.c_char * 31), # 合约代码
- ("InstrumentNo", ctypes.c_int), # 合约编号
- ("CodePrice", ctypes.c_double), # 基准价
- ("VolumeMultiple", ctypes.c_int), # 合约数量乘数
- ("PriceTick", ctypes.c_double), # 最小变动价位
+ ('TopicID', ctypes.c_int), # 主题号
+ ('InstrumentID', ctypes.c_char * 31), # 合约代码
+ ('InstrumentNo', ctypes.c_int), # 合约编号
+ ('CodePrice', ctypes.c_double), # 基准价
+ ('VolumeMultiple', ctypes.c_int), # 合约数量乘数
+ ('PriceTick', ctypes.c_double), # 最小变动价位
]
- def __init__(self, TopicID=0, InstrumentID='', InstrumentNo=0,
- CodePrice=0.0, VolumeMultiple=0, PriceTick=0.0):
+ def __init__(self, TopicID=0, InstrumentID='', InstrumentNo=0, CodePrice=0.0, VolumeMultiple=0, PriceTick=0.0):
super(MulticastInstrumentField, self).__init__()
self.TopicID = int(TopicID)
self.InstrumentID = self._to_bytes(InstrumentID)
@@ -8316,11 +8312,10 @@ def __init__(self, TopicID=0, InstrumentID='', InstrumentNo=0,
class QryMulticastInstrumentField(Base):
- """
- """
+ """QryMulticastInstrument"""
_fields_ = [
- ("TopicID", ctypes.c_int), # 主题号
- ("InstrumentID", ctypes.c_char * 31), # 合约代码
+ ('TopicID', ctypes.c_int), # 主题号
+ ('InstrumentID', ctypes.c_char * 31), # 合约代码
]
def __init__(self, TopicID=0, InstrumentID=''):
@@ -8330,13 +8325,11 @@ def __init__(self, TopicID=0, InstrumentID=''):
class AppIDAuthAssignField(Base):
- """
- App客户端权限分配
- """
+ """App客户端权限分配"""
_fields_ = [
- ("BrokerID", ctypes.c_char * 11), # 经纪公司代码
- ("AppID", ctypes.c_char * 33), # App代码
- ("DRIdentityID", ctypes.c_int) # 交易中心代码
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('AppID', ctypes.c_char * 33), # App代码
+ ('DRIdentityID', ctypes.c_int), # 交易中心代码
]
def __init__(self, BrokerID='', AppID='', DRIdentityID=0):
@@ -11427,9 +11420,7 @@ def __init__(self, QueryFreq=0):
class AuthForbiddenIPField(Base):
- """
- 禁止认证IP
- """
+ """禁止认证IP"""
_fields_ = [
('IPAddress', ctypes.c_char * 16), # IP地址
]
@@ -11440,9 +11431,7 @@ def __init__(self, IPAddress=''):
class QryAuthForbiddenIPField(Base):
- """
- 查询禁止认证IP
- """
+ """查询禁止认证IP"""
_fields_ = [
('IPAddress', ctypes.c_char * 16), # IP地址
]
@@ -11453,20 +11442,18 @@ def __init__(self, IPAddress=''):
class SyncDelaySwapFrozenField(Base):
- """
- 换汇可提冻结
- """
+ """换汇可提冻结"""
_fields_ = [
- ('DelaySwapSeqNo', ctypes.c_char * 11), # 换汇流水号
- ('BrokerID', ctypes.c_char * 16), # 经纪公司代码
+ ('DelaySwapSeqNo', ctypes.c_char * 15), # 换汇流水号
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
('InvestorID', ctypes.c_char * 13), # 投资者代码
- ('FromCurrencyID', ctypes.c_char * 13), # 源币种
+ ('FromCurrencyID', ctypes.c_char * 4), # 源币种
('FromRemainSwap', ctypes.c_double), # 源剩余换汇额度(可提冻结)
- ('IsManualSwap', ctypes.c_int) # 是否手工换汇
+ ('IsManualSwap', ctypes.c_int), # 是否手工换汇
]
- def __init__(self, DelaySwapSeqNo='', BrokerID='', InvestorID='',
- FromCurrencyID='', FromRemainSwap=0.0, IsManualSwap=0):
+ def __init__(self, DelaySwapSeqNo='', BrokerID='', InvestorID='', FromCurrencyID='', FromRemainSwap=0.0,
+ IsManualSwap=0):
super(SyncDelaySwapFrozenField, self).__init__()
self.DelaySwapSeqNo = self._to_bytes(DelaySwapSeqNo)
self.BrokerID = self._to_bytes(BrokerID)
diff --git a/ctpwrapper/Md.py b/ctpwrapper/Md.py
index d34b76c..c6547c0 100644
--- a/ctpwrapper/Md.py
+++ b/ctpwrapper/Md.py
@@ -17,7 +17,6 @@
"""
import time
-
from ctpwrapper.MdApi import MdApiWrapper
@@ -36,7 +35,7 @@ def Init(self):
初始化运行环境,只有调用后,接口才开始工作
"""
super(MdApiPy, self).Init()
- time.sleep(0.1) # wait for c++ init
+ time.sleep(1) # wait for c++ init
def Join(self) -> int:
"""
@@ -145,7 +144,6 @@ def UnSubscribeForQuoteRsp(self, pInstrumentID: list) -> int:
return super(MdApiPy, self).UnSubscribeForQuoteRsp(ids)
# for receive message
-
def OnFrontConnected(self):
"""
当客户端与交易后台建立起通信连接时(还未登录前),该方法被调用。
diff --git a/ctpwrapper/MdApi.pyx b/ctpwrapper/MdApi.pyx
index 1059fc1..6d486f1 100644
--- a/ctpwrapper/MdApi.pyx
+++ b/ctpwrapper/MdApi.pyx
@@ -19,13 +19,12 @@ along with ctpwrapper. If not, see .
"""
-
from cpython cimport PyObject
from libc.stdlib cimport malloc, free
from libc.string cimport const_char
from libcpp cimport bool as cbool
-from .headers.ThostFtdcUserApiStruct cimport (
+from ctpwrapper.headers.ThostFtdcUserApiStruct cimport (
CThostFtdcRspUserLoginField,
CThostFtdcRspInfoField,
CThostFtdcUserLogoutField,
@@ -37,11 +36,12 @@ CThostFtdcForQuoteRspField,
CThostFtdcQryMulticastInstrumentField,
CThostFtdcMulticastInstrumentField
)
-from .headers.cMdAPI cimport CMdSpi, CMdApi, CreateFtdcMdApi
+from ctpwrapper.headers.cMdAPI cimport CMdSpi, CMdApi, CreateFtdcMdApi
import ctypes
from . import ApiStructure
+
# from libcpp.memory cimport shared_ptr,make_shared
@@ -67,7 +67,8 @@ cdef class MdApiWrapper:
def Create(self, const_char *pszFlowPath, cbool bIsUsingUdp, cbool bIsMulticast):
- self._api = CreateFtdcMdApi(pszFlowPath, bIsUsingUdp, bIsMulticast)
+ with nogil:
+ self._api = CreateFtdcMdApi(pszFlowPath, bIsUsingUdp, bIsMulticast)
if not self._api:
raise MemoryError()
@@ -82,8 +83,9 @@ cdef class MdApiWrapper:
self._spi = new CMdSpi( self)
if self._spi is not NULL:
- self._api.RegisterSpi(self._spi)
- self._api.Init()
+ with nogil:
+ self._api.RegisterSpi(self._spi)
+ self._api.Init()
else:
raise MemoryError()
@@ -118,7 +120,6 @@ cdef class MdApiWrapper:
cdef size_t address
if self._spi is not NULL:
address = ctypes.addressof(pUserLogout)
-
with nogil:
result = self._api.ReqUserLogout( address, nRequestID)
@@ -162,8 +163,8 @@ cdef class MdApiWrapper:
:return:
"""
if self._api is not NULL:
-
- self._api.RegisterFront(pszFrontAddress)
+ with nogil:
+ self._api.RegisterFront(pszFrontAddress)
def RegisterNameServer(self, char *pszNsAddress):
"""
@@ -175,8 +176,8 @@ cdef class MdApiWrapper:
:return:
"""
if self._api is not NULL:
-
- self._api.RegisterNameServer(pszNsAddress)
+ with nogil:
+ self._api.RegisterNameServer(pszNsAddress)
def RegisterFensUserInfo(self, pFensUserInfo):
"""
@@ -187,16 +188,16 @@ cdef class MdApiWrapper:
cdef size_t address
if self._api is not NULL:
address = ctypes.addressof(pFensUserInfo)
-
- self._api.RegisterFensUserInfo( address)
+ with nogil:
+ self._api.RegisterFensUserInfo( address)
def SubscribeMarketData(self, pInstrumentID):
"""
- 订阅行情。
+ 订阅行情。
@param ppInstrumentID 合约ID
@param nCount 要订阅/退订行情的合约个数
- # https://www.quora.com/How-do-char-array-pointers-work-in-C++
+ # https://www.quora.com/How-do-char-array-pointers-work-in-C++
# http://docs.cython.org/en/latest/src/userguide/language_basics.html#integer-for-loops
# https://stackoverflow.com/questions/15686890/how-to-allocate-array-of-pointers-for-strings-by-malloc-in-c
@@ -204,7 +205,7 @@ cdef class MdApiWrapper:
"""
cdef Py_ssize_t count, i
cdef int result
- cdef char **InstrumentIDs
+ cdef char ** InstrumentIDs
if self._spi is not NULL:
@@ -215,7 +216,7 @@ cdef class MdApiWrapper:
for i from 0 <= i < count:
InstrumentIDs[i] = pInstrumentID[i]
with nogil:
- result = self._api.SubscribeMarketData(InstrumentIDs, count)
+ result = self._api.SubscribeMarketData(InstrumentIDs, count)
finally:
free(InstrumentIDs)
return result
@@ -229,7 +230,7 @@ cdef class MdApiWrapper:
"""
cdef Py_ssize_t count, i
cdef int result
- cdef char **InstrumentIDs
+ cdef char ** InstrumentIDs
if self._spi is not NULL:
count = len(pInstrumentID)
@@ -239,7 +240,7 @@ cdef class MdApiWrapper:
for i from 0 <= i < count:
InstrumentIDs[i] = pInstrumentID[i]
with nogil:
- result = self._api.UnSubscribeMarketData(InstrumentIDs, count)
+ result = self._api.UnSubscribeMarketData(InstrumentIDs, count)
finally:
free(InstrumentIDs)
return result
@@ -252,7 +253,7 @@ cdef class MdApiWrapper:
"""
cdef Py_ssize_t count, i
cdef int result
- cdef char **InstrumentIDs
+ cdef char ** InstrumentIDs
if self._spi is not NULL:
@@ -263,7 +264,7 @@ cdef class MdApiWrapper:
for i from 0 <= i < count:
InstrumentIDs[i] = pInstrumentID[i]
with nogil:
- result = self._api.SubscribeForQuoteRsp(InstrumentIDs, count)
+ result = self._api.SubscribeForQuoteRsp(InstrumentIDs, count)
finally:
free(InstrumentIDs)
return result
@@ -276,7 +277,7 @@ cdef class MdApiWrapper:
"""
cdef Py_ssize_t count, i
cdef int result
- cdef char **InstrumentIDs
+ cdef char ** InstrumentIDs
if self._spi is not NULL:
@@ -286,7 +287,7 @@ cdef class MdApiWrapper:
for i from 0 <= i < count:
InstrumentIDs[i] = pInstrumentID[i]
with nogil:
- result = self._api.UnSubscribeForQuoteRsp(InstrumentIDs, count)
+ result = self._api.UnSubscribeForQuoteRsp(InstrumentIDs, count)
finally:
free(InstrumentIDs)
return result
@@ -303,7 +304,8 @@ cdef extern int MdSpi_OnHeartBeatWarning(self, int nTimeLapse) except -1:
self.OnHeartBeatWarning(nTimeLapse)
return 0
-cdef extern int MdSpi_OnRspUserLogin(self, CThostFtdcRspUserLoginField *pRspUserLogin,
+cdef extern int MdSpi_OnRspUserLogin(self,
+ CThostFtdcRspUserLoginField *pRspUserLogin,
CThostFtdcRspInfoField *pRspInfo,
int nRequestID,
cbool bIsLast) except -1:
@@ -319,7 +321,8 @@ cdef extern int MdSpi_OnRspUserLogin(self, CThostFtdcRspUserLoginField *pRspUser
self.OnRspUserLogin(user_login, rsp_info, nRequestID, bIsLast)
return 0
-cdef extern int MdSpi_OnRspUserLogout(self, CThostFtdcUserLogoutField *pUserLogout,
+cdef extern int MdSpi_OnRspUserLogout(self,
+ CThostFtdcUserLogoutField *pUserLogout,
CThostFtdcRspInfoField *pRspInfo,
int nRequestID,
cbool bIsLast) except -1:
@@ -335,7 +338,8 @@ cdef extern int MdSpi_OnRspUserLogout(self, CThostFtdcUserLogoutField *pUserLogo
self.OnRspUserLogout(user_logout, rsp_info, nRequestID, bIsLast)
return 0
-cdef extern int MdSpi_OnRspError(self, CThostFtdcRspInfoField *pRspInfo,
+cdef extern int MdSpi_OnRspError(self,
+ CThostFtdcRspInfoField *pRspInfo,
int nRequestID,
cbool bIsLast) except -1:
if pRspInfo is NULL:
@@ -345,7 +349,8 @@ cdef extern int MdSpi_OnRspError(self, CThostFtdcRspInfoField *pRspInfo,
self.OnRspError(rsp_info, nRequestID, bIsLast)
return 0
-cdef extern int MdSpi_OnRspSubMarketData(self, CThostFtdcSpecificInstrumentField *pSpecificInstrument,
+cdef extern int MdSpi_OnRspSubMarketData(self,
+ CThostFtdcSpecificInstrumentField *pSpecificInstrument,
CThostFtdcRspInfoField *pRspInfo,
int nRequestID,
cbool bIsLast) except -1:
@@ -361,7 +366,8 @@ cdef extern int MdSpi_OnRspSubMarketData(self, CThostFtdcSpecificInstrumentField
self.OnRspSubMarketData(instrument, rsp_info, nRequestID, bIsLast)
return 0
-cdef extern int MdSpi_OnRspUnSubMarketData(self, CThostFtdcSpecificInstrumentField *pSpecificInstrument,
+cdef extern int MdSpi_OnRspUnSubMarketData(self,
+ CThostFtdcSpecificInstrumentField *pSpecificInstrument,
CThostFtdcRspInfoField *pRspInfo,
int nRequestID,
cbool bIsLast) except -1:
@@ -395,7 +401,11 @@ cdef extern int MdSpi_OnRspSubForQuoteRsp(self,
self.OnRspSubForQuoteRsp(instrument, rsp_info, nRequestID, bIsLast)
return 0
-cdef extern int MdSpi_OnRspUnSubForQuoteRsp(self, CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, cbool bIsLast) except -1:
+cdef extern int MdSpi_OnRspUnSubForQuoteRsp(self,
+ CThostFtdcSpecificInstrumentField *pSpecificInstrument,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
+ cbool bIsLast) except -1:
if pSpecificInstrument is NULL:
instrument = None
else:
@@ -425,7 +435,11 @@ cdef extern int MdSpi_OnRtnForQuoteRsp(self, CThostFtdcForQuoteRspField *pForQuo
self.OnRtnForQuoteRsp(quote)
return 0
-cdef extern int MdSpi_OnRspQryMulticastInstrument(self, CThostFtdcMulticastInstrumentField *pMulticastInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, cbool bIsLast) except -1:
+cdef extern int MdSpi_OnRspQryMulticastInstrument(self,
+ CThostFtdcMulticastInstrumentField *pMulticastInstrument,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
+ cbool bIsLast) except -1:
if pMulticastInstrument is NULL:
MulticastInstrument = None
else:
@@ -437,4 +451,4 @@ cdef extern int MdSpi_OnRspQryMulticastInstrument(self, CThostFtdcMulticastInstr
rsp_info = ApiStructure.RspInfoField.from_address( pRspInfo)
self.OnRspQryMulticastInstrument(MulticastInstrument, rsp_info, nRequestID, bIsLast)
- return 0
\ No newline at end of file
+ return 0
diff --git a/ctpwrapper/Trader.py b/ctpwrapper/Trader.py
index c254ac2..8fc46c7 100644
--- a/ctpwrapper/Trader.py
+++ b/ctpwrapper/Trader.py
@@ -31,7 +31,7 @@ def Release(self):
def Init(self):
super(TraderApiPy, self).Init()
- time.sleep(0.1) # wait for c++ init
+ time.sleep(1) # wait for c++ init
def Join(self):
return super(TraderApiPy, self).Join()
diff --git a/ctpwrapper/TraderApi.pyx b/ctpwrapper/TraderApi.pyx
index f80682c..82b8ae9 100644
--- a/ctpwrapper/TraderApi.pyx
+++ b/ctpwrapper/TraderApi.pyx
@@ -21,13 +21,13 @@ from cpython cimport PyObject
from libc.string cimport const_char
from libcpp cimport bool as cbool
-from .headers.ThostFtdcUserApiStruct cimport *
-from .headers.cTraderApi cimport CTraderSpi, CTraderApi, CreateFtdcTraderApi
+from ctpwrapper.headers.ThostFtdcUserApiStruct cimport *
+from ctpwrapper.headers.cTraderApi cimport CTraderSpi, CTraderApi, CreateFtdcTraderApi
# from libcpp.memory cimport shared_ptr,make_shared
import ctypes
-from . import ApiStructure
+from ctpwrapper import ApiStructure
cdef class TraderApiWrapper:
cdef CTraderApi *_api
@@ -63,8 +63,9 @@ cdef class TraderApiWrapper:
self._spi = new CTraderSpi( self)
if self._spi is not NULL:
- self._api.RegisterSpi(self._spi)
- self._api.Init()
+ with nogil:
+ self._api.RegisterSpi(self._spi)
+ self._api.Init()
else:
raise MemoryError()
@@ -88,22 +89,25 @@ cdef class TraderApiWrapper:
def RegisterFront(self, char *pszFrontAddress):
if self._api is not NULL:
- self._api.RegisterFront(pszFrontAddress)
+ with nogil:
+ self._api.RegisterFront(pszFrontAddress)
def RegisterNameServer(self, char *pszNsAddress):
if self._api is not NULL:
- self._api.RegisterNameServer(pszNsAddress)
+ with nogil:
+ self._api.RegisterNameServer(pszNsAddress)
def RegisterFensUserInfo(self, pFensUserInfo):
cdef size_t address
if self._api is not NULL:
address = ctypes.addressof(pFensUserInfo)
-
- self._api.RegisterFensUserInfo( address)
+ with nogil:
+ self._api.RegisterFensUserInfo( address)
def SubscribePrivateTopic(self, THOST_TE_RESUME_TYPE nResumeType):
if self._api is not NULL:
- self._api.SubscribePrivateTopic(nResumeType)
+ with nogil:
+ self._api.SubscribePrivateTopic(nResumeType)
#订阅公共流。
#@param nResumeType 公共流重传方式
# THOST_TERT_RESTART:从本交易日开始重传
@@ -112,7 +116,8 @@ cdef class TraderApiWrapper:
#@remark 该方法要在Init方法前调用。若不调用则不会收到公共流的数据。
def SubscribePublicTopic(self, THOST_TE_RESUME_TYPE nResumeType):
if self._api is not NULL:
- self._api.SubscribePublicTopic(nResumeType)
+ with nogil:
+ self._api.SubscribePublicTopic(nResumeType)
#客户端认证请求
def ReqAuthenticate(self, pReqAuthenticateField, int nRequestID):
@@ -186,7 +191,7 @@ cdef class TraderApiWrapper:
return result
# 查询用户当前支持的认证模式
- def ReqUserAuthMethod(self,pReqUserAuthMethod, int nRequestID):
+ def ReqUserAuthMethod(self, pReqUserAuthMethod, int nRequestID):
cdef int result
cdef size_t address
if self._api is not NULL:
@@ -196,7 +201,7 @@ cdef class TraderApiWrapper:
return result
# 用户发出获取图形验证码请求
- def ReqGenUserCaptcha(self,pReqGenUserCaptcha, int nRequestID):
+ def ReqGenUserCaptcha(self, pReqGenUserCaptcha, int nRequestID):
cdef int result
cdef size_t address
if self._api is not NULL:
@@ -205,7 +210,7 @@ cdef class TraderApiWrapper:
result = self._api.ReqGenUserCaptcha( address, nRequestID)
return result
# 用户发出获取短信验证码请求
- def ReqGenUserText(self,pReqGenUserText, int nRequestID):
+ def ReqGenUserText(self, pReqGenUserText, int nRequestID):
cdef int result
cdef size_t address
if self._api is not NULL:
@@ -214,7 +219,7 @@ cdef class TraderApiWrapper:
result = self._api.ReqGenUserText( address, nRequestID)
return result
# 用户发出带有图片验证码的登陆请求
- def ReqUserLoginWithCaptcha(self,pReqUserLoginWithCaptcha, int nRequestID):
+ def ReqUserLoginWithCaptcha(self, pReqUserLoginWithCaptcha, int nRequestID):
cdef int result
cdef size_t address
if self._api is not NULL:
@@ -223,7 +228,7 @@ cdef class TraderApiWrapper:
result = self._api.ReqUserLoginWithCaptcha( address, nRequestID)
return result
# 用户发出带有短信验证码的登陆请求
- def ReqUserLoginWithText(self,pReqUserLoginWithText, int nRequestID):
+ def ReqUserLoginWithText(self, pReqUserLoginWithText, int nRequestID):
cdef int result
cdef size_t address
if self._api is not NULL:
@@ -232,7 +237,7 @@ cdef class TraderApiWrapper:
result = self._api.ReqUserLoginWithText( address, nRequestID)
return result
# 用户发出带有动态口令的登陆请求
- def ReqUserLoginWithOTP(self,pReqUserLoginWithOTP, int nRequestID):
+ def ReqUserLoginWithOTP(self, pReqUserLoginWithOTP, int nRequestID):
cdef int result
cdef size_t address
if self._api is not NULL:
@@ -294,8 +299,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pSettlementInfoConfirm)
with nogil:
- result = self._api.ReqSettlementInfoConfirm( address,
- nRequestID)
+ result = self._api.ReqSettlementInfoConfirm( address, nRequestID)
return result
#请求删除预埋单
def ReqRemoveParkedOrder(self, pRemoveParkedOrder, int nRequestID):
@@ -313,8 +317,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pRemoveParkedOrderAction)
with nogil:
- result = self._api.ReqRemoveParkedOrderAction( address,
- nRequestID)
+ result = self._api.ReqRemoveParkedOrderAction( address, nRequestID)
return result
#执行宣告录入请求
def ReqExecOrderInsert(self, pInputExecOrder, int nRequestID):
@@ -382,15 +385,13 @@ cdef class TraderApiWrapper:
result = self._api.ReqOptionSelfCloseInsert( address, nRequestID)
return result
#期权自对冲操作请求
- def ReqOptionSelfCloseAction(self, pInputOptionSelfCloseAction,
- int nRequestID):
+ def ReqOptionSelfCloseAction(self, pInputOptionSelfCloseAction, int nRequestID):
cdef int result
cdef size_t address
if self._spi is not NULL:
address = ctypes.addressof(pInputOptionSelfCloseAction)
with nogil:
- result = self._api.ReqOptionSelfCloseAction( address,
- nRequestID)
+ result = self._api.ReqOptionSelfCloseAction( address, nRequestID)
return result
#申请组合录入请求
@@ -463,8 +464,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQryInstrumentMarginRate)
with nogil:
- result = self._api.ReqQryInstrumentMarginRate( address,
- nRequestID)
+ result = self._api.ReqQryInstrumentMarginRate( address, nRequestID)
return result
#请求查询合约手续费率
def ReqQryInstrumentCommissionRate(self, pQryInstrumentCommissionRate, int nRequestID):
@@ -473,8 +473,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQryInstrumentCommissionRate)
with nogil:
- result = self._api.ReqQryInstrumentCommissionRate(
- address, nRequestID)
+ result = self._api.ReqQryInstrumentCommissionRate( address, nRequestID)
return result
#请求查询交易所
def ReqQryExchange(self, pQryExchange, int nRequestID):
@@ -538,8 +537,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQryInvestorPositionDetail)
with nogil:
- result = self._api.ReqQryInvestorPositionDetail( address,
- nRequestID)
+ result = self._api.ReqQryInvestorPositionDetail( address, nRequestID)
return result
#请求查询客户通知
def ReqQryNotice(self, pQryNotice, int nRequestID):
@@ -547,7 +545,6 @@ cdef class TraderApiWrapper:
cdef size_t address
if self._spi is not NULL:
address = ctypes.addressof(pQryNotice)
-
with nogil:
result = self._api.ReqQryNotice( address, nRequestID)
return result
@@ -558,8 +555,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQrySettlementInfoConfirm)
with nogil:
- result = self._api.ReqQrySettlementInfoConfirm( address,
- nRequestID)
+ result = self._api.ReqQrySettlementInfoConfirm( address, nRequestID)
return result
#请求查询投资者持仓明细
def ReqQryInvestorPositionCombineDetail(self, pQryInvestorPositionCombineDetail, int nRequestID):
@@ -568,8 +564,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQryInvestorPositionCombineDetail)
with nogil:
- result = self._api.ReqQryInvestorPositionCombineDetail(
- address, nRequestID)
+ result = self._api.ReqQryInvestorPositionCombineDetail( address, nRequestID)
return result
#请求查询保证金监管系统经纪公司资金账户密钥
def ReqQryCFMMCTradingAccountKey(self, pQryCFMMCTradingAccountKey, int nRequestID):
@@ -578,8 +573,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQryCFMMCTradingAccountKey)
with nogil:
- result = self._api.ReqQryCFMMCTradingAccountKey( address,
- nRequestID)
+ result = self._api.ReqQryCFMMCTradingAccountKey( address, nRequestID)
return result
#请求查询仓单折抵信息
def ReqQryEWarrantOffset(self, pQryEWarrantOffset, int nRequestID):
@@ -597,8 +591,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQryInvestorProductGroupMargin)
with nogil:
- result = self._api.ReqQryInvestorProductGroupMargin(
- address, nRequestID)
+ result = self._api.ReqQryInvestorProductGroupMargin( address, nRequestID)
return result
#请求查询交易所保证金率
def ReqQryExchangeMarginRate(self, pQryExchangeMarginRate, int nRequestID):
@@ -608,8 +601,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQryExchangeMarginRate)
with nogil:
- result = self._api.ReqQryExchangeMarginRate( address,
- nRequestID)
+ result = self._api.ReqQryExchangeMarginRate( address, nRequestID)
return result
#请求查询交易所调整保证金率
def ReqQryExchangeMarginRateAdjust(self, pQryExchangeMarginRateAdjust, int nRequestID):
@@ -618,8 +610,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQryExchangeMarginRateAdjust)
with nogil:
- result = self._api.ReqQryExchangeMarginRateAdjust(
- address, nRequestID)
+ result = self._api.ReqQryExchangeMarginRateAdjust( address, nRequestID)
return result
#请求查询汇率
def ReqQryExchangeRate(self, pQryExchangeRate, int nRequestID):
@@ -640,7 +631,6 @@ cdef class TraderApiWrapper:
with nogil:
result = self._api.ReqQrySecAgentACIDMap( address, nRequestID)
return result
-
#请求查询产品报价汇率
def ReqQryProductExchRate(self, pQryProductExchRate, int nRequestID):
@@ -669,8 +659,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQryMMInstrumentCommissionRate)
with nogil:
- result = self._api.ReqQryMMInstrumentCommissionRate(
- address, nRequestID)
+ result = self._api.ReqQryMMInstrumentCommissionRate( address, nRequestID)
return result
#请求查询做市商期权合约手续费
@@ -680,8 +669,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQryMMOptionInstrCommRate)
with nogil:
- result = self._api.ReqQryMMOptionInstrCommRate( address,
- nRequestID)
+ result = self._api.ReqQryMMOptionInstrCommRate( address, nRequestID)
return result
#请求查询报单手续费
@@ -691,8 +679,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQryInstrumentOrderCommRate)
with nogil:
- result = self._api.ReqQryInstrumentOrderCommRate( address,
- nRequestID)
+ result = self._api.ReqQryInstrumentOrderCommRate( address, nRequestID)
return result
#请求查询资金账户
@@ -703,8 +690,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQryTradingAccount)
with nogil:
- result = self._api.ReqQrySecAgentTradingAccount( address,
- nRequestID)
+ result = self._api.ReqQrySecAgentTradingAccount( address, nRequestID)
return result
#请求查询二级代理商资金校验模式
@@ -725,8 +711,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQryOptionInstrTradeCost)
with nogil:
- result = self._api.ReqQryOptionInstrTradeCost( address,
- nRequestID)
+ result = self._api.ReqQryOptionInstrTradeCost( address, nRequestID)
return result
#请求查询期权合约手续费
def ReqQryOptionInstrCommRate(self, pQryOptionInstrCommRate, int nRequestID):
@@ -735,8 +720,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQryOptionInstrCommRate)
with nogil:
- result = self._api.ReqQryOptionInstrCommRate( address,
- nRequestID)
+ result = self._api.ReqQryOptionInstrCommRate( address, nRequestID)
return result
#请求查询执行宣告
def ReqQryExecOrder(self, pQryExecOrder, int nRequestID):
@@ -791,8 +775,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQryCombInstrumentGuard)
with nogil:
- result = self._api.ReqQryCombInstrumentGuard( address,
- nRequestID)
+ result = self._api.ReqQryCombInstrumentGuard( address, nRequestID)
return result
#请求查询申请组合
def ReqQryCombAction(self, pQryCombAction, int nRequestID):
@@ -864,8 +847,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQryBrokerTradingParams)
with nogil:
- result = self._api.ReqQryBrokerTradingParams( address,
- nRequestID)
+ result = self._api.ReqQryBrokerTradingParams( address, nRequestID)
return result
#请求查询经纪公司交易算法
def ReqQryBrokerTradingAlgos(self, pQryBrokerTradingAlgos, int nRequestID):
@@ -874,8 +856,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQryBrokerTradingAlgos)
with nogil:
- result = self._api.ReqQryBrokerTradingAlgos( address,
- nRequestID)
+ result = self._api.ReqQryBrokerTradingAlgos( address, nRequestID)
return result
#请求查询监控中心用户令牌
def ReqQueryCFMMCTradingAccountToken(self, pQueryCFMMCTradingAccountToken, int nRequestID):
@@ -884,8 +865,7 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pQueryCFMMCTradingAccountToken)
with nogil:
- result = self._api.ReqQueryCFMMCTradingAccountToken(
- address, nRequestID)
+ result = self._api.ReqQueryCFMMCTradingAccountToken( address, nRequestID)
return result
#期货发起银行资金转期货请求
def ReqFromBankToFutureByFuture(self, pReqTransfer, int nRequestID):
@@ -913,20 +893,17 @@ cdef class TraderApiWrapper:
if self._spi is not NULL:
address = ctypes.addressof(pReqQueryAccount)
with nogil:
- result = self._api.ReqQueryBankAccountMoneyByFuture( address,
- nRequestID)
+ result = self._api.ReqQueryBankAccountMoneyByFuture( address, nRequestID)
return result
-
+
# 请求查询二级代理商信息
- def ReqQrySecAgentTradeInfo(self,pQrySecAgentTradeInfo, int nRequestID):
+ def ReqQrySecAgentTradeInfo(self, pQrySecAgentTradeInfo, int nRequestID):
cdef size_t address
if self._spi is not NULL:
address = ctypes.addressof(pQrySecAgentTradeInfo)
with nogil:
- result = self._api.ReqQrySecAgentTradeInfo( address,
- nRequestID)
+ result = self._api.ReqQrySecAgentTradeInfo( address, nRequestID)
return result
-
cdef extern int TraderSpi_OnFrontConnected(self) except -1:
self.OnFrontConnected()
@@ -940,851 +917,1133 @@ cdef extern int TraderSpi_OnHeartBeatWarning(self, int nTimeLapse) except -1:
self.OnHeartBeatWarning(nTimeLapse)
return 0
-cdef extern int TraderSpi_OnRspAuthenticate(self, CThostFtdcRspAuthenticateField *pRspAuthenticate,
+cdef extern int TraderSpi_OnRspAuthenticate(self,
+ CThostFtdcRspAuthenticateField *pRspAuthenticate,
CThostFtdcRspInfoField *pRspInfo,
- int nRequestID, cbool bIsLast) except -1:
+ int nRequestID,
+ cbool bIsLast) except -1:
self.OnRspAuthenticate(
None if pRspAuthenticate is NULL else ApiStructure.RspAuthenticateField.from_address( pRspAuthenticate),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspUserLogin(self, CThostFtdcRspUserLoginField *pRspUserLogin,
+cdef extern int TraderSpi_OnRspUserLogin(self,
+ CThostFtdcRspUserLoginField *pRspUserLogin,
CThostFtdcRspInfoField *pRspInfo,
- int nRequestID, cbool bIsLast) except -1:
+ int nRequestID,
+ cbool bIsLast) except -1:
self.OnRspUserLogin(
None if pRspUserLogin is NULL else ApiStructure.RspUserLoginField.from_address( pRspUserLogin),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspUserLogout(self, CThostFtdcUserLogoutField *pUserLogout,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspUserLogout(self,
+ CThostFtdcUserLogoutField *pUserLogout,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspUserLogout(
None if pUserLogout is NULL else ApiStructure.UserLogoutField.from_address( pUserLogout),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspUserPasswordUpdate(self, CThostFtdcUserPasswordUpdateField *pUserPasswordUpdate,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspUserPasswordUpdate(self,
+ CThostFtdcUserPasswordUpdateField *pUserPasswordUpdate,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspUserPasswordUpdate(
- None if pUserPasswordUpdate is NULL else ApiStructure.UserPasswordUpdateField.from_address(
- pUserPasswordUpdate),
+ None if pUserPasswordUpdate is NULL else ApiStructure.UserPasswordUpdateField.from_address( pUserPasswordUpdate),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
cdef extern int TraderSpi_OnRspTradingAccountPasswordUpdate(self,
CThostFtdcTradingAccountPasswordUpdateField *pTradingAccountPasswordUpdate,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspTradingAccountPasswordUpdate(
- None if pTradingAccountPasswordUpdate is NULL else ApiStructure.TradingAccountPasswordUpdateField.from_address(
- pTradingAccountPasswordUpdate),
+ None if pTradingAccountPasswordUpdate is NULL else ApiStructure.TradingAccountPasswordUpdateField.from_address( pTradingAccountPasswordUpdate),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspOrderInsert(self, CThostFtdcInputOrderField *pInputOrder,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspOrderInsert(self,
+ CThostFtdcInputOrderField *pInputOrder,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspOrderInsert(
None if pInputOrder is NULL else ApiStructure.InputOrderField.from_address( pInputOrder),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspParkedOrderInsert(self, CThostFtdcParkedOrderField *pParkedOrder,
+cdef extern int TraderSpi_OnRspParkedOrderInsert(self,
+ CThostFtdcParkedOrderField *pParkedOrder,
CThostFtdcRspInfoField *pRspInfo,
- int nRequestID, cbool bIsLast) except -1:
+ int nRequestID,
+ cbool bIsLast) except -1:
self.OnRspParkedOrderInsert(
None if pParkedOrder is NULL else ApiStructure.ParkedOrderField.from_address( pParkedOrder),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspParkedOrderAction(self, CThostFtdcParkedOrderActionField *pParkedOrderAction,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspParkedOrderAction(self,
+ CThostFtdcParkedOrderActionField *pParkedOrderAction,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspParkedOrderAction(
- None if pParkedOrderAction is NULL else ApiStructure.ParkedOrderActionField.from_address(
- pParkedOrderAction),
+ None if pParkedOrderAction is NULL else ApiStructure.ParkedOrderActionField.from_address( pParkedOrderAction),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspOrderAction(self, CThostFtdcInputOrderActionField *pInputOrderAction,
+cdef extern int TraderSpi_OnRspOrderAction(self,
+ CThostFtdcInputOrderActionField *pInputOrderAction,
CThostFtdcRspInfoField *pRspInfo,
- int nRequestID, cbool bIsLast) except -1:
- self.OnRspOrderAction(None if pInputOrderAction is NULL else ApiStructure.InputOrderActionField.from_address(
- pInputOrderAction),
- None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address(
- pRspInfo), nRequestID, bIsLast)
+ int nRequestID,
+ cbool bIsLast) except -1:
+ self.OnRspOrderAction(
+ None if pInputOrderAction is NULL else ApiStructure.InputOrderActionField.from_address( pInputOrderAction),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQueryMaxOrderVolume(self, CThostFtdcQueryMaxOrderVolumeField *pQueryMaxOrderVolume,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspQueryMaxOrderVolume(self,
+ CThostFtdcQueryMaxOrderVolumeField *pQueryMaxOrderVolume,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQueryMaxOrderVolume(
- None if pQueryMaxOrderVolume is NULL else ApiStructure.QueryMaxOrderVolumeField.from_address(
- pQueryMaxOrderVolume),
+ None if pQueryMaxOrderVolume is NULL else ApiStructure.QueryMaxOrderVolumeField.from_address( pQueryMaxOrderVolume),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspSettlementInfoConfirm(self, CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspSettlementInfoConfirm(self,
+ CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspSettlementInfoConfirm(
- None if pSettlementInfoConfirm is NULL else ApiStructure.SettlementInfoConfirmField.from_address(
- pSettlementInfoConfirm),
+ None if pSettlementInfoConfirm is NULL else ApiStructure.SettlementInfoConfirmField.from_address( pSettlementInfoConfirm),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspRemoveParkedOrder(self, CThostFtdcRemoveParkedOrderField *pRemoveParkedOrder,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspRemoveParkedOrder(self,
+ CThostFtdcRemoveParkedOrderField *pRemoveParkedOrder,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspRemoveParkedOrder(
- None if pRemoveParkedOrder is NULL else ApiStructure.RemoveParkedOrderField.from_address(
- pRemoveParkedOrder),
+ None if pRemoveParkedOrder is NULL else ApiStructure.RemoveParkedOrderField.from_address( pRemoveParkedOrder),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
cdef extern int TraderSpi_OnRspRemoveParkedOrderAction(self,
CThostFtdcRemoveParkedOrderActionField *pRemoveParkedOrderAction,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspRemoveParkedOrderAction(
- None if pRemoveParkedOrderAction is NULL else ApiStructure.RemoveParkedOrderAction(
- pRemoveParkedOrderAction),
+ None if pRemoveParkedOrderAction is NULL else ApiStructure.RemoveParkedOrderActionField( pRemoveParkedOrderAction),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspExecOrderInsert(self, CThostFtdcInputExecOrderField *pInputExecOrder,
+cdef extern int TraderSpi_OnRspExecOrderInsert(self,
+ CThostFtdcInputExecOrderField *pInputExecOrder,
CThostFtdcRspInfoField *pRspInfo,
- int nRequestID, cbool bIsLast) except -1:
+ int nRequestID,
+ cbool bIsLast) except -1:
self.OnRspExecOrderInsert(
None if pInputExecOrder is NULL else ApiStructure.InputExecOrderField.from_address( pInputExecOrder),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspExecOrderAction(self, CThostFtdcInputExecOrderActionField *pInputExecOrderAction,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspExecOrderAction(self,
+ CThostFtdcInputExecOrderActionField *pInputExecOrderAction,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspExecOrderAction(
- None if pInputExecOrderAction is NULL else ApiStructure.InputExecOrderActionField.from_address(
- pInputExecOrderAction),
+ None if pInputExecOrderAction is NULL else ApiStructure.InputExecOrderActionField.from_address( pInputExecOrderAction),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspForQuoteInsert(self, CThostFtdcInputForQuoteField *pInputForQuote,
+cdef extern int TraderSpi_OnRspForQuoteInsert(self,
+ CThostFtdcInputForQuoteField *pInputForQuote,
CThostFtdcRspInfoField *pRspInfo,
- int nRequestID, cbool bIsLast) except -1:
+ int nRequestID,
+ cbool bIsLast) except -1:
self.OnRspForQuoteInsert(
None if pInputForQuote is NULL else ApiStructure.InputForQuoteField.from_address( pInputForQuote),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQuoteInsert(self, CThostFtdcInputQuoteField *pInputQuote,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspQuoteInsert(self,
+ CThostFtdcInputQuoteField *pInputQuote,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQuoteInsert(
None if pInputQuote is NULL else ApiStructure.InputQuoteField.from_address( pInputQuote),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQuoteAction(self, CThostFtdcInputQuoteActionField *pInputQuoteAction,
+cdef extern int TraderSpi_OnRspQuoteAction(self,
+ CThostFtdcInputQuoteActionField *pInputQuoteAction,
CThostFtdcRspInfoField *pRspInfo,
- int nRequestID, cbool bIsLast) except -1:
- self.OnRspQuoteAction(None if pInputQuoteAction is NULL else ApiStructure.InputQuoteActionField.from_address(
- pInputQuoteAction),
- None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address(
- pRspInfo), nRequestID, bIsLast)
+ int nRequestID,
+ cbool bIsLast) except -1:
+ self.OnRspQuoteAction(
+ None if pInputQuoteAction is NULL else ApiStructure.InputQuoteActionField.from_address( pInputQuoteAction),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspCombActionInsert(self, CThostFtdcInputCombActionField *pInputCombAction,
+cdef extern int TraderSpi_OnRspCombActionInsert(self,
+ CThostFtdcInputCombActionField *pInputCombAction,
CThostFtdcRspInfoField *pRspInfo,
- int nRequestID, cbool bIsLast) except -1:
+ int nRequestID,
+ cbool bIsLast) except -1:
self.OnRspCombActionInsert(
None if pInputCombAction is NULL else ApiStructure.InputCombActionField.from_address( pInputCombAction),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryOrder(self, CThostFtdcOrderField *pOrder, CThostFtdcRspInfoField *pRspInfo,
+cdef extern int TraderSpi_OnRspQryOrder(self,
+ CThostFtdcOrderField *pOrder,
+ CThostFtdcRspInfoField *pRspInfo,
int nRequestID,
cbool bIsLast) except -1:
- self.OnRspQryOrder(None if pOrder is NULL else ApiStructure.OrderField.from_address( pOrder),
- None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address(
- pRspInfo), nRequestID, bIsLast)
+ self.OnRspQryOrder(
+ None if pOrder is NULL else ApiStructure.OrderField.from_address( pOrder),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryTrade(self, CThostFtdcTradeField *pTrade, CThostFtdcRspInfoField *pRspInfo,
+cdef extern int TraderSpi_OnRspQryTrade(self,
+ CThostFtdcTradeField *pTrade,
+ CThostFtdcRspInfoField *pRspInfo,
int nRequestID,
cbool bIsLast) except -1:
- self.OnRspQryTrade(None if pTrade is NULL else ApiStructure.TradeField.from_address( pTrade),
- None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address(
- pRspInfo), nRequestID, bIsLast)
+ self.OnRspQryTrade(
+ None if pTrade is NULL else ApiStructure.TradeField.from_address( pTrade),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryInvestorPosition(self, CThostFtdcInvestorPositionField *pInvestorPosition,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspQryInvestorPosition(self,
+ CThostFtdcInvestorPositionField *pInvestorPosition,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQryInvestorPosition(
- None if pInvestorPosition is NULL else ApiStructure.InvestorPositionField.from_address(
- pInvestorPosition),
+ None if pInvestorPosition is NULL else ApiStructure.InvestorPositionField.from_address( pInvestorPosition),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryTradingAccount(self, CThostFtdcTradingAccountField *pTradingAccount,
+cdef extern int TraderSpi_OnRspQryTradingAccount(self,
+ CThostFtdcTradingAccountField *pTradingAccount,
CThostFtdcRspInfoField *pRspInfo,
- int nRequestID, cbool bIsLast) except -1:
+ int nRequestID,
+ cbool bIsLast) except -1:
self.OnRspQryTradingAccount(
None if pTradingAccount is NULL else ApiStructure.TradingAccountField.from_address( pTradingAccount),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryInvestor(self, CThostFtdcInvestorField *pInvestor, CThostFtdcRspInfoField *pRspInfo,
+cdef extern int TraderSpi_OnRspQryInvestor(self,
+ CThostFtdcInvestorField *pInvestor,
+ CThostFtdcRspInfoField *pRspInfo,
int nRequestID,
cbool bIsLast) except -1:
- self.OnRspQryInvestor(None if pInvestor is NULL else ApiStructure.InvestorField.from_address( pInvestor),
- None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address(
- pRspInfo), nRequestID, bIsLast)
+ self.OnRspQryInvestor(
+ None if pInvestor is NULL else ApiStructure.InvestorField.from_address( pInvestor),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryTradingCode(self, CThostFtdcTradingCodeField *pTradingCode,
+cdef extern int TraderSpi_OnRspQryTradingCode(self,
+ CThostFtdcTradingCodeField *pTradingCode,
CThostFtdcRspInfoField *pRspInfo,
- int nRequestID, cbool bIsLast) except -1:
+ int nRequestID,
+ cbool bIsLast) except -1:
self.OnRspQryTradingCode(
None if pTradingCode is NULL else ApiStructure.TradingCodeField.from_address( pTradingCode),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryInstrumentMarginRate(self, CThostFtdcInstrumentMarginRateField *pInstrumentMarginRate,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspQryInstrumentMarginRate(self,
+ CThostFtdcInstrumentMarginRateField *pInstrumentMarginRate,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQryInstrumentMarginRate(
- None if pInstrumentMarginRate is NULL else ApiStructure.InstrumentMarginRateField.from_address(
- pInstrumentMarginRate),
+ None if pInstrumentMarginRate is NULL else ApiStructure.InstrumentMarginRateField.from_address( pInstrumentMarginRate),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
cdef extern int TraderSpi_OnRspQryInstrumentCommissionRate(self,
CThostFtdcInstrumentCommissionRateField *pInstrumentCommissionRate,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQryInstrumentCommissionRate(
- None if pInstrumentCommissionRate is NULL else ApiStructure.InstrumentCommissionRateField.from_address(
- pInstrumentCommissionRate),
+ None if pInstrumentCommissionRate is NULL else ApiStructure.InstrumentCommissionRateField.from_address( pInstrumentCommissionRate),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryExchange(self, CThostFtdcExchangeField *pExchange, CThostFtdcRspInfoField *pRspInfo,
+cdef extern int TraderSpi_OnRspQryExchange(self,
+ CThostFtdcExchangeField *pExchange,
+ CThostFtdcRspInfoField *pRspInfo,
int nRequestID,
cbool bIsLast) except -1:
- self.OnRspQryExchange(None if pExchange is NULL else ApiStructure.ExchangeField.from_address( pExchange),
- None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address(
- pRspInfo), nRequestID, bIsLast)
+ self.OnRspQryExchange(
+ None if pExchange is NULL else ApiStructure.ExchangeField.from_address( pExchange),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryProduct(self, CThostFtdcProductField *pProduct, CThostFtdcRspInfoField *pRspInfo,
+cdef extern int TraderSpi_OnRspQryProduct(self,
+ CThostFtdcProductField *pProduct,
+ CThostFtdcRspInfoField *pRspInfo,
int nRequestID,
cbool bIsLast) except -1:
- self.OnRspQryProduct(None if pProduct is NULL else ApiStructure.ProductField.from_address( pProduct),
- None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address(
- pRspInfo), nRequestID, bIsLast)
+ self.OnRspQryProduct(
+ None if pProduct is NULL else ApiStructure.ProductField.from_address( pProduct),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ nRequestID,
+ bIsLast
+ )
+
return 0
-cdef extern int TraderSpi_OnRspQryInstrument(self, CThostFtdcInstrumentField *pInstrument,
+cdef extern int TraderSpi_OnRspQryInstrument(self,
+ CThostFtdcInstrumentField *pInstrument,
CThostFtdcRspInfoField *pRspInfo,
- int nRequestID, cbool bIsLast) except -1:
+ int nRequestID,
+ cbool bIsLast) except -1:
self.OnRspQryInstrument(
None if pInstrument is NULL else ApiStructure.InstrumentField.from_address( pInstrument),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryDepthMarketData(self, CThostFtdcDepthMarketDataField *pDepthMarketData,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspQryDepthMarketData(self,
+ CThostFtdcDepthMarketDataField *pDepthMarketData,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQryDepthMarketData(
None if pDepthMarketData is NULL else ApiStructure.DepthMarketDataField.from_address( pDepthMarketData),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQrySettlementInfo(self, CThostFtdcSettlementInfoField *pSettlementInfo,
+cdef extern int TraderSpi_OnRspQrySettlementInfo(self,
+ CThostFtdcSettlementInfoField *pSettlementInfo,
CThostFtdcRspInfoField *pRspInfo,
- int nRequestID, cbool bIsLast) except -1:
+ int nRequestID,
+ cbool bIsLast) except -1:
self.OnRspQrySettlementInfo(
None if pSettlementInfo is NULL else ApiStructure.SettlementInfoField.from_address( pSettlementInfo),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryTransferBank(self, CThostFtdcTransferBankField *pTransferBank,
+cdef extern int TraderSpi_OnRspQryTransferBank(self,
+ CThostFtdcTransferBankField *pTransferBank,
CThostFtdcRspInfoField *pRspInfo,
- int nRequestID, cbool bIsLast) except -1:
+ int nRequestID,
+ cbool bIsLast) except -1:
self.OnRspQryTransferBank(
None if pTransferBank is NULL else ApiStructure.TransferBankField.from_address( pTransferBank),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
cdef extern int TraderSpi_OnRspQryInvestorPositionDetail(self,
CThostFtdcInvestorPositionDetailField *pInvestorPositionDetail,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQryInvestorPositionDetail(
- None if pInvestorPositionDetail is NULL else ApiStructure.InvestorPositionDetailField.from_address(
- pInvestorPositionDetail),
+ None if pInvestorPositionDetail is NULL else ApiStructure.InvestorPositionDetailField.from_address( pInvestorPositionDetail),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryNotice(self, CThostFtdcNoticeField *pNotice, CThostFtdcRspInfoField *pRspInfo,
+cdef extern int TraderSpi_OnRspQryNotice(self,
+ CThostFtdcNoticeField *pNotice,
+ CThostFtdcRspInfoField *pRspInfo,
int nRequestID,
cbool bIsLast) except -1:
- self.OnRspQryNotice(None if pNotice is NULL else ApiStructure.NoticeField.from_address( pNotice),
- None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address(
- pRspInfo), nRequestID, bIsLast)
+ self.OnRspQryNotice(
+ None if pNotice is NULL else ApiStructure.NoticeField.from_address( pNotice),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ nRequestID,
+ bIsLast
+ )
return 0
cdef extern int TraderSpi_OnRspQrySettlementInfoConfirm(self,
CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQrySettlementInfoConfirm(
- None if pSettlementInfoConfirm is NULL else ApiStructure.SettlementInfoConfirmField.from_address(
- pSettlementInfoConfirm),
+ None if pSettlementInfoConfirm is NULL else ApiStructure.SettlementInfoConfirmField.from_address( pSettlementInfoConfirm),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
cdef extern int TraderSpi_OnRspQryInvestorPositionCombineDetail(self,
CThostFtdcInvestorPositionCombineDetailField *pInvestorPositionCombineDetail,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQryInvestorPositionCombineDetail(
- None if pInvestorPositionCombineDetail is NULL else ApiStructure.InvestorPositionCombineDetailField.from_address(
- pInvestorPositionCombineDetail),
+ None if pInvestorPositionCombineDetail is NULL else ApiStructure.InvestorPositionCombineDetailField.from_address( pInvestorPositionCombineDetail),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
cdef extern int TraderSpi_OnRspQryCFMMCTradingAccountKey(self,
CThostFtdcCFMMCTradingAccountKeyField *pCFMMCTradingAccountKey,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQryCFMMCTradingAccountKey(
- None if pCFMMCTradingAccountKey is NULL else ApiStructure.CFMMCTradingAccountKeyField.from_address(
- pCFMMCTradingAccountKey),
+ None if pCFMMCTradingAccountKey is NULL else ApiStructure.CFMMCTradingAccountKeyField.from_address( pCFMMCTradingAccountKey),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryEWarrantOffset(self, CThostFtdcEWarrantOffsetField *pEWarrantOffset,
+cdef extern int TraderSpi_OnRspQryEWarrantOffset(self,
+ CThostFtdcEWarrantOffsetField *pEWarrantOffset,
CThostFtdcRspInfoField *pRspInfo,
- int nRequestID, cbool bIsLast) except -1:
+ int nRequestID,
+ cbool bIsLast) except -1:
self.OnRspQryEWarrantOffset(
None if pEWarrantOffset is NULL else ApiStructure.EWarrantOffsetField.from_address( pEWarrantOffset),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
cdef extern int TraderSpi_OnRspQryInvestorProductGroupMargin(self,
CThostFtdcInvestorProductGroupMarginField *pInvestorProductGroupMargin,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQryInvestorProductGroupMargin(
- None if pInvestorProductGroupMargin is NULL else ApiStructure.InvestorProductGroupMarginField.from_address(
- pInvestorProductGroupMargin),
+ None if pInvestorProductGroupMargin is NULL else ApiStructure.InvestorProductGroupMarginField.from_address( pInvestorProductGroupMargin),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryExchangeMarginRate(self, CThostFtdcExchangeMarginRateField *pExchangeMarginRate,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspQryExchangeMarginRate(self,
+ CThostFtdcExchangeMarginRateField *pExchangeMarginRate,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQryExchangeMarginRate(
- None if pExchangeMarginRate is NULL else ApiStructure.ExchangeMarginRateField.from_address(
- pExchangeMarginRate),
+ None if pExchangeMarginRate is NULL else ApiStructure.ExchangeMarginRateField.from_address( pExchangeMarginRate),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
cdef extern int TraderSpi_OnRspQryExchangeMarginRateAdjust(self,
CThostFtdcExchangeMarginRateAdjustField *pExchangeMarginRateAdjust,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQryExchangeMarginRateAdjust(
- None if pExchangeMarginRateAdjust is NULL else ApiStructure.ExchangeMarginRateAdjustField.from_address(
- pExchangeMarginRateAdjust),
+ None if pExchangeMarginRateAdjust is NULL else ApiStructure.ExchangeMarginRateAdjustField.from_address( pExchangeMarginRateAdjust),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryExchangeRate(self, CThostFtdcExchangeRateField *pExchangeRate,
+cdef extern int TraderSpi_OnRspQryExchangeRate(self,
+ CThostFtdcExchangeRateField *pExchangeRate,
CThostFtdcRspInfoField *pRspInfo,
- int nRequestID, cbool bIsLast) except -1:
+ int nRequestID,
+ cbool bIsLast) except -1:
self.OnRspQryExchangeRate(
None if pExchangeRate is NULL else ApiStructure.ExchangeRateField.from_address( pExchangeRate),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQrySecAgentACIDMap(self, CThostFtdcSecAgentACIDMapField *pSecAgentACIDMap,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspQrySecAgentACIDMap(self,
+ CThostFtdcSecAgentACIDMapField *pSecAgentACIDMap,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQrySecAgentACIDMap(
None if pSecAgentACIDMap is NULL else ApiStructure.SecAgentACIDMapField.from_address( pSecAgentACIDMap),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryProductExchRate(self, CThostFtdcProductExchRateField *pProductExchRate,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspQryProductExchRate(self,
+ CThostFtdcProductExchRateField *pProductExchRate,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQryProductExchRate(
None if pProductExchRate is NULL else ApiStructure.ProductExchRateField.from_address( pProductExchRate),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryOptionInstrTradeCost(self, CThostFtdcOptionInstrTradeCostField *pOptionInstrTradeCost,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspQryOptionInstrTradeCost(self,
+ CThostFtdcOptionInstrTradeCostField *pOptionInstrTradeCost,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQryOptionInstrTradeCost(
- None if pOptionInstrTradeCost is NULL else ApiStructure.OptionInstrTradeCostField.from_address(
- pOptionInstrTradeCost),
+ None if pOptionInstrTradeCost is NULL else ApiStructure.OptionInstrTradeCostField.from_address( pOptionInstrTradeCost),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryOptionInstrCommRate(self, CThostFtdcOptionInstrCommRateField *pOptionInstrCommRate,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspQryOptionInstrCommRate(self,
+ CThostFtdcOptionInstrCommRateField *pOptionInstrCommRate,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQryOptionInstrCommRate(
- None if pOptionInstrCommRate is NULL else ApiStructure.OptionInstrCommRateField.from_address(
- pOptionInstrCommRate),
+ None if pOptionInstrCommRate is NULL else ApiStructure.OptionInstrCommRateField.from_address( pOptionInstrCommRate),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryExecOrder(self, CThostFtdcExecOrderField *pExecOrder,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspQryExecOrder(self,
+ CThostFtdcExecOrderField *pExecOrder,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQryExecOrder(
None if pExecOrder is NULL else ApiStructure.ExecOrderField.from_address( pExecOrder),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryForQuote(self, CThostFtdcForQuoteField *pForQuote, CThostFtdcRspInfoField *pRspInfo,
+cdef extern int TraderSpi_OnRspQryForQuote(self,
+ CThostFtdcForQuoteField *pForQuote,
+ CThostFtdcRspInfoField *pRspInfo,
int nRequestID,
cbool bIsLast) except -1:
- self.OnRspQryForQuote(None if pForQuote is NULL else ApiStructure.ForQuoteField.from_address( pForQuote),
- None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address(
- pRspInfo), nRequestID, bIsLast)
+ self.OnRspQryForQuote(
+ None if pForQuote is NULL else ApiStructure.ForQuoteField.from_address( pForQuote),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryQuote(self, CThostFtdcQuoteField *pQuote, CThostFtdcRspInfoField *pRspInfo,
+cdef extern int TraderSpi_OnRspQryQuote(self,
+ CThostFtdcQuoteField *pQuote,
+ CThostFtdcRspInfoField *pRspInfo,
int nRequestID,
cbool bIsLast) except -1:
- self.OnRspQryQuote(None if pQuote is NULL else ApiStructure.QuoteField.from_address( pQuote),
- None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address(
- pRspInfo), nRequestID, bIsLast)
+ self.OnRspQryQuote(
+ None if pQuote is NULL else ApiStructure.QuoteField.from_address( pQuote),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryCombInstrumentGuard(self, CThostFtdcCombInstrumentGuardField *pCombInstrumentGuard,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspQryCombInstrumentGuard(self,
+ CThostFtdcCombInstrumentGuardField *pCombInstrumentGuard,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQryCombInstrumentGuard(
- None if pCombInstrumentGuard is NULL else ApiStructure.CombInstrumentGuardField.from_address(
- pCombInstrumentGuard),
+ None if pCombInstrumentGuard is NULL else ApiStructure.CombInstrumentGuardField.from_address( pCombInstrumentGuard),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryCombAction(self, CThostFtdcCombActionField *pCombAction,
+cdef extern int TraderSpi_OnRspQryCombAction(self,
+ CThostFtdcCombActionField *pCombAction,
CThostFtdcRspInfoField *pRspInfo,
- int nRequestID, cbool bIsLast) except -1:
+ int nRequestID,
+ cbool bIsLast) except -1:
self.OnRspQryCombAction(
None if pCombAction is NULL else ApiStructure.CombActionField.from_address( pCombAction),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryTransferSerial(self, CThostFtdcTransferSerialField *pTransferSerial,
+cdef extern int TraderSpi_OnRspQryTransferSerial(self,
+ CThostFtdcTransferSerialField *pTransferSerial,
CThostFtdcRspInfoField *pRspInfo,
- int nRequestID, cbool bIsLast) except -1:
+ int nRequestID,
+ cbool bIsLast) except -1:
self.OnRspQryTransferSerial(
None if pTransferSerial is NULL else ApiStructure.TransferSerialField.from_address( pTransferSerial),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
-cdef extern int TraderSpi_OnRspQryAccountregister(self, CThostFtdcAccountregisterField *pAccountregister,
- CThostFtdcRspInfoField *pRspInfo, int nRequestID,
+cdef extern int TraderSpi_OnRspQryAccountregister(self,
+ CThostFtdcAccountregisterField *pAccountregister,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
cbool bIsLast) except -1:
self.OnRspQryAccountregister(
None if pAccountregister is NULL else ApiStructure.AccountregisterField.from_address( pAccountregister),
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
+
return 0
-cdef extern int TraderSpi_OnRspError(self, CThostFtdcRspInfoField *pRspInfo, int nRequestID, cbool bIsLast) except -1:
+cdef extern int TraderSpi_OnRspError(self,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
+ cbool bIsLast) except -1:
self.OnRspError(
None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
- nRequestID, bIsLast)
+ nRequestID,
+ bIsLast
+ )
return 0
cdef extern int TraderSpi_OnRtnOrder(self, CThostFtdcOrderField *pOrder) except -1:
- self.OnRtnOrder(None if pOrder is NULL else ApiStructure.OrderField.from_address( pOrder))
+ self.OnRtnOrder(
+ None if pOrder is NULL else ApiStructure.OrderField.from_address( pOrder)
+ )
return 0
cdef extern int TraderSpi_OnRtnTrade(self, CThostFtdcTradeField *pTrade) except -1:
- self.OnRtnTrade(None if pTrade is NULL else ApiStructure.TradeField.from_address( pTrade))
+ self.OnRtnTrade(
+ None if pTrade is NULL else ApiStructure.TradeField.from_address( pTrade)
+ )
return 0
-cdef extern int TraderSpi_OnErrRtnOrderInsert(self, CThostFtdcInputOrderField *pInputOrder,
+cdef extern int TraderSpi_OnErrRtnOrderInsert(self,
+ CThostFtdcInputOrderField *pInputOrder,
CThostFtdcRspInfoField *pRspInfo) except -1:
self.OnErrRtnOrderInsert(
None if pInputOrder is NULL else ApiStructure.InputOrderField.from_address( pInputOrder),
- None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo))
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo)
+ )
return 0
-cdef extern int TraderSpi_OnErrRtnOrderAction(self, CThostFtdcOrderActionField *pOrderAction,
+cdef extern int TraderSpi_OnErrRtnOrderAction(self,
+ CThostFtdcOrderActionField *pOrderAction,
CThostFtdcRspInfoField *pRspInfo) except -1:
self.OnErrRtnOrderAction(
None if pOrderAction is NULL else ApiStructure.OrderActionField.from_address( pOrderAction),
- None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo))
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo)
+ )
return 0
cdef extern int TraderSpi_OnRtnInstrumentStatus(self, CThostFtdcInstrumentStatusField *pInstrumentStatus) except -1:
self.OnRtnInstrumentStatus(
- None if pInstrumentStatus is NULL else ApiStructure.InstrumentStatusField.from_address(
- pInstrumentStatus))
+ None if pInstrumentStatus is NULL else ApiStructure.InstrumentStatusField.from_address( pInstrumentStatus)
+ )
return 0
cdef extern int TraderSpi_OnRtnTradingNotice(self, CThostFtdcTradingNoticeInfoField *pTradingNoticeInfo) except -1:
self.OnRtnTradingNotice(
- None if pTradingNoticeInfo is NULL else ApiStructure.TradingNoticeInfoField.from_address(
- pTradingNoticeInfo))
+ None if pTradingNoticeInfo is NULL else ApiStructure.TradingNoticeInfoField.from_address( pTradingNoticeInfo)
+ )
return 0
-cdef extern int TraderSpi_OnRtnErrorConditionalOrder(self,
- CThostFtdcErrorConditionalOrderField *pErrorConditionalOrder) except -1:
+cdef extern int TraderSpi_OnRtnErrorConditionalOrder(self, CThostFtdcErrorConditionalOrderField *pErrorConditionalOrder) except -1:
self.OnRtnErrorConditionalOrder(
- None if pErrorConditionalOrder is NULL else ApiStructure.ErrorConditionalOrderField.from_address(
- pErrorConditionalOrder))
+ None if pErrorConditionalOrder is NULL else ApiStructure.ErrorConditionalOrderField.from_address( pErrorConditionalOrder)
+ )
return 0
cdef extern int TraderSpi_OnRtnExecOrder(self, CThostFtdcExecOrderField *pExecOrder) except -1:
- self.OnRtnExecOrder(None if pExecOrder is NULL else ApiStructure.ExecOrderField.from_address( pExecOrder))
+ self.OnRtnExecOrder(
+ None if pExecOrder is NULL else ApiStructure.ExecOrderField.from_address( pExecOrder)
+ )
return 0
-cdef extern int TraderSpi_OnErrRtnExecOrderInsert(self, CThostFtdcInputExecOrderField *pInputExecOrder,
+cdef extern int TraderSpi_OnErrRtnExecOrderInsert(self,
+ CThostFtdcInputExecOrderField *pInputExecOrder,
CThostFtdcRspInfoField *pRspInfo) except -1:
self.OnErrRtnExecOrderInsert(
None if pInputExecOrder is NULL else ApiStructure.InputExecOrderField.from_address( pInputExecOrder),
- None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo))
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo)
+ )
return 0
-cdef extern int TraderSpi_OnErrRtnExecOrderAction(self, CThostFtdcExecOrderActionField *pExecOrderAction,
+cdef extern int TraderSpi_OnErrRtnExecOrderAction(self,
+ CThostFtdcExecOrderActionField *pExecOrderAction,
CThostFtdcRspInfoField *pRspInfo) except -1:
self.OnErrRtnExecOrderAction(
None if pExecOrderAction is NULL else ApiStructure.ExecOrderActionField.from_address( pExecOrderAction),
- None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo))
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo)
+ )
return 0
-cdef extern int TraderSpi_OnErrRtnForQuoteInsert(self, CThostFtdcInputForQuoteField *pInputForQuote,
+cdef extern int TraderSpi_OnErrRtnForQuoteInsert(self,
+ CThostFtdcInputForQuoteField *pInputForQuote,
CThostFtdcRspInfoField *pRspInfo) except -1:
self.OnErrRtnForQuoteInsert(
None if pInputForQuote is NULL else ApiStructure.InputForQuoteField.from_address( pInputForQuote),
- None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo))
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo)
+ )
return 0
cdef extern int TraderSpi_OnRtnQuote(self, CThostFtdcQuoteField *pQuote) except -1:
- self.OnRtnQuote(None if pQuote is NULL else ApiStructure.QuoteField.from_address( pQuote))
+ self.OnRtnQuote(
+ None if pQuote is NULL else ApiStructure.QuoteField.from_address( pQuote)
+ )
return 0
-cdef extern int TraderSpi_OnErrRtnQuoteInsert(self, CThostFtdcInputQuoteField *pInputQuote,
+cdef extern int TraderSpi_OnErrRtnQuoteInsert(self,
+ CThostFtdcInputQuoteField *pInputQuote,
CThostFtdcRspInfoField *pRspInfo) except -1:
self.OnErrRtnQuoteInsert(
None if pInputQuote is NULL else ApiStructure.InputQuoteField.from_address( pInputQuote),
- None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo))
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo)
+ )
return 0
-cdef extern int TraderSpi_OnErrRtnQuoteAction(self, CThostFtdcQuoteActionField *pQuoteAction,
+cdef extern int TraderSpi_OnErrRtnQuoteAction(self,
+ CThostFtdcQuoteActionField *pQuoteAction,
CThostFtdcRspInfoField *pRspInfo) except -1:
self.OnErrRtnQuoteAction(
None if pQuoteAction is NULL else ApiStructure.QuoteActionField.from_address( pQuoteAction),
- None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address(