Example #1
0
        /// <summary>
        /// ConnectionStatusUpdate callback.
        /// Give feedback to the user that there was an issue starting up and connecting to XT.
        /// </summary>
        void ttapiInstance_ConnectionStatusUpdate(object sender, ConnectionStatusUpdateEventArgs e)
        {
            if (e.Status.IsSuccess)
            {
                m_marketList = new List <MarketListViewItem>();
                m_feedList   = new List <FeedListViewItem>();

                // Multiple instruments can be opened in the propery window at the same time.
                // We need to keep track of all subscriptions to properly cleanup if needed.
                m_instrumentCatalogSubscriptionList = new Dictionary <Product, InstrumentCatalogSubscription>();

                // Init the windows.
                initWindowViews();

                // Attach to the MarketsUpdated event.
                m_marketCatalog = m_TTAPI.Session.MarketCatalog;
                m_marketCatalog.MarketsUpdated += new EventHandler <MarketCatalogUpdatedEventArgs>(marketsUpdated);

                // Start the order and fill feeds so that they will be displayed in the "Market Feed Status" window.
                m_TTAPI.StartOrderFeed();
                m_TTAPI.StartFillFeed();
            }
            else
            {
                MessageBox.Show(String.Format("ConnectionStatusUpdate: {0}", e.Status.StatusMessage));
            }
        }
Example #2
0
        private void StartSubscription()
        {
            _marketCatalog = _apiInstance.Session.MarketCatalog;
            _marketCatalog.MarketsUpdated += MarketsUpdated;

            // CheckArchitecture the order and fill feeds so that they will be displayed in the "Market Feed Status" window.
            _apiInstance.StartOrderFeed();
            _apiInstance.StartFillFeed();
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Event notification for status of authentication. </summary>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        private void m_api_TTAPIStatusUpdate(object sender, TTAPIStatusUpdateEventArgs e)
        {
            statusLabel.Text = e.StatusMessage.ToString();

            if (e.IsReady)
            {
                statusLabel.Text = "APP KEY AUTHENTICATED : LOGIN SUCCESSFUL";

                // TODO: Do any connection up processing here
                //       note: can happen multiple times with your application life cycle

                // can get status multiple times - do not create subscription if it exists
                if (m_marketCatalog != null)
                {
                    return;
                }

                // Init the windows.
                initWindowViews();

                m_marketList = new List <MarketListViewItem>();

                m_instrumentCatalogList = new Dictionary <Product, InstrumentCatalog>();

                // Create the Market Catalog
                m_marketCatalog = m_api.MarketCatalog;

                listViewMarketList.Items.Clear();

                // Create a sorted list of markets objects.
                var marketList = m_api.MarketCatalog.Markets.Values.OrderBy(market => market.Name);

                foreach (Market market in marketList)
                {
                    // 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);
                    }
                }

                statusLabel.Text = "There are " + m_marketList.Count.ToString() + " Markets";
            }
            else
            {
                MessageBox.Show(String.Format("M_TTAPI_TTAPIStatusUpdate: {0}", e));
            }
        }
        /// <summary>
        /// ConnectionStatusUpdate callback.
        /// Give feedback to the user that there was an issue starting up and connecting to XT.
        /// </summary>
        void ttapiInstance_ConnectionStatusUpdate(object sender, ConnectionStatusUpdateEventArgs e)
        {
            if (e.Status.IsSuccess)
            {
                m_spreadDetailsList = new BindingList <MutableSpreadDetails>();
                dataGridViewSpreadView.DataSource        = m_spreadDetailsList;
                dataGridViewSpreadView.RowHeadersVisible = false;

                m_feedDictionary = new Dictionary <string, OrderFeed>();

                m_marketCatalog = m_TTAPI.Session.MarketCatalog;
                m_marketCatalog.MarketsUpdated += new EventHandler <MarketCatalogUpdatedEventArgs>(m_marketCatalog_MarketsUpdated);

                startSpreadDetailSubscription();
                updateSpreadDetailList();
            }
            else
            {
                MessageBox.Show(String.Format("ConnectionStatusUpdate: {0}", e.Status.StatusMessage));
            }
        }
        /// <summary>
        /// ConnectionStatusUpdate callback.
        /// Give feedback to the user that there was an issue starting up and connecting to XT.
        /// </summary>
        void ttapiInstance_ConnectionStatusUpdate(object sender, ConnectionStatusUpdateEventArgs e)
        {
            if (e.Status.IsSuccess)
            {
                m_marketList = new List<MarketListViewItem>();
                m_feedList = new List<FeedListViewItem>();

                // Multiple instruments can be opened in the propery window at the same time.
                // We need to keep track of all subscriptions to properly cleanup if needed.
                m_instrumentCatalogSubscriptionList = new Dictionary<Product, InstrumentCatalogSubscription>();

                // Init the windows.
                initWindowViews();

                // Attach to the MarketsUpdated event.
                m_marketCatalog = m_TTAPI.Session.MarketCatalog;
                m_marketCatalog.MarketsUpdated += new EventHandler<MarketCatalogUpdatedEventArgs>(marketsUpdated);

                // Start the order and fill feeds so that they will be displayed in the "Market Feed Status" window.
                m_TTAPI.StartOrderFeed();
                m_TTAPI.StartFillFeed();
            }
            else
            {
                MessageBox.Show(String.Format("ConnectionStatusUpdate: {0}", e.Status.StatusMessage));
            }
        }
        /// <summary>
        /// ConnectionStatusUpdate callback.
        /// Give feedback to the user that there was an issue starting up and connecting to XT.
        /// </summary>
        void ttapiInstance_ConnectionStatusUpdate(object sender, ConnectionStatusUpdateEventArgs e)
        {
            if (e.Status.IsSuccess)
            {
                m_spreadDetailsList = new BindingList<MutableSpreadDetails>();
                dataGridViewSpreadView.DataSource = m_spreadDetailsList;
                dataGridViewSpreadView.RowHeadersVisible = false;

                m_feedDictionary = new Dictionary<string, OrderFeed>();

                m_marketCatalog = m_session.MarketCatalog;
                m_marketCatalog.MarketsUpdated += new EventHandler<MarketCatalogUpdatedEventArgs>(m_marketCatalog_MarketsUpdated);

                startSpreadDetailSubscription();
                updateSpreadDetailList();
            }
            else
            {
                MessageBox.Show(String.Format("ConnectionStatusUpdate: {0}", e.Status.StatusMessage));
            }
        }