Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            C1Price inst1 = new C1Price();

            //inst1.OnFrontConnected += new C1Price.FrontConnected(onLoginCallback);
            //inst1.OnRspUserLogin += new C1Price.RspUserLogin( onRspUserLoginMethod);
            //inst1.OnRtnDepthMarketData += new C1Price.RtnDepthMarketData(OnRtnDepthMarketDataCallback);

            inst1.OnFrontConnected     += onLoginCallback;
            inst1.OnRspUserLogin       += onRspUserLoginMethod;
            inst1.OnRtnDepthMarketData += onRtnDepthMarketDataCallback;

            inst1.Connect();
            string[] contractList = new string[] { "rb1905" };
            while (isConnected != true)
            {
                System.Threading.Thread.Sleep(1000);
            }

            Console.WriteLine("sub1");
            inst1.SubMarketData(contractList);
            Console.WriteLine("sub2");
            Console.WriteLine(strMarketData);

            while (theCount < 100)
            {
            }
            inst1.DisConnect();
        }
Пример #2
0
        public static void onLoginCallback()
        {
            Console.WriteLine("Frond end Connected.");

            //public void getHost(string _investor = "118907", string _pwd = "Hello", string _broker = "9999"
            //, string _addr = "tcp://180.168.146.187:10031")
            CThostFtdcReqUserLoginField f = new CThostFtdcReqUserLoginField();

            f.BrokerID = "9999";
            f.UserID   = "118907";
            f.Password = "******";
            C1Price.UserLogin();
            Console.WriteLine("User Login Called");
        }