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 #2
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();
            }
        }
        public void StartASEEventChain()
        {
            int TagValue = 1;

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

                Ils.Tag = TagValue;
                SpreadLegKeys.Add(TagValue, null);
                TagValue++;

                Ils.Update += new EventHandler <InstrumentLookupSubscriptionEventArgs>(CreateAutoSpreader);

                IlsDictionary.Add(IKey, Ils);
                Ils.Start();
            }
        }
Exemple #4
0
        private void button1_Click(object sender, EventArgs e)
        {

            for (int i = 0; i < FilteredList.Count; i++)
            {
                if (FilteredList[i].MarketKey == "CME")
                    mkey = MarketKey.Cme;
                else if (FilteredList[i].MarketKey == "ICE_IPE")
                    mkey = MarketKey.Ice;

                if (FilteredList[i].ProductType == "FUTURE")
                    ptype = ProductType.Future;
                else if (FilteredList[i].ProductType == "SPREAD")
                    ptype = ProductType.Spread;

                m_req = new InstrumentLookupSubscription(m_apiInstance.Session, Dispatcher.Current,
                new ProductKey(mkey, ptype, FilteredList[i].ProductName),
                FilteredList[i].InstrumentName);

                m_req.Update += new EventHandler<InstrumentLookupSubscriptionEventArgs>(m_req_Update);
                m_req.Start();
            }

        }
        // SubscribeToInstrument(MarketKey.Cme, ProductType.Future, "HG", "Dec13");
        private void SubscribeToInstrument(MarketKey marketKey, ProductType productType, string product, string contract)
        {
            ProductKey productKey = new ProductKey(marketKey, productType, product);

            SubscribeToInstrument(productKey, contract);
        }
 public ContractDetails(MarketKey mk, ProductType pt, string prod, string cont)
 {
     m_marketKey = mk;
     m_productType = pt;
     m_product = prod;
     m_contract = cont;
 }
        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 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();
            }
        }
        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 StartASEEventChain()
        {
                int TagValue = 1;

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

                    Ils.Tag = TagValue;
                    SpreadLegKeys.Add(TagValue, null);
                    TagValue++;

                    Ils.Update += new EventHandler<InstrumentLookupSubscriptionEventArgs>(CreateAutoSpreader);
                    
                    IlsDictionary.Add(IKey, Ils);
                    Ils.Start();
                }
        }
        /// <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();
            }
        }