コード例 #1
0
        /// <summary>
        /// Shuts down the TT API
        /// </summary>
        public void Dispose()
        {
            lock (m_lock)
            {
                if (!m_disposed)
                {
                    // Unattached callbacks and dispose of all subscriptions
                    if (pls != null)
                    {
                        pls.Update -= pls_Update;
                        pls.Dispose();
                        pls = null;
                    }
                    if (ics != null)
                    {
                        ics.InstrumentsUpdated -= ics_InstrumentsUpdated;
                        ics.Dispose();
                        ics = null;
                    }

                    // Begin shutdown the TT API
                    TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted);
                    TTAPI.Shutdown();

                    m_disposed = true;
                }
            }
        }
コード例 #2
0
 /// <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();
     }
 }
コード例 #3
0
        /// <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();
            }
        }
コード例 #4
0
        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();
            }
        }
コード例 #5
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();
            }
        }
コード例 #6
0
        /// <summary>
        /// Shuts down the TT API
        /// </summary>
        public void Dispose()
        {
            lock (m_lock)
            {
                if (!m_disposed)
                {
                    // Unattached callbacks and dispose of all subscriptions
                    if (pls != null)
                    {
                        pls.Update -= pls_Update;
                        pls.Dispose();
                        pls = null;
                    }
                    if (ics != null)
                    {
                        ics.InstrumentsUpdated -= ics_InstrumentsUpdated;
                        ics.Dispose();
                        ics = null;
                    }

                    // Begin shutdown the TT API
                    TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted);
                    TTAPI.Shutdown();

                    m_disposed = true;
                }
            }
        }
コード例 #7
0
        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();
            }
        }
コード例 #8
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();
            }
        }