private void OnRspQryInvestorPosition_callback(IntPtr pTraderApi, ref CThostFtdcInvestorPositionField pInvestorPosition, ref CThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast) { if (null != OnRspQryInvestorPosition) { OnRspQryInvestorPosition(this, new OnRspQryInvestorPositionArgs(pTraderApi, ref pInvestorPosition, ref pRspInfo, nRequestID, bIsLast)); } }
private void OnRspQryInvestorPosition(IntPtr pTraderApi, ref CThostFtdcInvestorPositionField pInvestorPosition, ref CThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast) { if (0 == pRspInfo.ErrorID) { _dbInMemInvestorPosition.InsertOrReplace( pInvestorPosition.InstrumentID, pInvestorPosition.PosiDirection, pInvestorPosition.HedgeFlag, pInvestorPosition.PositionDate, pInvestorPosition.Position); timerPonstion.Enabled = false; timerPonstion.Enabled = true; } else { tdlog.Error("nRequestID:{0},ErrorID:{1},OnRspQryInvestorPosition:{2}", nRequestID, pRspInfo.ErrorID, pRspInfo.ErrorMsg); EmitError(nRequestID, pRspInfo.ErrorID, "OnRspQryInvestorPosition:" + pRspInfo.ErrorMsg); } }
public void FireOnRspReqQryInvestorPosition(CThostFtdcInvestorPositionField pInvestorPosition) { if (null != OnRspReqQryInvestorPosition) { OnRspReqQryInvestorPosition(pInvestorPosition); } }
void OnRspReqQryInvestorPosition(CThostFtdcInvestorPositionField pInvestorPosition) { Console.WriteLine("==持仓"); Console.WriteLine(pInvestorPosition.InstrumentID); }
public OnRspQryInvestorPositionArgs(IntPtr pTraderApi, ref CThostFtdcInvestorPositionField pInvestorPosition, ref CThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast) { this.pTraderApi = pTraderApi; this.pInvestorPosition = pInvestorPosition; this.pRspInfo = pRspInfo; this.nRequestID = nRequestID; this.bIsLast = bIsLast; }
private void OnRspQryInvestorPosition(IntPtr pTraderApi, ref CThostFtdcInvestorPositionField pInvestorPosition, ref CThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast) { if (0 == pRspInfo.ErrorID) { string key = GetPositionKey(pInvestorPosition); _dictPositions[key] = pInvestorPosition; CTPAPI.GetInstance().FireOnRspReqQryInvestorPosition(pInvestorPosition); timerPonstion.Enabled = false; timerPonstion.Enabled = true; } else { tdlog.Error("nRequestID:{0},ErrorID:{1},OnRspQryInvestorPosition:{2}", nRequestID, pRspInfo.ErrorID, pRspInfo.ErrorMsg); EmitError(nRequestID, pRspInfo.ErrorID, "OnRspQryInvestorPosition:" + pRspInfo.ErrorMsg); } }
private string GetPositionKey(CThostFtdcInvestorPositionField p) { return GetPositionKey(p.InstrumentID, p.PosiDirection, p.HedgeFlag, p.PositionDate); }