Esempio n. 1
0
        /// <summary>
        /// Event notification for status of authentication
        /// </summary>
        public void apiInstance_AuthenticationStatusUpdate(object sender, AuthenticationStatusUpdateEventArgs e)
        {
            if (e.Status.IsSuccess)
            {
                // Start Time & Sales subscriptions on a separate thread
                List <ContractDetails> lcd1 = new List <ContractDetails>();
                lcd1.Add(new ContractDetails(MarketKey.Cme, ProductType.Future, "ES", "Dec13"));
                lcd1.Add(new ContractDetails(MarketKey.Cme, ProductType.Future, "NQ", "Dec13"));

                Strategy1 s1            = new Strategy1(m_apiInstance, lcd1);
                Thread    workerThread1 = new Thread(s1.Start);
                workerThread1.Name = "Strategy 1 Thread";
                workerThread1.Start();

                // Start more Time & Sales subscriptions on a separate thread
                List <ContractDetails> lcd2 = new List <ContractDetails>();
                lcd2.Add(new ContractDetails(MarketKey.Cbot, ProductType.Future, "ZB", "Dec13"));
                lcd2.Add(new ContractDetails(MarketKey.Cbot, ProductType.Future, "ZN", "Dec13"));

                Strategy2 s2            = new Strategy2(m_apiInstance, lcd2);
                Thread    workerThread2 = new Thread(s2.Start);
                workerThread2.Name = "Strategy 2 Thread";
                workerThread2.Start();
            }
            else
            {
                Console.WriteLine("TT Login failed: {0}", e.Status.StatusMessage);
                Dispose();
            }
        }
        /// <summary>
        /// Event notification for status of authentication
        /// </summary>
        public void apiInstance_AuthenticationStatusUpdate(object sender, AuthenticationStatusUpdateEventArgs e)
        {
            if (e.Status.IsSuccess)
            {
                // Start Time & Sales subscriptions on a separate thread
                List<ContractDetails> lcd1 = new List<ContractDetails>();
                lcd1.Add(new ContractDetails(MarketKey.Cme, ProductType.Future, "ES", "Dec13"));
                lcd1.Add(new ContractDetails(MarketKey.Cme, ProductType.Future, "NQ", "Dec13"));

                Strategy1 s1 = new Strategy1(m_apiInstance, lcd1);
                Thread workerThread1 = new Thread(s1.Start);
                workerThread1.Name = "Strategy 1 Thread";
                workerThread1.Start();

                // Start more Time & Sales subscriptions on a separate thread
                List<ContractDetails> lcd2 = new List<ContractDetails>();
                lcd2.Add(new ContractDetails(MarketKey.Cbot, ProductType.Future, "ZB", "Dec13"));
                lcd2.Add(new ContractDetails(MarketKey.Cbot, ProductType.Future, "ZN", "Dec13"));

                Strategy2 s2 = new Strategy2(m_apiInstance, lcd2);
                Thread workerThread2 = new Thread(s2.Start);
                workerThread2.Name = "Strategy 2 Thread";
                workerThread2.Start();
            }
            else
            {
                Console.WriteLine("TT Login failed: {0}", e.Status.StatusMessage);
                Dispose();
            }
        }