Esempio n. 1
0
 public void OnInitConnect(FTAPI_Conn client, long errCode, string desc)
 {
     Console.WriteLine("InitConnected");
     if (errCode == 0)
     {
         FTAPI_Qot qot = client as FTAPI_Qot;
         {
             GetGlobalState.Request req = GetGlobalState.Request.CreateBuilder().SetC2S(GetGlobalState.C2S.CreateBuilder().SetUserID(900019)).Build();
             uint serialNo = qot.GetGlobalState(req);
             Console.WriteLine("Send GetGlobalState: {0}", serialNo);
         }
         //这样连续的发消息是不太好的,容易占满缓冲区。
         {
             QotSub.Request.Builder     reqBuilder   = QotSub.Request.CreateBuilder();
             QotSub.C2S.Builder         csReqBuilder = QotSub.C2S.CreateBuilder();
             QotCommon.Security.Builder stock        = QotCommon.Security.CreateBuilder();
             stock.SetCode("00823");
             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("Send Sub: {0}", serialNo);
         }
     }
 }
Esempio n. 2
0
 internal void RequestContractDetails(QotCommon.QotMarket market, string code)
 {
     QotGetSecuritySnapshot.Request.Builder reqBuilder   = QotGetSecuritySnapshot.Request.CreateBuilder();
     QotGetSecuritySnapshot.C2S.Builder     csReqBuilder = QotGetSecuritySnapshot.C2S.CreateBuilder();
     QotCommon.Security.Builder             stock        = QotCommon.Security.CreateBuilder();
     stock.SetCode(code);
     stock.SetMarket((int)market);
     csReqBuilder.AddSecurityList(stock);
     reqBuilder.SetC2S(csReqBuilder);
     qot.GetSecuritySnapshot(reqBuilder.Build());
 }
Esempio n. 3
0
 internal void CancelMarketData(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(false);
     csReqBuilder.SetIsRegOrUnRegPush(false);
     reqBuilder.SetC2S(csReqBuilder);
     uint serialNo = qot.Sub(reqBuilder.Build());
 }
Esempio n. 4
0
 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());
 }
Esempio n. 5
0
 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);
 }
Esempio n. 6
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);
            }