[Fix]修复CTP和飞创证券接口的期权相关bug

This commit is contained in:
vn.py 2017-10-25 11:11:56 +08:00
parent 440bd2812f
commit c700141aaa
2 changed files with 5 additions and 3 deletions

View File

@ -65,6 +65,8 @@ 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()}
productClassMapReverse[defineDict["THOST_FTDC_PC_ETFOption"]] = PRODUCT_OPTION
productClassMapReverse[defineDict["THOST_FTDC_PC_Stock"]] = PRODUCT_EQUITY
# 委托状态映射
statusMap = {}
@ -827,8 +829,8 @@ class CtpTdApi(TdApi):
contract.priceTick = data['PriceTick']
contract.strikePrice = data['StrikePrice']
contract.underlyingSymbol = data['UnderlyingInstrID']
contract.productClass = productClassMapReverse.get(data['ProductClass'], PRODUCT_UNKNOWN)
contract.expiryDate = data['ExpireDate']
# 期权类型
if contract.productClass is PRODUCT_OPTION:

View File

@ -398,7 +398,7 @@ class SecMdApi(MdApi):
tick.lastPrice = data['latestPrice']
tick.volume = data['tradeQty']
tick.time = data['updateTime']
tick.date = data['tradingDay']
tick.date = str(data['tradingDay'])
tick.openPrice = data['openPrice']
tick.highPrice = data['highestPrice']
@ -448,7 +448,7 @@ class SecMdApi(MdApi):
tick.volume = data['tradeQty']
tick.openInterest = data['positionQty']
tick.time = data['updateTime']
tick.date = data['tradingDay']
tick.date = str(data['tradingDay'])
tick.openPrice = data['openPrice']
tick.highPrice = data['highestPrice']