Beispiel #1
0
 internal void RequestMarketData(QotCommon.QotMarket market, string code)
 {
     QotSub.Request.Builder     reqBuilder   = QotSub.Request.CreateBuilder();
     QotSub.C2S.Builder         csReqBuilder = QotSub.C2S.CreateBuilder();
     QotCommon.Security.Builder stock        = QotCommon.Security.CreateBuilder();
     stock.SetCode(code);
     stock.SetMarket((int)market);
     csReqBuilder.AddSecurityList(stock);
     csReqBuilder.AddSubTypeList((int)QotCommon.SubType.SubType_Ticker);
     csReqBuilder.SetIsSubOrUnSub(true);
     csReqBuilder.SetIsRegOrUnRegPush(true);
     reqBuilder.SetC2S(csReqBuilder);
     uint serialNo = qot.Sub(reqBuilder.Build());
 }
Beispiel #2
0
        public QotSub.Response SubSync(List <QotCommon.Security> secList,
                                       List <QotCommon.SubType> subTypeList,
                                       bool isSub,
                                       bool isRegPush)
        {
            ReqInfo reqInfo   = null;
            Object  syncEvent = new Object();

            lock (syncEvent)
            {
                lock (qotLock)
                {
                    if (qotConnStatus != ConnStatus.READY)
                    {
                        return(null);
                    }
                    QotSub.C2S c2s = QotSub.C2S.CreateBuilder()
                                     .AddRangeSecurityList(secList)
                                     .AddRangeSubTypeList(subTypeList.Select(t => (int)t).ToList())
                                     .SetIsSubOrUnSub(isSub)
                                     .SetIsRegOrUnRegPush(isRegPush)
                                     .Build();
                    QotSub.Request req = QotSub.Request.CreateBuilder().SetC2S(c2s).Build();
                    uint           sn  = qot.Sub(req);
                    if (sn == 0)
                    {
                        return(null);
                    }
                    reqInfo = new ReqInfo(ProtoID.QotSub, syncEvent);
                    qotReqInfoMap.Add(sn, reqInfo);
                }
                Monitor.Wait(syncEvent);
                return((QotSub.Response)reqInfo.Rsp);
            }
        }
Beispiel #3
0
            void SendSub(FTAPI_Qot qot)
            {
                QotSub.Request.Builder     reqBuilder   = QotSub.Request.CreateBuilder();
                QotSub.C2S.Builder         csReqBuilder = QotSub.C2S.CreateBuilder();
                QotCommon.Security.Builder stock        = QotCommon.Security.CreateBuilder();
                stock.SetCode("00700");
                stock.SetMarket((int)QotCommon.QotMarket.QotMarket_HK_Security);
                csReqBuilder.AddSecurityList(stock);
                csReqBuilder.AddSubTypeList((int)QotCommon.SubType.SubType_Ticker);
                csReqBuilder.SetIsSubOrUnSub(true);
                csReqBuilder.SetIsRegOrUnRegPush(true);
                reqBuilder.SetC2S(csReqBuilder);
                uint serialNo = qot.Sub(reqBuilder.Build());

                Console.WriteLine("SendSub: {0}", serialNo);
            }