Ejemplo n.º 1
0
        //
        //
        /// <summary>
        /// Must be called by Gui thread.
        /// </summary>
        private void UpdateMarket()
        {
            int selectedIndex = listBoxInstruments.SelectedIndex;

            if (selectedIndex >= 0 && selectedIndex < listBoxInstruments.Items.Count)
            {
                string instrName = (string)listBoxInstruments.SelectedItem;
                Book   aBook;
                if (m_Market.TryEnterReadBook(out aBook))
                {
                    int instrID = -1;
                    foreach (UV.Lib.BookHubs.Market mkt in aBook.Instruments.Values)
                    {
                        if (instrName.Equals(mkt.Name.FullName))
                        {
                            instrID = mkt.ID;
                            break;
                        }
                    }
                    if (instrID >= 0)
                    {
                        txtInstrumentName.Text = aBook.Instruments[instrID].Name.FullName;
                        txtBidSide.Text        = aBook.Instruments[instrID].Price[0][0].ToString();
                        txtAskSide.Text        = aBook.Instruments[instrID].Price[1][0].ToString();
                        txtBidQty.Text         = aBook.Instruments[instrID].Qty[0][0].ToString();
                        txtAskQty.Text         = aBook.Instruments[instrID].Qty[1][0].ToString();
                    }
                    m_Market.ExitReadBook(aBook);
                }
            }
        }