Exemplo n.º 1
0
 /// <summary>
 /// Update the future economic data field besides the release date and release time.
 /// </summary>
 private void UpdateFutureEconomicData()
 {
     // The future data is first listened to and so they need to be updated finally.
     foreach (string ticker in m_EconomicDataManager.EconomicDataSeriesByTicker.Keys)
     {
         // Find all the points in series that have date in the future and do the change accordingly.
         EconomicDataSeries dataSeries = m_EconomicDataManager.EconomicDataSeriesByTicker[ticker];
         foreach (string date in dataSeries.EconomicDataPointByDate.Keys)
         {
             if (Functions.StringToDateTime(date) < DateTime.Now)
             {
                 continue;
             }
             else
             {
                 EconomicDataPoint dataPoint = dataSeries.EconomicDataPointByDate[date];
                 m_EconomicDataManager.UpdateFutureDataPoint(dataPoint);
             }
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Add the packaged future economic data point from listeners to the corresponding ticker economic data series.
        /// </summary>
        /// <param name="economicDataPoint"></param>
        public void AddFutureEconomicPoint(EconomicDataPoint economicDataPoint)
        {
            // Future listen is the first to be launched, so instantiate the data series in the dictionary.
            EconomicDataSeries economicDataSeries = new EconomicDataSeries();
            string             ticker             = economicDataPoint.Ticker;

            // Add the economic data series object to the corresponding ticker series dictionary.
            if (!m_EconomicDataSeriesByTicker.ContainsKey(ticker))
            {
                m_EconomicDataSeriesByTicker.TryAdd(ticker, economicDataSeries);

                // Set the writer manager for that ticker. It is ensured to only set once.
                economicDataSeries.SetWriter(m_Writer);
            }

            // Add economic data point to corresponding economic data series.
            m_EconomicDataSeriesByTicker.TryGetValue(ticker, out economicDataSeries);
            if (DateInRange(economicDataPoint.Date))
            {
                economicDataSeries.AddFutureEconomicPoint(economicDataPoint);
            }
        }