增加vn.trader中的xspeedGateway接入

This commit is contained in:
lyic 2016-04-02 17:04:58 +08:00
parent c72eee5705
commit e138ff7379
29 changed files with 23368 additions and 116 deletions

File diff suppressed because it is too large Load Diff

View File

@ -45,6 +45,8 @@ class BacktestingEngine(object):
self.mode = self.BAR_MODE # 回测模式默认为K线
self.slippage = 0 # 回测时假设的滑点
self.rate = 0 # 回测时假设的佣金比例(适用于百分比佣金)
self.size = 1 # 合约大小默认为1
self.dbClient = None # 数据库客户端
self.dbCursor = None # 数据库指针
@ -285,8 +287,10 @@ class BacktestingEngine(object):
# 3. 则在实际中的成交价会是100而不是105因为委托发出时市场的最优价格是100
if buyCross:
trade.price = min(order.price, bestCrossPrice)
self.strategy.pos += order.totalVolume
else:
trade.price = max(order.price, bestCrossPrice)
self.strategy.pos -= order.totalVolume
trade.volume = order.totalVolume
trade.tradeTime = str(self.dt)
@ -310,9 +314,11 @@ class BacktestingEngine(object):
if self.mode == self.BAR_MODE:
buyCrossPrice = self.bar.high # 若买入方向停止单价格低于该价格,则会成交
sellCrossPrice = self.bar.low # 若卖出方向限价单价格高于该价格,则会成交
bestCrossPrice = self.bar.open # 最优成交价,买入停止单不能低于,卖出停止单不能高于
else:
buyCrossPrice = self.tick.lastPrice
sellCrossPrice = self.tick.lastPrice
bestCrossPrice = self.tick.lastPrice
# 遍历停止单字典中的所有停止单
for stopOrderID, so in self.workingStopOrderDict.items():
@ -330,6 +336,13 @@ class BacktestingEngine(object):
trade.tradeID = tradeID
trade.vtTradeID = tradeID
if buyCross:
self.strategy.pos += so.volume
trade.price = max(bestCrossPrice, so.price)
else:
self.strategy.pos -= so.volume
trade.price = min(bestCrossPrice, so.price)
self.limitOrderCount += 1
orderID = str(self.limitOrderCount)
trade.orderID = orderID
@ -337,7 +350,6 @@ class BacktestingEngine(object):
trade.direction = so.direction
trade.offset = so.offset
trade.price = so.price
trade.volume = so.volume
trade.tradeTime = str(self.dt)
trade.dt = self.dt
@ -405,6 +417,9 @@ class BacktestingEngine(object):
longTrade = [] # 未平仓的多头交易
shortTrade = [] # 未平仓的空头交易
# 计算滑点,一个来回包括两次
totalSlippage = self.slippage * 2
for trade in self.tradeDict.values():
# 多头交易
if trade.direction == DIRECTION_LONG:
@ -414,8 +429,11 @@ class BacktestingEngine(object):
# 当前多头交易为平空
else:
entryTrade = shortTrade.pop(0)
# 滑点对于交易而言永远是不利的方向,因此每笔交易开平需要减去两倍的滑点
pnl = (trade.price - entryTrade.price - self.slippage * 2) * trade.volume * (-1)
# 计算比例佣金
commission = (trade.price+entryTrade.price) * self.rate
# 计算盈亏
pnl = ((trade.price - entryTrade.price)*(-1) - totalSlippage - commission) \
* trade.volume * self.size
pnlDict[trade.dt] = pnl
# 空头交易
else:
@ -425,7 +443,11 @@ class BacktestingEngine(object):
# 当前空头交易为平多
else:
entryTrade = longTrade.pop(0)
pnl = (trade.price - entryTrade.price - self.slippage * 2) * trade.volume
# 计算比例佣金
commission = (trade.price+entryTrade.price) * self.rate
# 计算盈亏
pnl = ((trade.price - entryTrade.price) - totalSlippage - commission) \
* trade.volume * self.size
pnlDict[trade.dt] = pnl
# 然后基于每笔交易的结果,我们可以计算具体的盈亏曲线和最大回撤等
@ -449,6 +471,14 @@ class BacktestingEngine(object):
maxCapitalList.append(maxCapital)
drawdownList.append(drawdown)
# 输出
self.output('-' * 50)
self.output(u'第一笔交易时间:%s' % timeList[0])
self.output(u'最后一笔交易时间:%s' % timeList[-1])
self.output(u'总交易次数:%s' % len(pnlList))
self.output(u'总盈亏:%s' % capitalList[-1])
self.output(u'最大回撤: %s' % min(drawdownList))
# 绘图
import matplotlib.pyplot as plt
@ -463,14 +493,8 @@ class BacktestingEngine(object):
pPnl = plt.subplot(3, 1, 3)
pPnl.set_ylabel("pnl")
pPnl.hist(pnlList, bins=20)
# 输出
self.output('-' * 50)
self.output(u'第一笔交易时间:%s' % timeList[0])
self.output(u'最后一笔交易时间:%s' % timeList[-1])
self.output(u'总交易次数:%s' % len(pnlList))
self.output(u'总盈亏:%s' % capitalList[-1])
self.output(u'最大回撤: %s' % min(drawdownList))
plt.show()
#----------------------------------------------------------------------
def putStrategyEvent(self, name):
@ -481,6 +505,17 @@ class BacktestingEngine(object):
def setSlippage(self, slippage):
"""设置滑点"""
self.slippage = slippage
#----------------------------------------------------------------------
def setSize(self, size):
"""设置合约大小"""
self.size = size
#----------------------------------------------------------------------
def setRate(self, rate):
"""设置佣金比例"""
self.rate = rate
if __name__ == '__main__':
@ -494,16 +529,18 @@ if __name__ == '__main__':
# 设置引擎的回测模式为K线
engine.setBacktestingMode(engine.BAR_MODE)
# 设置滑点
engine.setSlippage(0.2) # 股指1跳
# 设置回测用的数据起始日期
engine.setStartDate('20100416')
engine.setStartDate('20110101')
# 载入历史数据到引擎中
engine.loadHistoryData(MINUTE_DB_NAME, 'IF0000')
# 设置产品相关参数
engine.setSlippage(0.2) # 股指1跳
engine.setRate(0.3/10000) # 万0.3
engine.setSize(300) # 股指合约大小
# 在引擎中创建策略对象
engine.initStrategy(DoubleEmaDemo, {})

View File

@ -28,6 +28,7 @@ STOPORDER_TRIGGERED = u'已触发'
STOPORDERPREFIX = 'CtaStopOrder.'
# 数据库名称
SETTING_DB_NAME = 'VnTrader_Setting_Db'
TICK_DB_NAME = 'VtTrader_Tick_Db'
DAILY_DB_NAME = 'VtTrader_Daily_Db'
MINUTE_DB_NAME = 'VtTrader_1Min_Db'

View File

@ -285,4 +285,3 @@ class OrderManagementDemo(CtaTemplate):
"""收到成交推送(必须由用户继承实现)"""
# 对于无需做细粒度委托控制的策略可以忽略onOrder
pass

View File

@ -10,6 +10,7 @@ vtSymbol直接使用symbol
import os
import json
from copy import copy
from vnctpmd import MdApi
from vnctptd import TdApi
@ -436,6 +437,8 @@ class CtpTdApi(TdApi):
self.frontID = EMPTY_INT # 前置机编号
self.sessionID = EMPTY_INT # 会话编号
self.posDict = {} # 缓存持仓数据的字典
#----------------------------------------------------------------------
def onFrontConnected(self):
"""服务器连接"""
@ -495,7 +498,7 @@ class CtpTdApi(TdApi):
# 否则,推送错误信息
else:
err = VtErrorData()
err.gatewayName = self.gateway
err.gatewayName = self.gatewayName
err.errorID = error['ErrorID']
err.errorMsg = error['ErrorMsg'].decode('gbk')
self.gateway.onError(err)
@ -624,33 +627,47 @@ class CtpTdApi(TdApi):
#----------------------------------------------------------------------
def onRspQryInvestorPosition(self, data, error, n, last):
"""持仓查询回报"""
pos = VtPositionData()
pos.gatewayName = self.gatewayName
# 获取缓存字典中的持仓对象,若无则创建并初始化
positionName = '.'.join([data['InstrumentID'], data['PosiDirection']])
# 保存代码
pos.symbol = data['InstrumentID']
pos.vtSymbol = pos.symbol # 这里因为data中没有ExchangeID这个字段
if positionName in self.posDict:
pos = self.posDict[positionName]
else:
pos = VtPositionData()
self.posDict[positionName] = pos
pos.gatewayName = self.gatewayName
# 方向和持仓冻结数量
pos.direction = posiDirectionMapReverse.get(data['PosiDirection'], '')
# 保存代码
pos.symbol = data['InstrumentID']
pos.vtSymbol = pos.symbol # 这里因为data中没有ExchangeID这个字段
# 方向
pos.direction = posiDirectionMapReverse.get(data['PosiDirection'], '')
# VT系统持仓名
pos.vtPositionName = '.'.join([pos.vtSymbol, pos.direction])
# 持仓冻结数量
if pos.direction == DIRECTION_NET or pos.direction == DIRECTION_LONG:
pos.frozen = data['LongFrozen']
elif pos.direction == DIRECTION_SHORT:
pos.frozen = data['ShortFrozen']
# 持仓量
pos.position = data['Position']
pos.ydPosition = data['YdPosition']
if data['Position']:
pos.position = data['Position']
if data['YdPosition']:
pos.ydPosition = data['YdPosition']
# 持仓均价
if pos.position:
pos.price = data['PositionCost'] / pos.position
# VT系统持仓名
pos.vtPositionName = '.'.join([pos.vtSymbol, pos.direction])
# 推送
self.gateway.onPosition(pos)
newpos = copy(pos)
self.gateway.onPosition(newpos)
#----------------------------------------------------------------------
def onRspQryTradingAccount(self, data, error, n, last):

View File

@ -177,8 +177,9 @@ class OandaApi(object):
#----------------------------------------------------------------------
def exit(self):
"""退出接口"""
self.active = False
self.reqThread.join()
if self.active:
self.active = False
self.reqThread.join()
#----------------------------------------------------------------------
def initFunctionSetting(self, code, setting):

View File

@ -80,7 +80,10 @@ class MainWindow(QtGui.QMainWindow):
connectKsotpAction.triggered.connect(self.connectKsotp)
connectFemasAction = QtGui.QAction(u'连接飞马', self)
connectFemasAction.triggered.connect(self.connectFemas)
connectFemasAction.triggered.connect(self.connectFemas)
connectXspeedAction = QtGui.QAction(u'连接飞创', self)
connectXspeedAction.triggered.connect(self.connectXspeed)
connectKsgoldAction = QtGui.QAction(u'连接金仕达黄金', self)
connectKsgoldAction.triggered.connect(self.connectKsgold)
@ -122,6 +125,7 @@ class MainWindow(QtGui.QMainWindow):
sysMenu.addAction(connectCtpAction)
sysMenu.addAction(connectLtsAction)
sysMenu.addAction(connectFemasAction)
sysMenu.addAction(connectXspeedAction)
sysMenu.addAction(connectKsotpAction)
sysMenu.addAction(connectKsgoldAction)
sysMenu.addAction(connectSgitAction)
@ -195,7 +199,12 @@ class MainWindow(QtGui.QMainWindow):
def connectFemas(self):
"""连接飞马接口"""
self.mainEngine.connect('FEMAS')
#----------------------------------------------------------------------
def connectXspeed(self):
"""连接飞马接口"""
self.mainEngine.connect('XSPEED')
#----------------------------------------------------------------------
def connectKsgold(self):
"""连接金仕达黄金接口"""

View File

@ -68,7 +68,14 @@ class MainEngine(object):
self.gatewayDict['FEMAS'].setQryEnabled(True)
except Exception, e:
print e
try:
from xspeedGateway.xspeedGateway import XspeedGateway
self.addGateway(XspeedGateway, 'XSPEED')
self.gatewayDict['XSPEED'].setQryEnabled(True)
except Exception, e:
print e
try:
from ksgoldGateway.ksgoldGateway import KsgoldGateway
self.addGateway(KsgoldGateway, 'KSGOLD')

View File

@ -6,7 +6,7 @@
import decimal
MAX_NUMBER = 1000000000
MAX_NUMBER = 10000000000000
MAX_DECIMAL = 4
#----------------------------------------------------------------------

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,6 @@
{
"tdAddress": "tcp://203.187.171.250:10910",
"password": "123",
"mdAddress": "tcp://203.187.171.250:10915",
"accountID": "000200002874"
}

View File

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,954 @@
# encoding: UTF-8
defineDict = {}
typedefDict = {}
#/////////////////////////////////////////////////////////
#DFITCUserIDType用户ID数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCUserIDType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCAccountIDType资金账户数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCAccountIDType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCExecStateType执行状态数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCExecStateType"] = "int"
#成功
defineDict["DFITC_SUCCESS"] = 0
#失败
defineDict["DFITC_FAIL"] = 1
#/////////////////////////////////////////////////////////
#DFITCClientIDType交易编码数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCClientIDType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCClientStatusType交易编码状态数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCClientStatusType"] = "int"
#禁止开新仓
defineDict["DFITC_PROHIBIT_OPEN"] = 4
#允许开新仓
defineDict["DFITC_ALLOW_OPEN"] = 5
#/////////////////////////////////////////////////////////
#DFITCInstrumentIDType合约代码数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCInstrumentIDType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCInstrumentPrefixType品种名称数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCInstrumentPrefixType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCVarietyNameType品种名称数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCVarietyNameType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCInstrumentNameType合约名称数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCInstrumentNameType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCActiveContractType有效合约数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCActiveContractType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCLocalOrderIDType:本地委托号数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCLocalOrderIDType"] = "long"
#/////////////////////////////////////////////////////////
#DFITCPriceType:价格数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCPriceType"] = "float"
#/////////////////////////////////////////////////////////
#DFITCAmountType:委托数量数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCAmountType"] = "long"
#/////////////////////////////////////////////////////////
#DFITCBuySellTypeType:买卖数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCBuySellTypeType"] = "short"
#买
defineDict["DFITC_SPD_BUY"] = 1
#卖
defineDict["DFITC_SPD_SELL"] = 2
#/////////////////////////////////////////////////////////
#DFITCOpenCloseTypeType开平标志数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCOpenCloseTypeType"] = "int"
#开仓
defineDict["DFITC_SPD_OPEN"] = 1
#平仓
defineDict["DFITC_SPD_CLOSE"] = 2
#平今
defineDict["DFITC_SPD_CLOSETODAY"] = 4
#期权执行
defineDict["DFITC_SPD_EXECUTE"] = 6
#期权放弃
defineDict["DFITC_SPD_GIVEUP"] = 7
#期权履约
defineDict["DFITC_SPD_PERFORM"] = 8
#询价
defineDict["DFITC_SPD_OPTQRYPRICE"] = 9
#强平
defineDict["DFITC_SPD_FORCECLOSE"] = 12
#强平今
defineDict["DFITC_SPD_FORCECLOSETODAY"] = 14
#/////////////////////////////////////////////////////////
#DFITCSpeculationValueType:投机保值数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCSpeculationValueType"] = "short"
#/////////////////////////////////////////////////////////
#DFITCExchangeIDType:交易所编码数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCExchangeIDType"] = "string"
#大商所
defineDict["DFITC_EXCHANGE_DCE"] = "DCE"
#郑商所
defineDict["DFITC_EXCHANGE_CZCE"] = "CZCE"
#上期所
defineDict["DFITC_EXCHANGE_SHFE"] = "SHFE"
#中金所
defineDict["DFITC_EXCHANGE_CFFEX"] = "CFFEX"
#上能所
defineDict["DFITC_EXCHANGE_INE"] = "INE"
#/////////////////////////////////////////////////////////
#DFITCFrontAddrType:前置机地址数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCFrontAddrType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCCompanyIDType:开发商代码数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCCompanyIDType"] = "short"
#/////////////////////////////////////////////////////////
#DFITCPasswdType:用户密码数据类型
#柜台端密码不能为空且有效长度最大为16位
#/////////////////////////////////////////////////////////
typedefDict["DFITCPasswdType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCSPDOrderIDType:柜台委托号数据类型
#柜台委托号和条件单号使用相同字段表示
#当DFITCSPDOrderIDType的取值为正数[最小为1 ],表示为柜台委
#托号,该笔报单已经到柜台
#当DFITCSPDOrderIDType的取值为负数[最大为-2],标示为条件单
#号,该笔报单在条件单模块
#/////////////////////////////////////////////////////////
typedefDict["DFITCSPDOrderIDType"] = "long"
#/////////////////////////////////////////////////////////
#DFITCOrderSysIDType:报单编号数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCOrderSysIDType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCOrderType:报单类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCOrderTypeType"] = "int"
#限价委托
defineDict["DFITC_LIMITORDER"] = 1
#市价委托
defineDict["DFITC_MKORDER"] = 2
#套利委托
defineDict["DFITC_ARBITRAGE"] = 4
#展期互换委托
defineDict["DFITC_EXTENSION"] = 8
#限价止盈委托
defineDict["DFITC_PROFIT_LIMITORDER"] = 32
#市价止盈委托
defineDict["DFITC_PROFIT_MKORDER"] = 34
#限价止损委托
defineDict["DFITC_LOSS_LIMITORDER"] = 48
#市价止损委托
defineDict["DFITC_LOSS_MKORDER"] = 50
#/////////////////////////////////////////////////////////
#DFITCOrderAnswerStatusType:委托回报类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCOrderAnswerStatusType"] = "short"
#全部撤单
defineDict["DFITC_SPD_CANCELED"] = 1
#全部成交
defineDict["DFITC_SPD_FILLED"] = 2
#未成交还在队列中
defineDict["DFITC_SPD_IN_QUEUE"] = 3
#部分成交还在队列中
defineDict["DFITC_SPD_PARTIAL"] = 4
#部成部撤
defineDict["DFITC_SPD_PARTIAL_CANCELED"] = 5
#撤单中
defineDict["DFITC_SPD_IN_CANCELING"] = 6
#错误(废单错误)
defineDict["DFITC_SPD_ERROR"] = 7
#未成交不在队列中
defineDict["DFITC_SPD_PLACED"] = 8
#柜台已接收,但尚未到交易所
defineDict["DFITC_SPD_TRIGGERED"] = 10
#////////////////////////////////////////////////////////////
#基于算法单模块新增
#////////////////////////////////////////////////////////////
#未触发
defineDict["DFITC_EXT_UNTRIGGER"] = 13
#部分触发
defineDict["DFITC_EXT_PART_TRIGGER"] = 14
#全部触发
defineDict["DFITC_EXT_ALL_TRIGGER"] = 15
#已经撤单
defineDict["DFITC_EXT_CANCELLED"] = 16
#报单失败
defineDict[""] = 17
#/////////////////////////////////////////////////////////
#DFITCMatchIDType:成交编号数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCMatchIDType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCDateType时间数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCDateType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCMatchType:成交类型数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCMatchType"] = "long"
#普通成交
defineDict["DFITC_BASIC_TRADE"] = 0
#/////////////////////////////////////////////////////////
#DFITCSpeculatorType:投保类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCSpeculatorType"] = "int"
#投机
defineDict["DFITC_SPD_SPECULATOR"] = 0
#套保
defineDict["DFITC_SPD_HEDGE"] = 1
#套利
defineDict["DFITC_SPD_ARBITRAGE"] = 2
#/////////////////////////////////////////////////////////
#DFITCFeeType:手续费数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCFeeType"] = "float"
#/////////////////////////////////////////////////////////
#DFITCErrorIDType:错误数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCErrorIDType"] = "int"
#/////////////////////////////////////////////////////////
#DFITCErrorMsgInfoType:错误信息数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCErrorMsgInfoType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCMsgInfoType:消息信息数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCMsgInfoType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCEquityType:权益数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCEquityType"] = "float"
#/////////////////////////////////////////////////////////
#DFITCProfitLossType:盈亏数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCProfitLossType"] = "float"
#/////////////////////////////////////////////////////////
#DFITCAccountLoginResultType:资金账户登录结果
#/////////////////////////////////////////////////////////
typedefDict["DFITCAccountLoginResultType"] = "int"
#登录成功
defineDict["DFITC_LOGIN_SUCCESS"] = 0
#登录失败
defineDict["DFITC_LOGIN_FAILED"] = 1
#已退出
defineDict["DFITC_LOGIN_QUIT"] = 2
#未操作
defineDict["DFITC_LOGIN_NOT_OPERATE"] = 9
#/////////////////////////////////////////////////////////
#DFITCSessionIDType:SessionID数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCSessionIDType"] = "long"
#/////////////////////////////////////////////////////////
#DFITCAccountLogoutResultType:资金帐号登出结果
#/////////////////////////////////////////////////////////
typedefDict["DFITCAccountLogoutResultType"] = "int"
#登出成功
defineDict["DFITC_LOGOUT_SUCCESS"] = 0
#登出失败
defineDict["DFITC_LOGOUT_FAILED"] = 1
#/////////////////////////////////////////////////////////
#DFITCUserTypeType:用户类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCUserTypeType"] = "int"
#/////////////////////////////////////////////////////////
#DFITCCounterIDType:柜台编号数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCCounterIDType"] = "int"
#/////////////////////////////////////////////////////////
#DFITCRiskDegreeType:风险度数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCRiskDegreeType"] = "float"
#/////////////////////////////////////////////////////////
#DFITCMilliSecType:微秒数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCMilliSecType"] = "int"
#/////////////////////////////////////////////////////////
#DFITCDeltaType:虚实度数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCDeltaType"] = "float"
#/////////////////////////////////////////////////////////
#DFITCVolumeType数量数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCVolumeType"] = "int"
#/////////////////////////////////////////////////////////
#DFITCFrontIDType:前置机编号数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCFrontIDType"] = "int"
#/////////////////////////////////////////////////////////
#DFITCOfferPriceLimitType:报价数据上限数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCOfferPriceLimitType"] = "int"
#/////////////////////////////////////////////////////////
#DFITCOrderNumType:委托号数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCOrderNumType"] = "short"
#/////////////////////////////////////////////////////////
#DFITCRatioType:比率数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCRatioType"] = "float"
#/////////////////////////////////////////////////////////
#DFITCPremiumType:权利金
#/////////////////////////////////////////////////////////
typedefDict["DFITCPremiumType"] = "float"
#/////////////////////////////////////////////////////////
#DFITCMarketValueType:期权市值
#/////////////////////////////////////////////////////////
typedefDict["DFITCMarketValueType"] = "float"
#/////////////////////////////////////////////////////////
#DFITCTimeType:交易所时间
#/////////////////////////////////////////////////////////
typedefDict["DFITCTimeType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCAbiPolicyCodeType: 套利策略代码数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCAbiPolicyCodeType"] = "string"
#跨期套利
defineDict["DFITC_SP"] = "SP"
#两腿跨品种套利
defineDict["DFITC_SP_SPC"] = "SPC"
#压榨套利
defineDict["DFITC_SP_SPX"] = "SPX"
#Call Spread
defineDict["DFITC_SP_CALL"] = "CSPR"
#Put Spread
defineDict["DFITC_SP_PUT"] = "PSPR"
#Combo
defineDict["DFITC_SP_COMBO"] = "COMBO"
#Straddle
defineDict["DFITC_SP_STRADDLE"] = "STD"
#Strangle
defineDict["DFITC_SP_STRANGLE"] = "STG"
#Guts
defineDict["DFITC_SP_GUTS"] = "GUTS"
#Synthetic Underlying
defineDict["DFITC_SP_SYNUND"] = "SYN"
#/////////////////////////////////////////////////////////
#DFITCOrderPropertyType:订单属性
#/////////////////////////////////////////////////////////
typedefDict["DFITCOrderPropertyType"] = "char"
#无订单属性
defineDict["DFITC_SP_NON"] = '0'
#FAK设置
defineDict["DFITC_SP_FAK"] = '1'
#FOK设置
defineDict["DFITC_SP_FOK"] = '2'
#市价任意价
defineDict["DFITC_SP_ANYPRICE"] = '3'
#市价任意价转限价
defineDict["DFITC_SP_ANYPRICE_TO_MKORDER"] = '4'
#五档市价
defineDict["DFITC_SP_FIVELEVELPRICE"] = '5'
#五档市价转限价
defineDict["DFITC_SP_FIVELEVELPRICE_TO_LIMIT"] = '6'
#最优价
defineDict["DFITC_SP_BESTPRICE"] = '7'
#最优价转限价
defineDict["DFITC_SP_BESTPRICE_TO_LIMIT"] = '8'
#/////////////////////////////////////////////////////////
#DFITCInsertType:委托类别
#/////////////////////////////////////////////////////////
typedefDict["DFITCInsertType"] = "int"
#普通委托单
defineDict["DFITC_BASIC_ORDER"] = 0x0001
#自动单
defineDict["DFITC_AUTO_ORDER"] = 0x0002
#/////////////////////////////////////////////////////////
#DFITCOptionTypeType:期权类别数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCOptionTypeType"] = "int"
#看涨
defineDict["DFITC_OPT_CALL"] = 1
#看跌
defineDict["DFITC_OPT_PUT"] = 2
#/////////////////////////////////////////////////////////
#DFITCInstrumentTypeType:合约类型数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCInstrumentTypeType"] = "int"
#期货
defineDict["DFITC_COMM_TYPE"] = 0
#期权
defineDict["DFITC_OPT_TYPE"] = 1
#/////////////////////////////////////////////////////////
#DFITCCancelTypeType:撤销标志数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCCancelTypeType"] = "char"
#订单
defineDict["DFITC_ORDER_BOOK"] = 'O'
#撤销
defineDict["DFITC_ORDER_CANCEL"] = 'W'
#/////////////////////////////////////////////////////////
#DFITCContentType:消息正文数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCContentType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCInstrumentStatusType:合约交易状态数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCInstrumentStatusType"] = "int"
#/////////////////////////////////////////////////////////
#DFITCInstStatusEnterReasonType:进入本状态原因数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCInstStatusEnterReasonType"] = "short"
#/////////////////////////////////////////////////////////
#DFITCCurrencyType:币种数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCCurrencyType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCConfirmType:确认标志数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCConfirmMarkType"] = "int"
#确认
defineDict["DFITC_CON_CONFIRM"] = 2
#/////////////////////////////////////////////////////////
#DFITCStanAddrType:备用地址数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCStanAddrType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCCapControlModeType:资金控制方式数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCCapControlModeType"] = "long"
#盯市盈亏可用
defineDict["DFITC_PPL_USABLE"] = 2
#平仓资金T+1可用
defineDict[""] = 4
#平仓保证金可取
defineDict[""] = 8
#本日盈亏可取
defineDict[""] = 16
#取后权益大于本日总入金
defineDict[""] = 32
#平仓盈亏可取
defineDict[""] = 128
#权利金收入可取
defineDict[""] = 256
#/////////////////////////////////////////////////////////
#DFITCArchRatioType:转存比例数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCArchRatioType"] = "float"
#/////////////////////////////////////////////////////////
#DFITCSettlementBillTradeType:汇总标志数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCSettlementBillTradeType"] = "int"
#汇总成交明细
defineDict["DFITC_MATCHDETAIL"] = 2
#汇总持仓盈亏
defineDict["DFITC_OPGAL"] = 4
#汇总平仓盈亏
defineDict["DFITC_OFGAL"] = 8
#/////////////////////////////////////////////////////////
#DFITCFilesFlagType:档案类型数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCFilesFlagType"] = "int"
#成交明细打印
defineDict["DFITC_PRINT_MATCHDETAIL"] = 4
#持仓盈亏打印
defineDict["DFITC_PRINT_OPGAL"] = 8
#平仓盈亏打印
defineDict["DFITC_PRINT_OFGAL"] = 16
#资金出入打印
defineDict["DFITC_PRINT_ACCESSFUNDS"] = 32
#追保声明打印
defineDict["DFITC_PRINT_ADDMARGIN"] = 64
#/////////////////////////////////////////////////////////
#DFITCSoftwareVendorIDType:软件供应商编号数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCSoftwareVendorIDType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCProductOnlineCountType:产品在线数量数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCProductOnlineCountType"] = "long"
#/////////////////////////////////////////////////////////
#DFITCBrokerInfoType:期货公司名称数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCBrokerInfoType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCProductIDType:产品编号数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCProductIDType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCRequestIDType:请求ID数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCRequestIDType"] = "long"
#/////////////////////////////////////////////////////////
#DFITCCustomCategoryType:自定义类别数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCCustomCategoryType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCReservedType:预留字段数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCReservedType"] = "int"
#/////////////////////////////////////////////////////////
#DFITCNoticeType:消息数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCNoticeType"] = "short"
#系统广播
defineDict["DFITC_SYS_BROADCAST_MSG"] = 1
#指定客户
defineDict["DFITC_ACCOUNT_ID_MSG"] = 2
#/////////////////////////////////////////////////////////
#DFITCTradingSegmentSNType:交易阶段编号数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCTradingSegmentSNType"] = "int"
#///////////////////////////////////////////
#DFITCExtOrderType:算法单类型数据类型
#///////////////////////////////////////////
typedefDict["DFITCExtOrderType"] = "int"
#预埋单
defineDict["DFITC_YMORDER"] = 1
#条件单
defineDict["DFITC_TJORDER"] = 2
#跨期套利订单
defineDict["DFITC_KQTLDD"] = 3
#跨品种套利订单
defineDict["DFITC_KPZTLDD"] = 4
#蝶式套利订单
defineDict["DFITC_DSTLDD"] = 5
#自定义套利订单(暂不支持)
defineDict["DFITC_ZDYTLDD"] = 6
#///////////////////////////////////////////
#DFITCTriggerTime:触发时间数据类型
#///////////////////////////////////////////
typedefDict["DFITCTriggerTime"] = "string"
#///////////////////////////////////////////
#DFITCPriceReference:价格参照数据类型
#///////////////////////////////////////////
typedefDict["DFITCPriceReference"] = "int"
#参照最新价
defineDict["DFITC_REF_LASTPRICE"] = 0
#参照买一价
defineDict["DFITC_REF_BIDPRICE"] = 1
#参照卖出价
defineDict["DFITC_REF_ASKPRICE"] = 2
#///////////////////////////////////////////
#DFITCCompareFlag:比较标志数据类型
#///////////////////////////////////////////
typedefDict["DFITCCompareFlag"] = "int"
#大于
defineDict["DFITC_CF_GREATER"] = 0
#大于等于
defineDict["DFITC_CF_NOTLESS"] = 1
#小于
defineDict["DFITC_CF_LESS"] = 2
#小于等于
defineDict["DFITC_CF_NOTGREATER"] = 3
#///////////////////////////////////////////
#DFITCOvernightFlag:隔夜标志数据类型
#///////////////////////////////////////////
typedefDict["DFITCOvernightFlag"] = "int"
#隔夜
defineDict["DFITC_OVERNIGHT"] = 1
#不隔夜
defineDict["DFITC_NOT_OVERNIGHT"] = 2
#///////////////////////////////////////////
#DFITCArbitragePrice:套利价格数据类型
#///////////////////////////////////////////
typedefDict["DFITCArbitragePrice"] = "float"
#///////////////////////////////////////////
#DFITCExtTriggerCond:触发条件数据类型
#///////////////////////////////////////////
typedefDict["DFITCExtTriggerCond"] = "int"
#价格触发
defineDict["DFITC_TRIGGER_PRICE"] = 0
#时间触发
defineDict["DFITC_TRIGGER_TIME"] = 1
#/////////////////////////////////////////////////////////
#DFITCInstrumentMaturityType:合约最后交易日
#/////////////////////////////////////////////////////////
typedefDict["DFITCInstrumentMaturityType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCInstrumenExpirationDateType:合约到期日
#/////////////////////////////////////////////////////////
typedefDict["DFITCInstrumenExpirationDateType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCAdjustmentInfoType:组合或对锁的保证金调整信息
#格式:[合约代码,买卖标志,投资类别,调整金额;]
#/////////////////////////////////////////////////////////
typedefDict["DFITCAdjustmentInfoType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCQuoteIDType:询价编号
#/////////////////////////////////////////////////////////
typedefDict["DFITCQuoteIDType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCSourceType:来源
#/////////////////////////////////////////////////////////
typedefDict["DFITCSourceType"] = "short"
#会员
defineDict["DFITC_SOURCE_MEMBER"] = 0
#交易所
defineDict["DFITC_SOURCE_EXCHANGE"] = 1
#/////////////////////////////////////////////////////////
#DFITCSeatCodeType:席位代码
#/////////////////////////////////////////////////////////
typedefDict["DFITCSeatCodeType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCCloseIDType:平仓执行单号
#/////////////////////////////////////////////////////////
typedefDict["DFITCCloseIDType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCEntrusTellerType:委托柜员
#/////////////////////////////////////////////////////////
typedefDict["DFITCEntrusTellerType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCStayTimeType停留时间数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCStayTimeType"] = "int"
#/////////////////////////////////////////////////////////
#DFITCComputeModeType计算方式数据类型
#/////////////////////////////////////////////////////////
typedefDict["DFITCComputeModeType"] = "int"
#绝对数值计算
defineDict["DFITC_ABSOLUTE_VALUE_COMPUTE"] = 0
#交易所保证金标准基础上浮动
defineDict["DFITC_EXCHANGE_MARGIN_BASIS_FLOAT"] = 1
#交易所保证金结果基础上浮动
defineDict["DFITC_EXCHANGE_MARGIN_RESULT_FLOAT"] = 2
#期货保证金标准基础上浮动
defineDict["DFITC_FUTURES_MARGIN_BASIS_FLOAT"] = 3
#//////////////////////////////////////////////////////////////////////
#DFITCPriceNoteType:期权保证金计算方式
#//////////////////////////////////////////////////////////////////////
typedefDict["DFITCPriceNoteType"] = "int"
#按照昨结算价计算
defineDict["DFITC_CALC_BY_PRESETTLEMENT"] = 1
#按照最新价计算
defineDict["DFITC_CALC_BY_LASTPRICE"] = 2
#//////////////////////////////////////////////////////////////////////
#DFITCLargeMarginDirectType:大边保证金方向数据类型
#//////////////////////////////////////////////////////////////////////
typedefDict["DFITCLargeMarginDirectType"] = "string"
#//////////////////////////////////////////////////////////////////////
#DFITCBankIDType:银行代码类型
#//////////////////////////////////////////////////////////////////////
typedefDict["DFITCBankIDType"] = "string"
#//////////////////////////////////////////////////////////////////////
#DFITCBankNameType:银行名称类型
#//////////////////////////////////////////////////////////////////////
typedefDict["DFITCBankNameType"] = "string"
#//////////////////////////////////////////////////////////////////////
#DFITCBankSerialType:银行流水号类型
#//////////////////////////////////////////////////////////////////////
typedefDict["DFITCBankSerialType"] = "string"
#//////////////////////////////////////////////////////////////////////
#DFITCSerialType:流水号类型
#//////////////////////////////////////////////////////////////////////
typedefDict["DFITCSerialType"] = "int"
#//////////////////////////////////////////////////////////////////////
#DFITCBankAccountType:银行账户类型
#//////////////////////////////////////////////////////////////////////
typedefDict["DFITCBankAccountType"] = "string"
#//////////////////////////////////////////////////////////////////////
#DFITCFutureSerialType:期货公司流水号类型
#//////////////////////////////////////////////////////////////////////
typedefDict["DFITCFutureSerialType"] = "int"
#//////////////////////////////////////////////////////////////////////
#DFITCDigestType:摘要类型
#//////////////////////////////////////////////////////////////////////
typedefDict["DFITCDigestType"] = "string"
#//////////////////////////////////////////////////////////////////////
#DFITCBankAccTypeType是一个银行帐号类型类型
#//////////////////////////////////////////////////////////////////////
#银行存折
defineDict["DFITC_BAT_BankBook"] = '1'
#储蓄卡
defineDict["DFITC_BAT_SavingCard"] = '2'
#信用卡
defineDict["DFITC_BAT_CreditCard"] = '3'
typedefDict["DFITCBankAccTypeType"] = "char"
#//////////////////////////////////////////////////////////////////////
#DFITCTransferStatusType:转账交易状态类型
#//////////////////////////////////////////////////////////////////////
#正常
defineDict["DFITC_TRFS_Normal"] = '0'
#被冲正
defineDict["DFITC_TRFS_Repealed"] = '1'
typedefDict["DFITCTransferStatusType"] = "char"
#//////////////////////////////////////////////////////////////////////
#DFITCTransferType:银期转账业务类型
#//////////////////////////////////////////////////////////////////////
typedefDict["DFITCTransferType"] = "int"
#//////////////////////////////////////////////////////////////////////
#DFITCTransferType:银期转账处理结果类型
#//////////////////////////////////////////////////////////////////////
typedefDict["DFITCProcResultType"] = "int"
#成功
defineDict["DFITC_PROC_SUCCESS"] = 0
#失败
defineDict["DFITC_PROC_FAIL"] = 1
#等待回执
defineDict["DFITC_PROC_WAIT_RTN"] = 2
#//////////////////////////////////////////////////////////////////////
#DFITCApplyNumberType:银期转账申请号类型
#//////////////////////////////////////////////////////////////////////
typedefDict["DFITCApplyNumberType"] = "int"
#//////////////////////////////////////////////////////////////////////
#DFITCImpliedVolatilityType:隐含波动率类型
#//////////////////////////////////////////////////////////////////////
typedefDict["DFITCImpliedVolatilityType"] = "float"
#//////////////////////////////////////////////////////////////////////
#DFITCOptionComputationType:期权计算数据类型
#//////////////////////////////////////////////////////////////////////
typedefDict["DFITCOptionComputationType"] = "float"
#/////////////////////////////////////////////////////////
#DFITCFunctionIDType:行情扩展功能号
#/////////////////////////////////////////////////////////
typedefDict["DFITCFunctionIDType"] = "string"
#/////////////////////////////////////////////////////////
#DFITCExtMarketDataType:行情扩展功能号
#/////////////////////////////////////////////////////////
typedefDict["DFITCExtMarketDataType"] = "string"
#//////////////////////////////////////////////////////////////////////
#DFITCExchangeStatusType:交易所状态数据类型
#//////////////////////////////////////////////////////////////////////
typedefDict["DFITCExchangeStatusType"] = "int"
#开盘前
defineDict["DFITC_IS_BEFORETRADING"] = 0
#非交易
defineDict["DFITC_IS_NOTRADING"] = 1
#连续交易
defineDict["DFITC_IS_CONTINOUS"] = 2
#集合竞价报单
defineDict["DFITC_IS_AUCTIONORDERING"] = 3
#集合竞价价格平衡
defineDict["DFITC_IS_AUCTIONBALANCE"] = 4
#集合竞价撮合
defineDict["DFITC_IS_AUCTIONMATCH"] = 5
#收盘
defineDict["DFITC_IS_CLOSED"] = 6
#//////////////////////////////////////////////////////////////////////
#DFITCPositionDateType:持仓日期类型
#//////////////////////////////////////////////////////////////////////
typedefDict["DFITCPositionDateType"] = "int"
defineDict["DFITC_PSD_TODAY"] = 1
defineDict["DFITC_PSD_HISTORY"] = 2

File diff suppressed because it is too large Load Diff

View File

@ -72,6 +72,9 @@ def createWrap(cbName):
if 'OnRspError' in cbName:
on_line = 'virtual void on' + cbName[2:] + '(dict error)\n'
override_line = '("on' + cbName[2:] + '")(error);\n'
elif 'OnRspQry' in cbName:
on_line = 'virtual void on' + cbName[2:] + '(dict data, dict error, bool last)\n'
override_line = '("on' + cbName[2:] + '")(data, error, last);\n'
elif 'OnRsp' in cbName:
on_line = 'virtual void on' + cbName[2:] + '(dict data, dict error)\n'
override_line = '("on' + cbName[2:] + '")(data, error);\n'
@ -259,7 +262,8 @@ def createFunction(fcName, fcArgsTypeList, fcArgsValueList):
line = '\tgetLong(req, "' + key + '", &myreq.' + key + ');\n'
elif value == 'short':
line = '\tgetShort(req, "' + key + '", &myreq.' + key + ');\n'
elif value == 'double':
elif value == 'float':
print line
line = '\tgetDouble(req, "' + key + '", &myreq.' + key + ');\n'
ffunction.write(line)
@ -305,4 +309,6 @@ fdefine.close()
fheaderprocess.close()
fheaderon.close()
fheaderfunction.close()
fwrap.close()
fwrap.close()
input()

Binary file not shown.

View File

@ -28,7 +28,7 @@ int TdApi::reqInsertOrder(dict req)
getString(req, "instrumentID", myreq.instrumentID);
getInt(req, "openCloseType", &myreq.openCloseType);
getLong(req, "localOrderID", &myreq.localOrderID);
getLong(req, "localOrderID", &myreq.localOrderID);
getDouble(req, "insertPrice", &myreq.insertPrice);
getChar(req, "orderProperty", myreq.orderProperty);
getShort(req, "buySellType", &myreq.buySellType);
getInt(req, "orderType", &myreq.orderType);
@ -38,7 +38,7 @@ int TdApi::reqInsertOrder(dict req)
getInt(req, "reservedType2", &myreq.reservedType2);
getInt(req, "insertType", &myreq.insertType);
getLong(req, "orderAmount", &myreq.orderAmount);
getLong(req, "orderAmount", &myreq.orderAmount);
getDouble(req, "profitLossPrice", &myreq.profitLossPrice);
getString(req, "customCategory", myreq.customCategory);
getInt(req, "instrumentType", &myreq.instrumentType);
getString(req, "accountID", myreq.accountID);
@ -247,7 +247,7 @@ int TdApi::reqQuoteInsert(dict req)
getString(req, "quoteID", myreq.quoteID);
getInt(req, "sOpenCloseType", &myreq.sOpenCloseType);
getLong(req, "bOrderAmount", &myreq.bOrderAmount);
getLong(req, "bOrderAmount", &myreq.bOrderAmount);
getDouble(req, "sInsertPrice", &myreq.sInsertPrice);
getLong(req, "lRequestID", &myreq.lRequestID);
getInt(req, "insertType", &myreq.insertType);
getLong(req, "sOrderAmount", &myreq.sOrderAmount);
@ -255,7 +255,7 @@ int TdApi::reqQuoteInsert(dict req)
getLong(req, "localOrderID", &myreq.localOrderID);
getInt(req, "bSpeculator", &myreq.bSpeculator);
getString(req, "customCategory", myreq.customCategory);
getString(req, "customCategory", myreq.customCategory);
getDouble(req, "bInsertPrice", &myreq.bInsertPrice);
getInt(req, "instrumentType", &myreq.instrumentType);
getString(req, "accountID", myreq.accountID);
int i = this->api->ReqQuoteInsert(&myreq);
@ -357,7 +357,7 @@ int TdApi::reqFromBankToFutureByFuture(dict req)
getLong(req, "lRequestID", &myreq.lRequestID);
getString(req, "bankID", myreq.bankID);
getString(req, "password", myreq.password);
getString(req, "password", myreq.password);
getDouble(req, "tradeAmount", &myreq.tradeAmount);
getString(req, "accountID", myreq.accountID);
int i = this->api->ReqFromBankToFutureByFuture(&myreq);
return i;
@ -373,7 +373,7 @@ int TdApi::reqFromFutureToBankByFuture(dict req)
getLong(req, "lRequestID", &myreq.lRequestID);
getString(req, "bankID", myreq.bankID);
getString(req, "password", myreq.password);
getString(req, "password", myreq.password);
getDouble(req, "tradeAmount", &myreq.tradeAmount);
getString(req, "accountID", myreq.accountID);
int i = this->api->ReqFromFutureToBankByFuture(&myreq);
return i;

View File

@ -94,11 +94,11 @@ virtual void onRtnCancelOrder(dict data)
}
};
virtual void onRspQryOrderInfo(dict data, dict error)
virtual void onRspQryOrderInfo(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryOrderInfo")(data, error);
this->get_override("onRspQryOrderInfo")(data, error, last);
}
catch (error_already_set const &)
{
@ -106,11 +106,11 @@ virtual void onRspQryOrderInfo(dict data, dict error)
}
};
virtual void onRspQryMatchInfo(dict data, dict error)
virtual void onRspQryMatchInfo(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryMatchInfo")(data, error);
this->get_override("onRspQryMatchInfo")(data, error, last);
}
catch (error_already_set const &)
{
@ -118,11 +118,11 @@ virtual void onRspQryMatchInfo(dict data, dict error)
}
};
virtual void onRspQryPosition(dict data, dict error)
virtual void onRspQryPosition(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryPosition")(data, error);
this->get_override("onRspQryPosition")(data, error, last);
}
catch (error_already_set const &)
{
@ -142,11 +142,11 @@ virtual void onRspCustomerCapital(dict data, dict error)
}
};
virtual void onRspQryExchangeInstrument(dict data, dict error)
virtual void onRspQryExchangeInstrument(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryExchangeInstrument")(data, error);
this->get_override("onRspQryExchangeInstrument")(data, error, last);
}
catch (error_already_set const &)
{
@ -166,11 +166,11 @@ virtual void onRspArbitrageInstrument(dict data, dict error)
}
};
virtual void onRspQrySpecifyInstrument(dict data, dict error)
virtual void onRspQrySpecifyInstrument(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQrySpecifyInstrument")(data, error);
this->get_override("onRspQrySpecifyInstrument")(data, error, last);
}
catch (error_already_set const &)
{
@ -178,11 +178,11 @@ virtual void onRspQrySpecifyInstrument(dict data, dict error)
}
};
virtual void onRspQryPositionDetail(dict data, dict error)
virtual void onRspQryPositionDetail(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryPositionDetail")(data, error);
this->get_override("onRspQryPositionDetail")(data, error, last);
}
catch (error_already_set const &)
{
@ -214,11 +214,11 @@ virtual void onRspResetPassword(dict data, dict error)
}
};
virtual void onRspQryTradeCode(dict data, dict error)
virtual void onRspQryTradeCode(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryTradeCode")(data, error);
this->get_override("onRspQryTradeCode")(data, error, last);
}
catch (error_already_set const &)
{
@ -250,11 +250,11 @@ virtual void onRspEquityComputMode(dict data, dict error)
}
};
virtual void onRspQryBill(dict data, dict error)
virtual void onRspQryBill(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryBill")(data, error);
this->get_override("onRspQryBill")(data, error, last);
}
catch (error_already_set const &)
{
@ -358,11 +358,11 @@ virtual void onRspCancelAllOrder(dict data, dict error)
}
};
virtual void onRspQryQuoteNotice(dict data, dict error)
virtual void onRspQryQuoteNotice(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryQuoteNotice")(data, error);
this->get_override("onRspQryQuoteNotice")(data, error, last);
}
catch (error_already_set const &)
{
@ -394,11 +394,11 @@ virtual void onRtnForQuote(dict data)
}
};
virtual void onRspQryQuoteOrderInfo(dict data, dict error)
virtual void onRspQryQuoteOrderInfo(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryQuoteOrderInfo")(data, error);
this->get_override("onRspQryQuoteOrderInfo")(data, error, last);
}
catch (error_already_set const &)
{
@ -406,11 +406,11 @@ virtual void onRspQryQuoteOrderInfo(dict data, dict error)
}
};
virtual void onRspQryForQuote(dict data, dict error)
virtual void onRspQryForQuote(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryForQuote")(data, error);
this->get_override("onRspQryForQuote")(data, error, last);
}
catch (error_already_set const &)
{
@ -418,11 +418,11 @@ virtual void onRspQryForQuote(dict data, dict error)
}
};
virtual void onRspQryTransferBank(dict data, dict error)
virtual void onRspQryTransferBank(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryTransferBank")(data, error);
this->get_override("onRspQryTransferBank")(data, error, last);
}
catch (error_already_set const &)
{
@ -430,11 +430,11 @@ virtual void onRspQryTransferBank(dict data, dict error)
}
};
virtual void onRspQryTransferSerial(dict data, dict error)
virtual void onRspQryTransferSerial(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryTransferSerial")(data, error);
this->get_override("onRspQryTransferSerial")(data, error, last);
}
catch (error_already_set const &)
{
@ -502,11 +502,11 @@ virtual void onRtnRepealFromFutureToBankByBank(dict data)
}
};
virtual void onRspQryExchangeStatus(dict data, dict error)
virtual void onRspQryExchangeStatus(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryExchangeStatus")(data, error);
this->get_override("onRspQryExchangeStatus")(data, error, last);
}
catch (error_already_set const &)
{
@ -526,11 +526,11 @@ virtual void onRtnExchangeStatus(dict data)
}
};
virtual void onRspQryDepthMarketData(dict data, dict error)
virtual void onRspQryDepthMarketData(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryDepthMarketData")(data, error);
this->get_override("onRspQryDepthMarketData")(data, error, last);
}
catch (error_already_set const &)
{

Binary file not shown.

View File

@ -0,0 +1,5 @@
<?xml version="1.0"?>
<SubscriptionDataContainer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:Microsoft.VisualStudio.WindowsAzure.CommonAzureTools.Authentication.CacheManagement">
<Items />
<TokenCache>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAhE4p+D02F0WYPy8qCmMXxAAAAAACAAAAAAAQZgAAAAEAACAAAADdKqCExbfQ0qmV8fAhwxJ3ziOWd8i4kgHKWaahbmhZpwAAAAAOgAAAAAIAACAAAACIs6nje6UjzBQhCRlDYPyT/WvjZ7HWe6fwrCRtdSUF6hAAAABX62nkc+hjHXTxtgPsdkBcQAAAAOlZDGXW8lDNFQGhZ5pLW0aGiuUFyFCyt4EoRQh92KTtiXhOeaxEBfA6MbkxnzyJ4B/ZmwskriS/m0CTVTZFRUY=</TokenCache>
</SubscriptionDataContainer>

View File

@ -2978,7 +2978,7 @@ int TdApi::reqInsertOrder(dict req)
getString(req, "instrumentID", myreq.instrumentID);
getInt(req, "openCloseType", &myreq.openCloseType);
getLong(req, "localOrderID", &myreq.localOrderID);
getLong(req, "localOrderID", &myreq.localOrderID);
getDouble(req, "insertPrice", &myreq.insertPrice);
getChar(req, "orderProperty", &myreq.orderProperty);
getShort(req, "buySellType", &myreq.buySellType);
getInt(req, "orderType", &myreq.orderType);
@ -2988,7 +2988,7 @@ int TdApi::reqInsertOrder(dict req)
getInt(req, "reservedType2", &myreq.reservedType2);
getInt(req, "insertType", &myreq.insertType);
getLong(req, "orderAmount", &myreq.orderAmount);
getLong(req, "orderAmount", &myreq.orderAmount);
getDouble(req, "profitLossPrice", &myreq.profitLossPrice);
getString(req, "customCategory", myreq.customCategory);
getInt(req, "instrumentType", &myreq.instrumentType);
getString(req, "accountID", myreq.accountID);
@ -3197,7 +3197,7 @@ int TdApi::reqQuoteInsert(dict req)
getString(req, "quoteID", myreq.quoteID);
getInt(req, "sOpenCloseType", &myreq.sOpenCloseType);
getLong(req, "bOrderAmount", &myreq.bOrderAmount);
getLong(req, "bOrderAmount", &myreq.bOrderAmount);
getDouble(req, "sInsertPrice", &myreq.sInsertPrice);
getLong(req, "lRequestID", &myreq.lRequestID);
getInt(req, "insertType", &myreq.insertType);
getLong(req, "sOrderAmount", &myreq.sOrderAmount);
@ -3205,7 +3205,7 @@ int TdApi::reqQuoteInsert(dict req)
getLong(req, "localOrderID", &myreq.localOrderID);
getInt(req, "bSpeculator", &myreq.bSpeculator);
getString(req, "customCategory", myreq.customCategory);
getString(req, "customCategory", myreq.customCategory);
getDouble(req, "bInsertPrice", &myreq.bInsertPrice);
getInt(req, "instrumentType", &myreq.instrumentType);
getString(req, "accountID", myreq.accountID);
int i = this->api->ReqQuoteInsert(&myreq);
@ -3307,7 +3307,7 @@ int TdApi::reqFromBankToFutureByFuture(dict req)
getLong(req, "lRequestID", &myreq.lRequestID);
getString(req, "bankID", myreq.bankID);
getString(req, "password", myreq.password);
getString(req, "password", myreq.password);
getDouble(req, "tradeAmount", &myreq.tradeAmount);
getString(req, "accountID", myreq.accountID);
int i = this->api->ReqFromBankToFutureByFuture(&myreq);
return i;
@ -3323,7 +3323,7 @@ int TdApi::reqFromFutureToBankByFuture(dict req)
getLong(req, "lRequestID", &myreq.lRequestID);
getString(req, "bankID", myreq.bankID);
getString(req, "password", myreq.password);
getString(req, "password", myreq.password);
getDouble(req, "tradeAmount", &myreq.tradeAmount);
getString(req, "accountID", myreq.accountID);
int i = this->api->ReqFromFutureToBankByFuture(&myreq);
return i;
@ -3351,7 +3351,6 @@ int TdApi::reqQryDepthMarketData(dict req)
};
///-------------------------------------------------------------------------------------
///Boost.Python·â×°
///-------------------------------------------------------------------------------------
@ -3479,11 +3478,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi >
}
};
virtual void onRspQryOrderInfo(dict data, dict error)
virtual void onRspQryOrderInfo(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryOrderInfo")(data, error);
this->get_override("onRspQryOrderInfo")(data, error, last);
}
catch (error_already_set const &)
{
@ -3491,11 +3490,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi >
}
};
virtual void onRspQryMatchInfo(dict data, dict error)
virtual void onRspQryMatchInfo(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryMatchInfo")(data, error);
this->get_override("onRspQryMatchInfo")(data, error, last);
}
catch (error_already_set const &)
{
@ -3503,11 +3502,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi >
}
};
virtual void onRspQryPosition(dict data, dict error)
virtual void onRspQryPosition(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryPosition")(data, error);
this->get_override("onRspQryPosition")(data, error, last);
}
catch (error_already_set const &)
{
@ -3515,11 +3514,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi >
}
};
virtual void onRspCustomerCapital(dict data, dict error)
virtual void onRspCustomerCapital(dict data, dict error, bool last)
{
try
{
this->get_override("onRspCustomerCapital")(data, error);
this->get_override("onRspCustomerCapital")(data, error, last);
}
catch (error_already_set const &)
{
@ -3527,11 +3526,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi >
}
};
virtual void onRspQryExchangeInstrument(dict data, dict error)
virtual void onRspQryExchangeInstrument(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryExchangeInstrument")(data, error);
this->get_override("onRspQryExchangeInstrument")(data, error, last);
}
catch (error_already_set const &)
{
@ -3551,11 +3550,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi >
}
};
virtual void onRspQrySpecifyInstrument(dict data, dict error)
virtual void onRspQrySpecifyInstrument(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQrySpecifyInstrument")(data, error);
this->get_override("onRspQrySpecifyInstrument")(data, error, last);
}
catch (error_already_set const &)
{
@ -3563,11 +3562,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi >
}
};
virtual void onRspQryPositionDetail(dict data, dict error)
virtual void onRspQryPositionDetail(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryPositionDetail")(data, error);
this->get_override("onRspQryPositionDetail")(data, error, last);
}
catch (error_already_set const &)
{
@ -3599,11 +3598,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi >
}
};
virtual void onRspQryTradeCode(dict data, dict error)
virtual void onRspQryTradeCode(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryTradeCode")(data, error);
this->get_override("onRspQryTradeCode")(data, error, last);
}
catch (error_already_set const &)
{
@ -3635,11 +3634,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi >
}
};
virtual void onRspQryBill(dict data, dict error)
virtual void onRspQryBill(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryBill")(data, error);
this->get_override("onRspQryBill")(data, error, last);
}
catch (error_already_set const &)
{
@ -3743,11 +3742,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi >
}
};
virtual void onRspQryQuoteNotice(dict data, dict error)
virtual void onRspQryQuoteNotice(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryQuoteNotice")(data, error);
this->get_override("onRspQryQuoteNotice")(data, error, last);
}
catch (error_already_set const &)
{
@ -3779,11 +3778,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi >
}
};
virtual void onRspQryQuoteOrderInfo(dict data, dict error)
virtual void onRspQryQuoteOrderInfo(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryQuoteOrderInfo")(data, error);
this->get_override("onRspQryQuoteOrderInfo")(data, error, last);
}
catch (error_already_set const &)
{
@ -3791,11 +3790,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi >
}
};
virtual void onRspQryForQuote(dict data, dict error)
virtual void onRspQryForQuote(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryForQuote")(data, error);
this->get_override("onRspQryForQuote")(data, error, last);
}
catch (error_already_set const &)
{
@ -3803,11 +3802,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi >
}
};
virtual void onRspQryTransferBank(dict data, dict error)
virtual void onRspQryTransferBank(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryTransferBank")(data, error);
this->get_override("onRspQryTransferBank")(data, error, last);
}
catch (error_already_set const &)
{
@ -3815,11 +3814,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi >
}
};
virtual void onRspQryTransferSerial(dict data, dict error)
virtual void onRspQryTransferSerial(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryTransferSerial")(data, error);
this->get_override("onRspQryTransferSerial")(data, error, last);
}
catch (error_already_set const &)
{
@ -3887,11 +3886,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi >
}
};
virtual void onRspQryExchangeStatus(dict data, dict error)
virtual void onRspQryExchangeStatus(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryExchangeStatus")(data, error);
this->get_override("onRspQryExchangeStatus")(data, error, last);
}
catch (error_already_set const &)
{
@ -3911,11 +3910,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi >
}
};
virtual void onRspQryDepthMarketData(dict data, dict error)
virtual void onRspQryDepthMarketData(dict data, dict error, bool last)
{
try
{
this->get_override("onRspQryDepthMarketData")(data, error);
this->get_override("onRspQryDepthMarketData")(data, error, last);
}
catch (error_already_set const &)
{