/// <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();
            }
        }
Exemple #2
0
        void apiInstance_AuthenticationStatusUpdate(object sender, AuthenticationStatusUpdateEventArgs e)
        {
            if (!e.Status.IsSuccess)
            {
                initSuccess = false;
                initMessage = "Login failed: " + e.Status.StatusMessage;
            }

            AppStart();
        }
 public void apiInstance_AuthenticationStatusUpdate(object sender, AuthenticationStatusUpdateEventArgs e)
 {
     if (e.Status.IsSuccess)
     {
         StartSpreadDetailsProcess();
     }
     else
     {
         Console.WriteLine("Login Failed: " + e.Status.StatusMessage);
         Dispose();
     }
 }
        public void apiInstance_AuthenticationStatusUpdate(object sender, AuthenticationStatusUpdateEventArgs e)
        {
            Contract C = new Contract();

            C.Init(this, MainForm, apiInstance);
            InstrumentLookupSubscription req = new InstrumentLookupSubscription(apiInstance.Session, Dispatcher.Current, new ProductKey("CME", "FUTURE", "HE"), "Feb19");

            req.Update += new EventHandler <InstrumentLookupSubscriptionEventArgs>(C.req_Update);
            req.Start();

            MainForm.XtraderConnected("HE Feb19", C);
        }
 /// <summary>
 /// Event notification for status of authentication
 /// </summary>
 public void apiInstance_AuthenticationStatusUpdate(object sender,
                                                    AuthenticationStatusUpdateEventArgs e)
 {
     if (e.Status.IsSuccess)
     {
         Console.WriteLine("TT API User Authentication Succeeded: {0}", e.Status.StatusMessage);
         // Add code here to begin working with the TT API
     }
     else
     {
         Console.WriteLine("TT API User Authentication failed: {0}", e.Status.StatusMessage);
     }
 }
 /// <summary>
 /// Event notification for status of authentication
 /// </summary>
 public void apiInstance_AuthenticationStatusUpdate(object sender, AuthenticationStatusUpdateEventArgs e)
 {
     if (e.Status.IsSuccess)
     {
         m_isStarted = true;
         cout("TengineTT: TT Login successful!");
     }
     else
     {
         cout("TengineTT: TT Login failed: {0}", e.Status.StatusMessage);
         Dispose();
     }
 }
Exemple #7
0
 /// <summary>
 /// Event notification for status of authentication
 /// </summary>
 private void AuthenticationStatusUpdate(object sender, AuthenticationStatusUpdateEventArgs e)
 {
     if (e.Status.IsSuccess)
     {
         log.Info("TT Login Succed");
         ConnectionStatusEvent?.Invoke(this, "Connection_Succeed");
     }
     else
     {
         log.Info($"TT Login failed: {e.Status.StatusMessage}");
         ConnectionStatusEvent?.Invoke(this, "Connection_Failed");
         Dispose();
     }
 }
 public void Subscribe2OrderFills(object sender, AuthenticationStatusUpdateEventArgs e)
 {
     if (e.Status.IsSuccess)
     {
         // Start a fill subscription
         Fs            = new FillsSubscription(m_apiInstance.Session, Dispatcher.Current);
         Fs.FillAdded += new EventHandler <FillAddedEventArgs>(FillAddedEventHandler);
         Fs.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)
     {
         ProductLookupSubscription pls = new ProductLookupSubscription(m_apiInstance.Session, Dispatcher.Current,
                                                                       new ProductKey(MarketKey.Cme, ProductType.Future, "CL"));
         pls.Update += new EventHandler <ProductLookupSubscriptionEventArgs>(pls_Update);
         pls.Start();
     }
     else
     {
         Console.WriteLine("TT Login failed: {0}", e.Status.StatusMessage);
         Dispose();
     }
 }
 public void apiInstance_AuthenticationStatusUpdate(object sender, AuthenticationStatusUpdateEventArgs e)
 {
     if (e.Status.IsSuccess)
     {
         req = new InstrumentLookupSubscription(apiInstance.Session, Dispatcher.Current,
             new ProductKey(MarketKey.Cbot, ProductType.Future, "ZN"),
             "Sep12");
         req.Update += new EventHandler<InstrumentLookupSubscriptionEventArgs>(req_Update);
         req.Start();
     }
     else
     {
         Console.WriteLine("Login Failed: " + e.Status.StatusMessage);
         Dispose();
     }
 }
 void apiInstance_AuthenticationStatusUpdate(object sender, AuthenticationStatusUpdateEventArgs e)
 {
     if (e.Status.IsSuccess)
     {
         req = new InstrumentLookupSubscription(apiInstance.Session, Dispatcher.Current,
                                                new ProductKey(MarketKey.Cme, ProductType.Future, "ES"),
                                                "Mar13");
         req.Update += new EventHandler <InstrumentLookupSubscriptionEventArgs>(req_Update);
         req.Start();
     }
     else
     {
         Console.WriteLine("Login Failed: " + e.Status.StatusMessage);
         Dispose();
     }
 }
 public void StartASESubscriptions(object sender, AuthenticationStatusUpdateEventArgs e)
 {
     if (e.Status.IsSuccess)
     {
         foreach (AutoSpreader item in AutoSpreaderList)
         {
             item.m_apiInstance = m_apiInstance;
             item.Subs          = this;
             item.StartASEEventChain();
         }
     }
     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)
            {

                ProductLookupSubscription pls = new ProductLookupSubscription(apiInstance.Session, Dispatcher.Current,
                    new ProductKey(MarketKey.Cme, ProductType.Future, "CL"));
                pls.Update += new EventHandler<ProductLookupSubscriptionEventArgs>(pls_Update);
                pls.Start();

            }
            else
            {
                Console.WriteLine("TT Login failed: {0}", e.Status.StatusMessage);
                Dispose();
            }
        }
Exemple #14
0
 /// <summary>
 /// Event notification for status of authentication
 /// </summary>
 public void apiInstance_AuthenticationStatusUpdate(object sender, AuthenticationStatusUpdateEventArgs e)
 {
     if (e.Status.IsSuccess)
     {
         // lookup an instrument
         m_req = new InstrumentLookupSubscription(m_apiInstance.Session, Dispatcher.Current,
                                                  new ProductKey(MarketKey.Cbot, ProductType.Future, "ZN"),
                                                  "Sep13");
         m_req.Update += new EventHandler <InstrumentLookupSubscriptionEventArgs>(m_req_Update);
         m_req.Start();
     }
     else
     {
         Console.WriteLine("TT Login failed: {0}", e.Status.StatusMessage);
         Dispose();
     }
 }
Exemple #15
0
        }// TT_UniversalInitComplete()

        //
        // *********************************************************************
        // ****             TT Authentication Status Update                 ****
        // *********************************************************************
        /// <summary>
        /// Callback for user login authentication for the Universal login.
        /// </summary>
        private void TT_AuthenticationStatusUpdate(object sender, AuthenticationStatusUpdateEventArgs eventArg)
        {
            if (eventArg.Status.IsSuccess)
            {
                this.session = m_UAPI.Session;              // store session ptr.
                if (m_Log != null)
                {
                    m_Log.NewEntry(LogLevel.Major, "AuthenticationStatusUpdate: Login authentication is successful. ");
                }
                this.session.AdminMessage += new EventHandler <AdminMessageEventArgs>(Session_AdminMessage);
            }
            else if (m_Log != null)
            {
                m_Log.NewEntry(LogLevel.Error, "AuthenticationStatusUpdate: Login authentication failed: " + eventArg.Status.StatusMessage);
            }
            OnServiceStatusChanged(new ServiceStatusChangeEventArgs(eventArg.Status.IsSuccess));
        }// TT_AuthenticationStatusUpdate()
        public void startInstrumentLookupSubscriptions(object sender, AuthenticationStatusUpdateEventArgs e)
        {
            if (e.Status.IsSuccess)
            {
                foreach (string dbTicker in dbTickerList)
                {
                    ttapiTicker currentTicker = TA.TickerConverters.ConvertFromDbTicker2ttapiTicker(dbTicker);

                    if (currentTicker.marketKey == "CME")
                    {
                        mkey = MarketKey.Cme;
                    }
                    else if (currentTicker.marketKey == "ICE_IPE")
                    {
                        mkey = MarketKey.Ice;
                    }

                    if (currentTicker.productType == "FUTURE")
                    {
                        ptype = ProductType.Future;
                    }
                    else if (currentTicker.productType == "SPREAD")
                    {
                        ptype = ProductType.Spread;
                    }

                    InstrumentKey IKey = new InstrumentKey(new ProductKey(mkey, ptype, currentTicker.productName), currentTicker.SeriesKey);

                    Ils = new InstrumentLookupSubscription(m_apiInstance.Session, Dispatcher.Current, new ProductKey(mkey, ptype, currentTicker.productName), currentTicker.SeriesKey);

                    for (int i = 0; i < ilsUpdateList.Count; i++)
                    {
                        Ils.Update += new EventHandler <InstrumentLookupSubscriptionEventArgs>(ilsUpdateList[i]);
                    }

                    IlsDictionary.Add(IKey, Ils);
                    Ils.Start();
                }
            }
            else
            {
                Console.WriteLine("TT Login failed: {0}", e.Status.StatusMessage);
                Dispose();
            }
        }
        public void startProductLookupSubscriptions(object sender, AuthenticationStatusUpdateEventArgs e)
        {
            PlsDictionaryCompleteQ = false;

            if (e.Status.IsSuccess)
            {
                // lookup an instrument
                foreach (string TickerHead in TickerHeadList)
                {
                    string exchange = ContractUtilities.ContractMetaInfo.GetExchange4Tickerhead(TickerHead);
                    if (exchange == "CME")
                    {
                        mkey = MarketKey.Cme;
                    }
                    else if (exchange == "ICE")
                    {
                        mkey = MarketKey.Ice;
                    }

                    Console.WriteLine(TA.TickerheadConverters.ConvertFromDB2TT(TickerHead));

                    ProductKey ProdKey            = new ProductKey(mkey, ProductType.Future, TA.TickerheadConverters.ConvertFromDB2TT(TickerHead));
                    ProductLookupSubscription PLS = new ProductLookupSubscription(m_apiInstance.Session, Dispatcher.Current, ProdKey);
                    PlsDictionary.Add(ProdKey, PLS);
                    PLS.Update += new EventHandler <ProductLookupSubscriptionEventArgs>(PLSEventHandler);
                    PLS.Start();

                    ProdKey = new ProductKey(mkey, ProductType.Spread, TA.TickerheadConverters.ConvertFromDB2TT(TickerHead));
                    PLS     = new ProductLookupSubscription(m_apiInstance.Session, Dispatcher.Current, ProdKey);

                    PlsDictionary.Add(ProdKey, PLS);
                    PLS.Update += new EventHandler <ProductLookupSubscriptionEventArgs>(PLSEventHandler);
                    PLS.Start();
                }
                PlsDictionaryCompleteQ = true;
            }

            else
            {
                Console.WriteLine("TT Login failed: {0}", e.Status.StatusMessage);
                Dispose();
            }
        }
 public void apiInstance_AuthenticationStatusUpdate(object sender, AuthenticationStatusUpdateEventArgs e)
 {
     if (e.Status.IsSuccess)
     {
         fs = new FillsSubscription(apiInstance.Session, Dispatcher.Current);
         fs.FillListStart += new EventHandler<FillListEventArgs>(fs_FillListStart);
         fs.FillBookDownload += new EventHandler<FillBookDownloadEventArgs>(fs_FillBookDownload);
         fs.FillListEnd += new EventHandler<FillListEventArgs>(fs_FillListEnd);
         fs.FillAdded += new EventHandler<FillAddedEventArgs>(fs_FillAdded);
         fs.FillDeleted += new EventHandler<FillDeletedEventArgs>(fs_FillDeleted);
         fs.FillAmended += new EventHandler<FillAmendedEventArgs>(fs_FillAmended);
         fs.Start();
     }
     else
     {
         Console.WriteLine("Login Failed: " + 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 a fill subscription
         m_fs = new FillsSubscription(m_apiInstance.Session, Dispatcher.Current);
         m_fs.FillAdded += new EventHandler<FillAddedEventArgs>(m_fs_FillAdded);
         m_fs.FillAmended += new EventHandler<FillAmendedEventArgs>(m_fs_FillAmended);
         m_fs.FillBookDownload += new EventHandler<FillBookDownloadEventArgs>(m_fs_FillBookDownload);
         m_fs.FillDeleted += new EventHandler<FillDeletedEventArgs>(m_fs_FillDeleted);
         m_fs.FillListEnd += new EventHandler<FillListEventArgs>(m_fs_FillListEnd);
         m_fs.FillListStart += new EventHandler<FillListEventArgs>(m_fs_FillListStart);
         m_fs.Rollover += new EventHandler<RolloverEventArgs>(m_fs_Rollover);
         m_fs.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 a fill subscription
         m_fs                   = new FillsSubscription(m_apiInstance.Session, Dispatcher.Current);
         m_fs.FillAdded        += new EventHandler <FillAddedEventArgs>(m_fs_FillAdded);
         m_fs.FillAmended      += new EventHandler <FillAmendedEventArgs>(m_fs_FillAmended);
         m_fs.FillBookDownload += new EventHandler <FillBookDownloadEventArgs>(m_fs_FillBookDownload);
         m_fs.FillDeleted      += new EventHandler <FillDeletedEventArgs>(m_fs_FillDeleted);
         m_fs.FillListEnd      += new EventHandler <FillListEventArgs>(m_fs_FillListEnd);
         m_fs.FillListStart    += new EventHandler <FillListEventArgs>(m_fs_FillListStart);
         m_fs.Rollover         += new EventHandler <RolloverEventArgs>(m_fs_Rollover);
         m_fs.Start();
     }
     else
     {
         Console.WriteLine("TT Login failed: {0}", e.Status.StatusMessage);
         Dispose();
     }
 }
Exemple #21
0
        /// <summary>
        /// Event notification for status of authentication
        /// </summary>
        ///

        public void apiInstance_AuthenticationStatusUpdate(object sender, AuthenticationStatusUpdateEventArgs e)
        {
            if (e.Status.IsSuccess)
            {
                // lookup an instrument
                foreach (string TickerHead in TickerheadList)
                {
                    string TickerHead2 = TickerHead;
                    string exchange    = ContractUtilities.ContractMetaInfo.GetExchange4Tickerhead(TickerHead2);
                    if (exchange == "CME")
                    {
                        mkey = MarketKey.Cme;
                    }
                    else if (exchange == "ICE")
                    {
                        mkey = MarketKey.Ice;
                    }

                    Console.WriteLine(TA.TickerheadConverters.ConvertFromDB2TT(TickerHead2));
                    ProductLookupSubscription pls = new ProductLookupSubscription(m_apiInstance.Session, Dispatcher.Current,
                                                                                  new ProductKey(mkey, ProductType.Future, TA.TickerheadConverters.ConvertFromDB2TT(TickerHead)));

                    plsList.Add(pls);
                    pls.Update += new EventHandler <ProductLookupSubscriptionEventArgs>(pls_Update);
                    pls.Start();

                    pls = new ProductLookupSubscription(m_apiInstance.Session, Dispatcher.Current,
                                                        new ProductKey(mkey, ProductType.Spread, TA.TickerheadConverters.ConvertFromDB2TT(TickerHead)));

                    plsList.Add(pls);
                    pls.Update += new EventHandler <ProductLookupSubscriptionEventArgs>(pls_Update);
                    pls.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)
            {
                
                // lookup an instrument
                foreach (string TickerHead in TickerheadList)
                {
                    string TickerHead2 = TickerHead;
                    string exchange = ContractUtilities.ContractMetaInfo.GetExchange4Tickerhead(TickerHead2);
                    if (exchange=="CME")
                        mkey = MarketKey.Cme;
                    else if  (exchange=="ICE")
                        mkey = MarketKey.Ice;

                    Console.WriteLine(TA.TickerheadConverters.ConvertFromDB2TT(TickerHead2));
                    ProductLookupSubscription pls = new ProductLookupSubscription(m_apiInstance.Session, Dispatcher.Current,
                        new ProductKey(mkey, ProductType.Future, TA.TickerheadConverters.ConvertFromDB2TT(TickerHead)));

                    plsList.Add(pls);
                    pls.Update += new EventHandler<ProductLookupSubscriptionEventArgs>(pls_Update);
                    pls.Start();

                    pls = new ProductLookupSubscription(m_apiInstance.Session, Dispatcher.Current,
                        new ProductKey(mkey, ProductType.Spread, TA.TickerheadConverters.ConvertFromDB2TT(TickerHead)));

                    plsList.Add(pls);
                    pls.Update += new EventHandler<ProductLookupSubscriptionEventArgs>(pls_Update);
                    pls.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)
     {
         // lookup an instrument
         m_req = new InstrumentLookupSubscription(m_apiInstance.Session, Dispatcher.Current,
             new ProductKey(MarketKey.Cme, ProductType.Future, "ES"),
             "Mar13");
         m_req.Update += new EventHandler<InstrumentLookupSubscriptionEventArgs>(m_req_Update);
         m_req.Start();
     }
     else
     {
         Console.WriteLine("TT Login failed: {0}", e.Status.StatusMessage);
         Dispose();
     }
 }
        /// <summary>
        /// Event returning the status of a login attempt.
        /// </summary>
        void m_TTAPI_AuthenticationStatusUpdate(object sender, AuthenticationStatusUpdateEventArgs e)
        {
            // Check for successful login
            if (!e.Status.IsSuccess)
            {
                // if an unsuccessful login, show the user why and allow them to try again
                MessageBox.Show("Login Unsuccessful.\r\n\r\nReason: " + e.Status.StatusMessage, "Error");
                return;
            }

            // subscribe to the trade subscription events
            m_TradeSubscription = new TradeSubscription(m_TTAPI.Session, Dispatcher.Current);
            m_TradeSubscription.OrderAdded += new EventHandler<OrderAddedEventArgs>(tradeSubscription_OrderAdded);
            m_TradeSubscription.OrderBookDownload += new EventHandler<OrderBookDownloadEventArgs>(tradeSubscription_OrderBookDownload);
            m_TradeSubscription.OrderDeleted += new EventHandler<OrderDeletedEventArgs>(tradeSubscription_OrderDeleted);
            m_TradeSubscription.OrderFilled += new EventHandler<OrderFilledEventArgs>(tradeSubscription_OrderFilled);
            m_TradeSubscription.OrderRejected += new EventHandler<OrderRejectedEventArgs>(tradeSubscription_OrderRejected);
            m_TradeSubscription.OrderUpdated += new EventHandler<OrderUpdatedEventArgs>(tradeSubscription_OrderUpdated);
            m_TradeSubscription.OrderStatusUnknown += new EventHandler<OrderStatusUnknownEventArgs>(tradeSubscription_OrderStatusUnknown);
            m_TradeSubscription.Start();

            // Login succeeded, update GUI
            this.btnConnect.Enabled = false;
            UpdateStatusBar("Login Status: " + e.Status.ToString());
        }
 public void StartASESubscriptions(object sender, AuthenticationStatusUpdateEventArgs e)
 {
     if (e.Status.IsSuccess)
     {
         foreach (AutoSpreader item in AutoSpreaderList)
         {
             item.m_apiInstance = m_apiInstance;
             item.Subs = this;
             item.StartASEEventChain();
         }
     }
     else
     {
         Console.WriteLine("TT Login failed: {0}", e.Status.StatusMessage);
         Dispose();
     }
 }
        public void startInstrumentLookupSubscriptionsFromDataTable(object sender, AuthenticationStatusUpdateEventArgs e)
        {
            if (e.Status.IsSuccess)
            {
                foreach (DataRow item in TickerTable.Rows)
                {
                    ttapiTicker currentTicker;

                    if (item.Field<bool>("IsSpreadQ"))
                {
                    currentTicker = TA.TickerConverters.ConvertFromDbTicker2ttapiTicker(dbTicker: item.Field<string>("Ticker"), productType: "SPREAD");
                }
                else
                {
                    currentTicker = TA.TickerConverters.ConvertFromDbTicker2ttapiTicker(dbTicker: item.Field<string>("Ticker"), productType: "FUTURE");
                }
                    if (currentTicker.marketKey == "CME")
                        mkey = MarketKey.Cme;
                    else if (currentTicker.marketKey == "ICE_IPE")
                        mkey = MarketKey.Ice;

                    if (currentTicker.productType == "FUTURE")
                        ptype = ProductType.Future;
                    else if (currentTicker.productType == "SPREAD")
                        ptype = ProductType.Spread;

                    InstrumentKey IKey = new InstrumentKey(new ProductKey(mkey, ptype, currentTicker.productName), currentTicker.SeriesKey);

                    Console.WriteLine(currentTicker.SeriesKey);

                    Ils = new InstrumentLookupSubscription(m_apiInstance.Session, Dispatcher.Current, new ProductKey(mkey, ptype, currentTicker.productName), currentTicker.SeriesKey);

                    //Ils = new InstrumentLookupSubscription(m_apiInstance.Session, Dispatcher.Current, new ProductKey(MarketKey.Cme, ProductType.Spread, "CL"), "Nov16:-1xDec16");

                    for (int i = 0; i < ilsUpdateList.Count; i++)
                    {
                        Ils.Update += new EventHandler<InstrumentLookupSubscriptionEventArgs>(ilsUpdateList[i]);
                    }

                    IlsDictionary.Add(IKey, Ils);
                    Ils.Start();
                }
            }
            else
            {
                Console.WriteLine("TT Login failed: {0}", e.Status.StatusMessage);
                Dispose();
            }
        }
        public void startInstrumentLookupSubscriptionsFromTTAPITickers(object sender, AuthenticationStatusUpdateEventArgs e)
        {
            if (e.Status.IsSuccess)
            {
                foreach (ttapiTicker ticker in TTAPITickerList)
                {

                    if (ticker.marketKey == "CME")
                        mkey = MarketKey.Cme;
                    else if (ticker.marketKey == "ICE_IPE")
                        mkey = MarketKey.Ice;

                    if (ticker.productType == "FUTURE")
                        ptype = ProductType.Future;
                    else if (ticker.productType == "SPREAD")
                        ptype = ProductType.Spread;

                    InstrumentKey IKey = new InstrumentKey(new ProductKey(mkey, ptype, ticker.productName), ticker.SeriesKey);
                    Ils = new InstrumentLookupSubscription(m_apiInstance.Session, Dispatcher.Current, new ProductKey(mkey, ptype, ticker.productName), ticker.instrumentName);

                    for (int i = 0; i < ilsUpdateList.Count; i++)
                    {
                        Ils.Update += new EventHandler<InstrumentLookupSubscriptionEventArgs>(ilsUpdateList[i]);
                    }

                    IlsDictionary.Add(IKey, Ils);
                    Ils.Start();

                }
            }
            else
            {
                Console.WriteLine("TT Login failed: {0}", e.Status.StatusMessage);
                Dispose();
            }
        }
Exemple #28
0
 void apiInstance_AuthenticationStatusUpdate(object sender, AuthenticationStatusUpdateEventArgs e)
 {
     if (e.Status.IsSuccess)
     {
         this.Enabled = true;
     }
     else
     {
         MessageBox.Show(String.Format("ConnectionStatusUpdate: {0}", e.Status.StatusMessage));
     }
 }
        public void startProductLookupSubscriptions(object sender, AuthenticationStatusUpdateEventArgs e)
        {
            PlsDictionaryCompleteQ = false;

            if (e.Status.IsSuccess)
            {

                // lookup an instrument
                foreach (string TickerHead in TickerHeadList)
                {
                    string exchange = ContractUtilities.ContractMetaInfo.GetExchange4Tickerhead(TickerHead);
                    if (exchange == "CME")
                        mkey = MarketKey.Cme;
                    else if (exchange == "ICE")
                        mkey = MarketKey.Ice;

                    Console.WriteLine(TA.TickerheadConverters.ConvertFromDB2TT(TickerHead));

                    ProductKey ProdKey = new ProductKey(mkey, ProductType.Future, TA.TickerheadConverters.ConvertFromDB2TT(TickerHead));
                    ProductLookupSubscription PLS = new ProductLookupSubscription(m_apiInstance.Session, Dispatcher.Current, ProdKey);
                    PlsDictionary.Add(ProdKey, PLS);
                    PLS.Update += new EventHandler<ProductLookupSubscriptionEventArgs>(PLSEventHandler);
                    PLS.Start();

                    ProdKey = new ProductKey(mkey, ProductType.Spread, TA.TickerheadConverters.ConvertFromDB2TT(TickerHead));
                    PLS = new ProductLookupSubscription(m_apiInstance.Session, Dispatcher.Current, ProdKey);

                    PlsDictionary.Add(ProdKey, PLS);
                    PLS.Update += new EventHandler<ProductLookupSubscriptionEventArgs>(PLSEventHandler);
                    PLS.Start();
                }
                PlsDictionaryCompleteQ = true;
            }

            else
            {
                Console.WriteLine("TT Login failed: {0}", e.Status.StatusMessage);
                Dispose();
            }
        }
 public void Subscribe2OrderFills(object sender, AuthenticationStatusUpdateEventArgs e)
 {
      if (e.Status.IsSuccess)
     {
         // Start a fill subscription
         Fs = new FillsSubscription(m_apiInstance.Session, Dispatcher.Current);
         Fs.FillAdded += new EventHandler<FillAddedEventArgs>(FillAddedEventHandler);
         Fs.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)
            {
                // lookup the leg instruments

                ProductKey prodKeyLeg = new ProductKey(MarketKey.Cbot, ProductType.Future, "ZN");

                // We will use a dictionary to hold all instrument requests and update it when each instrument is found.
                // Once all lookup requests for the legs are complete, we can continue with the creation of the spread.
                // tagValue will be used in the dictionary to identify each lookup request.

                int tagValue = 1000;

                m_req1 = new InstrumentLookupSubscription(m_apiInstance.Session, Dispatcher.Current, prodKeyLeg, "Mar13");
                m_req1.Tag = tagValue;
                m_spreadLegKeys.Add(tagValue, null);
                m_req1.Update += new EventHandler<InstrumentLookupSubscriptionEventArgs>(m_req_Update);
                m_req1.Start();

                tagValue++;

                m_req2 = new InstrumentLookupSubscription(m_apiInstance.Session, Dispatcher.Current, prodKeyLeg, "Jun13");
                m_req2.Tag = tagValue;
                m_spreadLegKeys.Add(tagValue, null);
                m_req2.Update += new EventHandler<InstrumentLookupSubscriptionEventArgs>(m_req_Update);
                m_req2.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)
            {
                // lookup an instrument
                m_req = new InstrumentLookupSubscription(m_apiInstance.Session, Dispatcher.Current,
                    new ProductKey(MarketKey.Cme, ProductType.Spread, "CL"),
                    "Calendar: 1xCL Nov16:-1xDec16");
                m_req.Update += new EventHandler<InstrumentLookupSubscriptionEventArgs>(m_req_Update);
                m_req.Start();

                m_fs = new FillsSubscription(m_apiInstance.Session, Dispatcher.Current);
                m_fs.FillAdded += new EventHandler<FillAddedEventArgs>(m_fs_FillAdded);
                m_fs.Start();
            }
            else
            {
                Console.WriteLine("TT Login failed: {0}", e.Status.StatusMessage);
                Dispose();
            }
        }