void SetInstrumentRate(CZQThostFtdcInstrumentCommissionRateField instrumentCommissionRate)
        {
            if (string.IsNullOrEmpty(instrumentCommissionRate.InstrumentID))
            {
                return;
            }


            //保存手续费信息
            CTPStockInstrument ctpInstrument = this.GetInstrument(instrumentCommissionRate.InstrumentID);

            if (ctpInstrument != null)
            {
                //单合约手续费
                ctpInstrument.SetNativeValue(instrumentCommissionRate);
            }
            else
            {
                //该品种手续费
                foreach (CTPStockInstrument item in this.instrumentDictionary.Values)
                {
                    if (string.Compare(instrumentCommissionRate.InstrumentID, item.ProductID, true) == 0)
                    {
                        item.SetNativeValue(instrumentCommissionRate);
                    }
                }
            }
        }
 public void FireOnRspQryInstrumentCommissionRate(CZQThostFtdcInstrumentCommissionRateField pInstrumentCommissionRate)
 {
     if (null != OnRspQryInstrumentCommissionRate)
     {
         OnRspQryInstrumentCommissionRate(pInstrumentCommissionRate);
     }
 }
 private void OnRspQryInstrumentCommissionRate_callback(IntPtr pTraderApi, ref CZQThostFtdcInstrumentCommissionRateField pInstrumentCommissionRate, ref CZQThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast)
 {
     if (null != OnRspQryInstrumentCommissionRate)
     {
         OnRspQryInstrumentCommissionRate(this, new OnRspQryInstrumentCommissionRateArgs(pTraderApi, ref pInstrumentCommissionRate, ref pRspInfo, nRequestID, bIsLast));
     }
 }
Exemple #4
0
 public OnRspQryInstrumentCommissionRateArgs(IntPtr pTraderApi, ref CZQThostFtdcInstrumentCommissionRateField pInstrumentCommissionRate, ref CZQThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast)
 {
     this.pTraderApi = pTraderApi;
     this.pInstrumentCommissionRate = pInstrumentCommissionRate;
     this.pRspInfo   = pRspInfo;
     this.nRequestID = nRequestID;
     this.bIsLast    = bIsLast;
 }
Exemple #5
0
        private void OnRspQryInstrumentCommissionRate(IntPtr pTraderApi, ref CZQThostFtdcInstrumentCommissionRateField pInstrumentCommissionRate, ref CZQThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast)
        {
            if (0 == pRspInfo.ErrorID)
            {
                _dictCommissionRate[pInstrumentCommissionRate.InstrumentID] = pInstrumentCommissionRate;
                tdlog.Info("已经接收手续费率 {0}", pInstrumentCommissionRate.InstrumentID);

                //通知单例
                CTPZQAPI.GetInstance().FireOnRspQryInstrumentCommissionRate(pInstrumentCommissionRate);
            }
            else
            {
                tdlog.Error("nRequestID:{0},ErrorID:{1},OnRspQryInstrumentCommissionRate:{2}", nRequestID, pRspInfo.ErrorID, pRspInfo.ErrorMsg);
                EmitError(nRequestID, pRspInfo.ErrorID, "OnRspQryInstrumentCommissionRate:" + pRspInfo.ErrorMsg);
            }
        }
Exemple #6
0
 public void SetNativeValue(CZQThostFtdcInstrumentCommissionRateField instrumentCommissionRate)
 {
     this.instrumentCommissionRate = instrumentCommissionRate;
     this.isRefreshCommissionRate  = true;
 }