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); } } }
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()); }
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); }