补充新的CTP接口中未实现的callback函数

This commit is contained in:
chenxy123 2016-07-25 22:32:55 +08:00
parent e7582dd01f
commit e36bd4a3f2

View File

@ -56,6 +56,14 @@ posiDirectionMap[DIRECTION_LONG] = defineDict["THOST_FTDC_PD_Long"]
posiDirectionMap[DIRECTION_SHORT] = defineDict["THOST_FTDC_PD_Short"] posiDirectionMap[DIRECTION_SHORT] = defineDict["THOST_FTDC_PD_Short"]
posiDirectionMapReverse = {v:k for k,v in posiDirectionMap.items()} posiDirectionMapReverse = {v:k for k,v in posiDirectionMap.items()}
# 产品类型映射
productClassMap = {}
productClassMap[PRODUCT_FUTURES] = defineDict["THOST_FTDC_PC_Futures"]
productClassMap[PRODUCT_OPTION] = defineDict["THOST_FTDC_PC_Options"]
productClassMap[PRODUCT_COMBINATION] = defineDict["THOST_FTDC_PC_Combination"]
productClassMapReverse = {v:k for k,v in productClassMap.items()}
######################################################################## ########################################################################
class CtpGateway(VtGateway): class CtpGateway(VtGateway):
@ -614,6 +622,16 @@ class CtpTdApi(TdApi):
"""""" """"""
pass pass
#----------------------------------------------------------------------
def onRspLockInsert(self, data, error, n, last):
""""""
pass
#----------------------------------------------------------------------
def onRspCombActionInsert(self, data, error, n, last):
""""""
pass
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def onRspQryOrder(self, data, error, n, last): def onRspQryOrder(self, data, error, n, last):
"""""" """"""
@ -674,7 +692,7 @@ class CtpTdApi(TdApi):
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def onRspQryInvestor(self, data, error, n, last): def onRspQryInvestor(self, data, error, n, last):
"""投资者查询回报""" """"""
pass pass
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@ -719,15 +737,7 @@ class CtpTdApi(TdApi):
contract.strikePrice = data['StrikePrice'] contract.strikePrice = data['StrikePrice']
contract.underlyingSymbol = data['UnderlyingInstrID'] contract.underlyingSymbol = data['UnderlyingInstrID']
# 合约类型 contract.productClass = productClassMapReverse.get(data['ProductClass'], PRODUCT_UNKNOWN)
if data['ProductClass'] == '1':
contract.productClass = PRODUCT_FUTURES
elif data['ProductClass'] == '2':
contract.productClass = PRODUCT_OPTION
elif data['ProductClass'] == '3':
contract.productClass = PRODUCT_COMBINATION
else:
contract.productClass = PRODUCT_UNKNOWN
# 期权类型 # 期权类型
if data['OptionsType'] == '1': if data['OptionsType'] == '1':
@ -755,7 +765,7 @@ class CtpTdApi(TdApi):
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def onRspQrySettlementInfo(self, data, error, n, last): def onRspQrySettlementInfo(self, data, error, n, last):
"""查询结算信息回报""" """"""
pass pass
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@ -818,6 +828,16 @@ class CtpTdApi(TdApi):
"""""" """"""
pass pass
#----------------------------------------------------------------------
def onRspQryProductExchRate(self, data, error, n, last):
""""""
pass
#----------------------------------------------------------------------
def onRspQryProductGroup(self, data, error, n, last):
""""""
pass
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def onRspQryOptionInstrTradeCost(self, data, error, n, last): def onRspQryOptionInstrTradeCost(self, data, error, n, last):
"""""" """"""
@ -843,6 +863,36 @@ class CtpTdApi(TdApi):
"""""" """"""
pass pass
#----------------------------------------------------------------------
def onRspQryLock(self, data, error, n, last):
""""""
pass
#----------------------------------------------------------------------
def onRspQryLockPosition(self, data, error, n, last):
""""""
pass
#----------------------------------------------------------------------
def onRspQryInvestorLevel(self, data, error, n, last):
""""""
pass
#----------------------------------------------------------------------
def onRspQryExecFreeze(self, data, error, n, last):
""""""
pass
#----------------------------------------------------------------------
def onRspQryCombInstrumentGuard(self, data, error, n, last):
""""""
pass
#----------------------------------------------------------------------
def onRspQryCombAction(self, data, error, n, last):
""""""
pass
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def onRspQryTransferSerial(self, data, error, n, last): def onRspQryTransferSerial(self, data, error, n, last):
"""""" """"""
@ -1086,6 +1136,11 @@ class CtpTdApi(TdApi):
"""""" """"""
pass pass
#----------------------------------------------------------------------
def onRspQueryCFMMCTradingAccountToken(self, data, error, n, last):
""""""
pass
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def onRtnFromBankToFutureByBank(self, data): def onRtnFromBankToFutureByBank(self, data):
"""""" """"""
@ -1196,6 +1251,7 @@ class CtpTdApi(TdApi):
"""""" """"""
pass pass
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def connect(self, userID, password, brokerID, address): def connect(self, userID, password, brokerID, address):
"""初始化连接""" """初始化连接"""