public QotRequestHistoryKL.Response RequestHistoryKLSync(QotCommon.Security sec, QotCommon.KLType klType, QotCommon.RehabType rehabType, String beginTime, String endTime, int?count, long?klFields, byte[] nextReqKey, bool extendedTime) { ReqInfo reqInfo = null; Object syncEvent = new Object(); lock (syncEvent) { lock (qotLock) { if (qotConnStatus != ConnStatus.READY) { return(null); } QotRequestHistoryKL.C2S.Builder c2s = QotRequestHistoryKL.C2S.CreateBuilder() .SetSecurity(sec) .SetKlType((int)klType) .SetRehabType((int)rehabType) .SetBeginTime(beginTime) .SetEndTime(endTime) .SetExtendedTime(extendedTime); if (count.HasValue) { c2s.SetMaxAckKLNum(count.Value); } if (klFields.HasValue) { c2s.SetNeedKLFieldsFlag(klFields.Value); } if (nextReqKey.Length > 0) { c2s.SetNextReqKey(ByteString.CopyFrom(nextReqKey)); } QotRequestHistoryKL.Request req = QotRequestHistoryKL.Request.CreateBuilder().SetC2S(c2s).Build(); uint sn = qot.RequestHistoryKL(req); if (sn == 0) { return(null); } reqInfo = new ReqInfo(ProtoID.QotRequestHistoryKL, syncEvent); qotReqInfoMap.Add(sn, reqInfo); } Monitor.Wait(syncEvent); return((QotRequestHistoryKL.Response)reqInfo.Rsp); } }
internal void RequestHistoricalData(QotCommon.QotMarket market, string code, DateTime beginTime, DateTime endTime, QotCommon.KLType kLType) { QotRequestHistoryKL.Request.Builder reqBuilder = QotRequestHistoryKL.Request.CreateBuilder(); QotRequestHistoryKL.C2S.Builder csReqBuilder = QotRequestHistoryKL.C2S.CreateBuilder(); QotCommon.Security.Builder stock = QotCommon.Security.CreateBuilder(); stock.SetCode(code); stock.SetMarket((int)market); csReqBuilder.Security = stock.Build(); csReqBuilder.KlType = (int)kLType; csReqBuilder.BeginTime = beginTime.ToString("yyyy-MM-dd"); csReqBuilder.EndTime = endTime.ToString("yyyy-MM-dd"); reqBuilder.SetC2S(csReqBuilder); qot.RequestHistoryKL(reqBuilder.Build()); }
protected override QotRequestHistoryKL.Request.Builder MakeReqBuilder(ReqHisKL request) { QotRequestHistoryKL.Request.Builder reqBuilder = QotRequestHistoryKL.Request.CreateBuilder(); QotRequestHistoryKL.C2S.Builder csReqBuilder = QotRequestHistoryKL.C2S.CreateBuilder(); QotCommon.Security.Builder stock = QotCommon.Security.CreateBuilder(); stock.SetCode(request.Security.Code); stock.SetMarket((int)request.Security.Market); csReqBuilder.Security = stock.Build(); csReqBuilder.RehabType = (int)request.RehabType; csReqBuilder.KlType = (int)request.KLType; csReqBuilder.BeginTime = request.Begin.ToString("yyyy-MM-dd"); csReqBuilder.EndTime = request.End.ToString("yyyy-MM-dd"); reqBuilder.SetC2S(csReqBuilder); return(reqBuilder); }