Пример #1
0
 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));
     }
 }
Пример #2
0
 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);
     }
 }
Пример #3
0
 public void FireOnRspReqQryInvestorPosition(CThostFtdcInvestorPositionField pInvestorPosition)
 {
     if (null != OnRspReqQryInvestorPosition)
     {
         OnRspReqQryInvestorPosition(pInvestorPosition);
     }
 }
Пример #4
0
 void OnRspReqQryInvestorPosition(CThostFtdcInvestorPositionField pInvestorPosition)
 {
     Console.WriteLine("==持仓");
     Console.WriteLine(pInvestorPosition.InstrumentID);
 }
Пример #5
0
 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;
 }
Пример #6
0
        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);
            }
        }
Пример #7
0
 private string GetPositionKey(CThostFtdcInvestorPositionField p)
 {
     return GetPositionKey(p.InstrumentID, p.PosiDirection, p.HedgeFlag, p.PositionDate);
 }