private void UpdateTables(RefreshEventArgs e)
        {
            string msg = String.Format("{0} refreshed portfolio:", Name);

            if (e.PositionsUpdated)
            {
                UpdatePositions(m_monitorUtilities.GetCurrentPositionsForAccount(AccountName));
                msg += String.Format(" {0} positions,", m_portfolio.Count);
            }

            if (e.IndexWeightsUpdated)
            {
                UpdateIndices(m_monitorUtilities.GetIndexWeightsForAccount(AccountName));
                msg += " index weights,";
            }

            if (e.AccountsUpdated)
            {
                m_accountData = m_monitorUtilities.GetDataForAccount(AccountName);
                if (m_accountData != null)
                {
                    UpdateBenchmark(BenchmarkSymbol, m_accountData.IndexFlag ? QuoteType.Index : QuoteType.Stock);
                    msg += " account info,";
                }
            }

            if (e.TradesUpdated)
            {
                m_trades          = m_monitorUtilities.GetTradesForAccount(AccountName);
                DividendsReceived = -m_trades.Where(x => x.TradeType == "RecDiv").Sum(x => x.Change_in_Cost);
                msg += String.Format(" {0} trades,", NumberOfTrades);
            }

            if (e.SnapshotIdsUpdated)
            {
                m_snapshotIds = m_monitorUtilities.GetSnapshotsForAccount(AccountName);
                msg          += " snapshots";
            }

            PositionMonitorUtilities.Debug(msg);
            if (m_refreshEventHandler != null)
            {
                m_refreshEventHandler(this, new EventArgs());
            }
        }
        public AccountPortfolio(PositionMonitorUtilities utilities, HugoDataSet.AccountDataRow accountDataRow)
        {
            m_monitorUtilities = utilities;
            m_accountData      = accountDataRow;
            AccountName        = accountDataRow.AcctName;
            UpdateBenchmark(BenchmarkSymbol, accountDataRow.IndexFlag ? QuoteType.Index : QuoteType.Stock);

            IsStarted = false;
            QuoteServiceStoppedTime = DateTime.Now.TimeOfDay;

            m_messageUtilities1.OnInfo              += m_messageUtilities_OnInfo;
            m_messageUtilities1.OnDebug             += m_messageUtilities_OnDebug;
            m_messageUtilities1.OnError             += m_messageUtilities_OnError;
            m_messageUtilities1.OnQuote             += m_messageUtilities_OnQuote;
            m_messageUtilities1.OnSubscriberStopped += m_messageUtilities_OnReaderStopped;

            m_messageUtilities2.OnInfo              += m_messageUtilities_OnInfo;
            m_messageUtilities2.OnDebug             += m_messageUtilities_OnDebug;
            m_messageUtilities2.OnError             += m_messageUtilities_OnError;
            m_messageUtilities2.OnQuote             += m_messageUtilities_OnQuote;
            m_messageUtilities2.OnSubscriberStopped += m_messageUtilities_OnReaderStopped;
        }