[Mod] tap gateway only support futures for now

This commit is contained in:
vn.py 2019-10-12 12:22:43 +08:00
parent 34544bb2f3
commit 5185610838

View File

@ -449,32 +449,33 @@ class TradeApi(ITapTradeAPINotify):
if not info or not exchange or not commodity_info: if not info or not exchange or not commodity_info:
return return
symbol = info.CommodityNo + info.ContractNo1 if info.CommodityType == "F":
symbol = info.CommodityNo + info.ContractNo1
if commodity_info.name: if commodity_info.name:
name = f"{commodity_info.name} {info.ContractNo1}" name = f"{commodity_info.name} {info.ContractNo1}"
else: else:
name = symbol name = symbol
contract = ContractData( contract = ContractData(
symbol=symbol, symbol=symbol,
exchange=exchange, exchange=exchange,
name=name, name=name,
product=Product.FUTURES, product=Product.FUTURES,
size=commodity_info.size, size=commodity_info.size,
pricetick=commodity_info.pricetick, pricetick=commodity_info.pricetick,
gateway_name=self.gateway.gateway_name gateway_name=self.gateway.gateway_name
) )
self.gateway.on_contract(contract) self.gateway.on_contract(contract)
contract_info = ContractInfo( contract_info = ContractInfo(
name=contract.name, name=contract.name,
exchange_no=info.ExchangeNo, exchange_no=info.ExchangeNo,
contract_no=info.ContractNo1, contract_no=info.ContractNo1,
commodity_type=info.CommodityType, commodity_type=info.CommodityType,
commodity_no=info.CommodityNo, commodity_no=info.CommodityNo,
) )
contract_infos[(contract.symbol, contract.exchange)] = contract_info contract_infos[(contract.symbol, contract.exchange)] = contract_info
if isLast == "Y": if isLast == "Y":
self.gateway.write_log("查询交易合约信息成功") self.gateway.write_log("查询交易合约信息成功")