Skip to content

Commit

Permalink
修复:查询可交易合约的bug
Browse files Browse the repository at this point in the history
Signed-off-by: haifengat <hubert28@qq.com>
  • Loading branch information
hubertwu1976 committed Jan 19, 2021
1 parent 0c900b1 commit 74a06fe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cs_ctp/proxy/CTPTrade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private void CTPOnRspSettlementInfoConfirm(ref CThostFtdcSettlementInfoConfirmFi
if (this.Broker == "9999")
_t.ReqQryInstrument();
else
_t.ReqQryClassifiedInstrument();
_t.ReqQryClassifiedInstrument(TradingType: TThostFtdcTradingTypeType.THOST_FTDC_TD_TRADE, ClassType: TThostFtdcClassTypeType.THOST_FTDC_INS_ALL);
}

private void CTPOnRtnInstrumentStatus(ref CThostFtdcInstrumentStatusField pInstrumentStatus)
Expand Down
12 changes: 6 additions & 6 deletions py_ctp/ctp_trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -1560,12 +1560,12 @@ def ReqQueryBankAccountMoneyByFuture(self, TradeCode: str = '', BankID: str = ''

def ReqQryClassifiedInstrument(self, InstrumentID: str = '', ExchangeID: str = '', ExchangeInstID: str = '', ProductID: str = '', TradingType: TThostFtdcTradingTypeType = list(TThostFtdcTradingTypeType)[0], ClassType: TThostFtdcClassTypeType = list(TThostFtdcClassTypeType)[0]):
pQryClassifiedInstrument = CThostFtdcQryClassifiedInstrumentField()
# pQryClassifiedInstrument.InstrumentID = bytes(InstrumentID, encoding='ascii')
# pQryClassifiedInstrument.ExchangeID = bytes(ExchangeID, encoding='ascii')
# pQryClassifiedInstrument.ExchangeInstID = bytes(ExchangeInstID, encoding='ascii')
# pQryClassifiedInstrument.ProductID = bytes(ProductID, encoding='ascii')
# pQryClassifiedInstrument.TradingType = TradingType.value
# pQryClassifiedInstrument.ClassType = ClassType.value
pQryClassifiedInstrument.InstrumentID = bytes(InstrumentID, encoding='ascii')
pQryClassifiedInstrument.ExchangeID = bytes(ExchangeID, encoding='ascii')
pQryClassifiedInstrument.ExchangeInstID = bytes(ExchangeInstID, encoding='ascii')
pQryClassifiedInstrument.ProductID = bytes(ProductID, encoding='ascii')
pQryClassifiedInstrument.TradingType = TradingType.value
pQryClassifiedInstrument.ClassType = ClassType.value
self.nRequestID += 1
self.h.ReqQryClassifiedInstrument(self.api, byref(pQryClassifiedInstrument), self.nRequestID)

Expand Down
6 changes: 3 additions & 3 deletions py_ctp/trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .structs import InfoField, InstrumentField, OrderField, OrderStatus, PositionField, TradeField, TradingAccount, PositionDetail
from .ctp_trade import Trade
from .ctp_struct import CThostFtdcInputOrderActionField, CThostFtdcInputOrderField, CThostFtdcInstrumentField, CThostFtdcInstrumentStatusField, CThostFtdcInvestorPositionField, CThostFtdcOrderField, CThostFtdcRspInfoField, CThostFtdcRspUserLoginField, CThostFtdcSettlementInfoConfirmField, CThostFtdcTradingAccountField, CThostFtdcTradingNoticeInfoField, CThostFtdcQuoteField, CThostFtdcInputQuoteField, CThostFtdcInputForQuoteField, CThostFtdcInvestorPositionDetailField, CThostFtdcRspAuthenticateField
from .ctp_enum import TThostFtdcActionFlagType, TThostFtdcContingentConditionType, TThostFtdcDirectionType, TThostFtdcOffsetFlagType, TThostFtdcForceCloseReasonType, TThostFtdcHedgeFlagType, TThostFtdcOrderPriceTypeType, TThostFtdcPosiDirectionType, TThostFtdcTimeConditionType, TThostFtdcVolumeConditionType, TThostFtdcOrderStatusType, TThostFtdcInstrumentStatusType, TThostFtdcTradeTypeType, TThostFtdcAppTypeType
from .ctp_enum import TThostFtdcActionFlagType, TThostFtdcClassTypeType, TThostFtdcContingentConditionType, TThostFtdcDirectionType, TThostFtdcOffsetFlagType, TThostFtdcForceCloseReasonType, TThostFtdcHedgeFlagType, TThostFtdcOrderPriceTypeType, TThostFtdcPosiDirectionType, TThostFtdcTimeConditionType, TThostFtdcTradingTypeType, TThostFtdcVolumeConditionType, TThostFtdcOrderStatusType, TThostFtdcInstrumentStatusType, TThostFtdcTradeTypeType, TThostFtdcAppTypeType


class CtpTrade():
Expand Down Expand Up @@ -120,7 +120,7 @@ def _OnRspSettlementInfoConfirm(
self.t.ReqQryInstrument()
else:
print("qry classified instrument")
self.t.ReqQryClassifiedInstrument()
self.t.ReqQryClassifiedInstrument(TradingType=TThostFtdcTradingTypeType.THOST_FTDC_TD_TRADE, ClassType=TThostFtdcClassTypeType.THOST_FTDC_INS_ALL)

def _qry(self):
"""查询帐号相关信息"""
Expand Down Expand Up @@ -476,7 +476,7 @@ def ReqConnect(self, front: str):
self.t.OnRspOrderAction = self._OnRspOrderAction
self.t.OnRtnInstrumentStatus = self._OnRtnInstrumentStatus
self.t.OnRspQryInstrument = self._OnRspQryInstrument
self.t.OnRspClassifiedInstrument = self._OnRspQryClassifiedInstrument
self.t.OnRspQryClassifiedInstrument = self._OnRspQryClassifiedInstrument
self.t.OnRspQryTradingAccount = self._OnRspQryAccount
self.t.OnRspQryInvestorPosition = self._OnRspQryPosition
self.t.OnRspQryInvestorPositionDetail = self._OnRspQryPositionDetail
Expand Down

0 comments on commit 74a06fe

Please sign in to comment.