private bool UpdateIndices(HugoDataSet.IndexWeightsRow[] rows)
        {
            try
            {
                List <HugoDataSet.IndicesRow> subscribeList = new List <HugoDataSet.IndicesRow>();

                lock (m_portfolioLock)
                {
                    m_indexWeights = rows;
                    foreach (HugoDataSet.IndexWeightsRow indexWeightsRow in rows)
                    {
                        HugoDataSet.IndicesRow indicesRow = m_indices.Rows.Find(new string[] { indexWeightsRow.AcctName, indexWeightsRow.Symbol }) as HugoDataSet.IndicesRow;
                        if (indicesRow == null)
                        {
                            indicesRow          = m_indices.NewIndicesRow();
                            indicesRow.AcctName = indexWeightsRow.AcctName;
                            indicesRow.Symbol   = indexWeightsRow.Symbol;
                            m_indices.Rows.Add(indicesRow);
                        }

                        indicesRow.Weight    = indexWeightsRow.Weight;
                        indicesRow.IndexFlag = indexWeightsRow.IndexFlag;

                        if (IsSubscribed && (indicesRow.SubscriptionStatus != SubscriptionStatus.Subscribed.ToString()))
                        {
                            indicesRow.SubscriptionStatus = SubscriptionStatus.Subscribed.ToString();
                            subscribeList.Add(indicesRow);
                        }
                    }
                }

                if (IsSubscribed)
                {
                    if (subscribeList.Count > 0)
                    {
                        foreach (HugoDataSet.IndicesRow row in subscribeList)
                        {
                            QuoteType quoteType = row.IndexFlag ? QuoteType.Index : QuoteType.Stock;
                            m_messageUtilities2.Subscribe(row.Symbol, quoteType, row);
                            PositionMonitorUtilities.Info(String.Format("{0} now subscribed to {1} as {2}", Name, row.Symbol, quoteType.ToString()));
                        }
                        PositionMonitorUtilities.Info(String.Format("{0} subscribed to {1} new indices", Name, subscribeList.Count));
                    }
                }
            }
            catch (Exception ex)
            {
                PositionMonitorUtilities.Error(String.Format("{0} unable to fill indices table", Name), ex);
                return(false);
            }
            return(true);
        }
        private bool UpdateBenchmark(string symbol, QuoteType quoteType)
        {
            try
            {
                if (!String.IsNullOrEmpty(symbol))
                {
                    if (symbol == "SPXT")
                    {
                        symbol = "SPX";
                    }

                    bool subscribe = false;
                    HugoDataSet.IndicesRow benchmarkRow = null;
                    lock (m_portfolioLock)
                    {
                        benchmarkRow = m_indices.Rows.Find(new string[] { AccountName, symbol }) as HugoDataSet.IndicesRow;
                        if (benchmarkRow == null)
                        {
                            benchmarkRow           = m_indices.NewIndicesRow();
                            benchmarkRow.AcctName  = AccountName;
                            benchmarkRow.Symbol    = symbol;
                            benchmarkRow.IndexFlag = (quoteType == QuoteType.Index);
                            m_indices.Rows.Add(benchmarkRow);
                        }
                        if (IsSubscribed && (benchmarkRow.SubscriptionStatus != SubscriptionStatus.Subscribed.ToString()))
                        {
                            benchmarkRow.SubscriptionStatus = SubscriptionStatus.Subscribed.ToString();
                            subscribe = true;
                        }
                    }

                    if (subscribe)
                    {
                        m_messageUtilities1.Subscribe(benchmarkRow.Symbol, quoteType, benchmarkRow);
                        PositionMonitorUtilities.Info(String.Format("{0} now subscribed to {1} as benchmark", Name, benchmarkRow.Symbol));
                    }
                }
            }
            catch (Exception ex)
            {
                PositionMonitorUtilities.Error(String.Format("{0} unable to subscribe to benchmark {1}", Name, symbol), ex);
                return(false);
            }
            return(true);
        }