Ejemplo n.º 1
0
        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();
            }
        }
Ejemplo n.º 2
0
        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();
            }
        }