Merge pull request #1093 from nanoric/ctp_types_correction

[Fix] 某些时候往CTP接口下单,会产生报单字段有误的错误。
This commit is contained in:
vn.py 2018-09-06 13:38:29 +08:00 committed by GitHub
commit d5f09bdf33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1432,7 +1432,7 @@ class CtpTdApi(TdApi):
req['InstrumentID'] = orderReq.symbol req['InstrumentID'] = orderReq.symbol
req['LimitPrice'] = orderReq.price req['LimitPrice'] = orderReq.price
req['VolumeTotalOriginal'] = orderReq.volume req['VolumeTotalOriginal'] = int(orderReq.volume)
# 下面如果由于传入的类型本接口不支持,则会返回空字符串 # 下面如果由于传入的类型本接口不支持,则会返回空字符串
req['OrderPriceType'] = priceTypeMap.get(orderReq.priceType, '') req['OrderPriceType'] = priceTypeMap.get(orderReq.priceType, '')
@ -1460,7 +1460,7 @@ class CtpTdApi(TdApi):
if orderReq.priceType == PRICETYPE_FOK: if orderReq.priceType == PRICETYPE_FOK:
req['OrderPriceType'] = defineDict["THOST_FTDC_OPT_LimitPrice"] req['OrderPriceType'] = defineDict["THOST_FTDC_OPT_LimitPrice"]
req['TimeCondition'] = defineDict['THOST_FTDC_TC_IOC'] req['TimeCondition'] = defineDict['THOST_FTDC_TC_IOC']
req['VolumeCondition'] = defineDict['THOST_FTDC_VC_CV'] req['VolumeCondition'] = int(defineDict['THOST_FTDC_VC_CV'])
self.reqOrderInsert(req, self.reqID) self.reqOrderInsert(req, self.reqID)