Exemplo n.º 1
0
        /// <summary>
        /// MarketsUpdated callback.
        /// NOTE: MarketsUpdated will be called on the dispatcher that TT API was initialized on.
        /// </summary>
        private void marketsUpdated(object sender, MarketCatalogUpdatedEventArgs e)
        {
            listViewMarketList.Groups.Clear();
            listViewMarketList.Items.Clear();

            // Create a sorted list of markets objects.
            // Please refer to MSDN for more information about Lambda expressions used to Query collections. http://msdn.microsoft.com/en-us/library/bb397675
            var marketList = m_TTAPI.Session.MarketCatalog.Markets.Values.OrderBy(market => market.Name);

            // Create new MarketListViewItems and add them to the view.
            foreach (Market market in marketList)
            {
                // Add all markets except for synthetic ones.
                if (market.Key != MarketKey.AlgoSE &&
                    market.Key != MarketKey.Autospreader)
                {
                    // Add the item if not currently in the tree
                    if (m_marketList.Where(m => m.Name == market.Name).Count() == 0)
                    {
                        MarketListViewItem marketItem = new MarketListViewItem(listViewMarketList);
                        marketItem.Market = market;
                        m_marketList.Add(marketItem);
                    }
                }
            }
        }
 /// <summary>
 /// MarketsUpdated event.
 /// Fires when the market catalog is updated.
 /// </summary>
 void m_marketCatalog_MarketsUpdated(object sender, MarketCatalogUpdatedEventArgs e)
 {
     foreach (Market market in m_marketCatalog.Markets.Values)
     {
         if (market.Key == MarketKey.Autospreader)
         {
             market.FeedStatusChanged += new EventHandler <FeedStatusChangedEventArgs>(market_FeedStatusChanged);
         }
     }
 }
Exemplo n.º 3
0
 private void MarketsUpdated(object sender, MarketCatalogUpdatedEventArgs e)
 {
     foreach (Market market in _apiInstance.Session.MarketCatalog.Markets.Values)
     {
         if (!_availableMarketsDico.ContainsKey(market.Name))
         {
             _availableMarketsDico.Add(market.Name, market);
         }
         UpdateMarketsubscription(market.Name);
     }
 }
 /// <summary>
 /// MarketsUpdated callback.
 /// NOTE: MarketsUpdated will be called on the dispatcher that TT API was initialized on.
 /// </summary>
 private void marketsUpdated(object sender, MarketCatalogUpdatedEventArgs e)
 {
     foreach (Market market in e.Added)
     {
         // Add the item if not currently in the tree
         if (m_marketList.Where(m => m.Name == market.Name).Count() == 0)
         {
             MarketListViewItem marketItem = new MarketListViewItem(listViewMarketList);
             marketItem.Market = market;
             m_marketList.Add(marketItem);
             listViewMarketList.Items.Add(marketItem);
         }
     }
 }
Exemplo n.º 5
0
        }     // ProcessHubRequestInstrumentPrice()

        //
        //
        //
        //
        // *****************************************************************
        // ****             ProcessMarketCatalogUpdate()                ****
        // *****************************************************************
        /// <summary>
        /// Called by hub thread to process changes because TT told me the Catalog updated.
        /// </summary>
        /// <param name="eventArg"></param>
        private void ProcessMarketCatalogUpdate(MarketCatalogUpdatedEventArgs eventArg)
        {
            if (eventArg.Error == null)
            {
                List <string> mktNames = new List <string>();
                foreach (Market mkt in m_TTService.session.MarketCatalog.Markets.Values)
                {
                    mktNames.Add(mkt.Name);
                }
                OnMarketStatusChanged(mktNames);
            }
            else
            {
                Log.NewEntry(LogLevel.Error, "ProcessMarketCatalogUpdate: MarketCatalogUpdated error = {0}.");
            }
        }//ProcessMarketCatalogUpdate()
Exemplo n.º 6
0
 void MarketCatalog_MarketsUpdated(object sender, MarketCatalogUpdatedEventArgs e)
 {
 }
        /// <summary>
        /// MarketsUpdated callback.
        /// NOTE: MarketsUpdated will be called on the dispatcher that TT API was initialized on.
        /// </summary>
        private void marketsUpdated(object sender, MarketCatalogUpdatedEventArgs e)
        {
            listViewMarketList.Groups.Clear();
            listViewMarketList.Items.Clear();

            // Create a sorted list of markets objects.
            // Please refer to MSDN for more information about Lambda expressions used to Query collections. http://msdn.microsoft.com/en-us/library/bb397675
            var marketList = m_TTAPI.Session.MarketCatalog.Markets.Values.OrderBy(market => market.Name);
            
            // Create new MarketListViewItems and add them to the view.
            foreach (Market market in marketList)
            {
                // Add all markets except for synthetic ones.
                if (market.Key != MarketKey.AlgoSE &&
                    market.Key != MarketKey.Autospreader)
                {
                    // Add the item if not currently in the tree
                    if (m_marketList.Where(m => m.Name == market.Name).Count() == 0)
                    {
                        MarketListViewItem marketItem = new MarketListViewItem(listViewMarketList);
                        marketItem.Market = market;
                        m_marketList.Add(marketItem);
                    }
                }
            }
        }
 /// <summary>
 /// MarketsUpdated event.
 /// Fires when the market catalog is updated.
 /// </summary>
 void m_marketCatalog_MarketsUpdated(object sender, MarketCatalogUpdatedEventArgs e)
 {
     foreach (Market market in m_marketCatalog.Markets.Values)
     {
         if (market.Key == MarketKey.Autospreader)
         {
             market.FeedStatusChanged += new EventHandler<FeedStatusChangedEventArgs>(market_FeedStatusChanged);
         }
     }
 }
Exemplo n.º 9
0
        //
        #endregion // price listener


        #region Event Handlers for TT
        // *****************************************************************
        // ****                 Event Handlers for TT                   ****
        // *****************************************************************
        //
        /// <summary>
        /// Callbacks from TT API as markets are discoverd, or their feeds change.
        /// The thread calling these is my TTService thread.
        /// </summary>
        private void MarketCatalog_Updated(object sender, MarketCatalogUpdatedEventArgs eventArg)
        {
            //Log.NewEntry(LogLevel.Minor, "MarketCatalog_Updated: Callback by thread {0}", System.Threading.Thread.CurrentThread.Name);
            this.HubEventEnqueue(eventArg);
        }