MarketData ReadPivotMarketData(DateTime startDate, DateTime endDate)
 {
     MarketData md = new MarketData(startDate, endDate, _mdPivot.Ticker);
     DateTime curDate = startDate;
     while (curDate <= endDate)
     {
         if (_mdPivot.IsExistDate(curDate))
         {
             DOHLC dohlc = _mdPivot.GetData(curDate);
             md.AddDatum(dohlc);
         }
         curDate = curDate.AddDays(1);
     }
     return md;
 }
        void LoadEquityPriceDataFromDB()
        {
            foreach (string keyString in Enum.GetNames(typeof(KospiEquityDataKey)))
            {
                MarketDataSetKey key = (MarketDataSetKey)Enum.Parse(typeof(MarketDataSetKey), keyString, true);
                try
                {
                    MarketData dbMarketData = DataUtil.GetKeyMarketData(
                        key, EquityVolPredefinedVariables.ReadStartDate, EquityVolPredefinedVariables.ReadEndDate);
                    if (dbMarketData.GetTotalCount() == 0)
                    {
                        continue;
                    }

                    DateTime readStartDate = dbMarketData.GetByIndex(0).CurDate;
                    DateTime readEndDate = dbMarketData.GetByIndex((int)dbMarketData.GetTotalCount() - 1).CurDate;
                    string ticker = DataUtil.GetTickerFromMarketDataKey(key);

                    MarketData md = new MarketData(readStartDate, readEndDate, ticker);
                    for (int i = 0; i < dbMarketData.GetTotalCount(); i++)
                    {
                        DOHLC dohlc = dbMarketData.GetByIndex(i);
                        DateTime curDate = dohlc.CurDate;
                        if (curDate.DayOfWeek == DayOfWeek.Saturday
                            || curDate.DayOfWeek == DayOfWeek.Sunday)
                        {
                            continue;
                        }
                        md.AddDatum(dohlc);
                    }

                    MarketData mdKospi = ReadPivotMarketData(md.StartDate, md.EndDate);
                    List<MarketData> output =
                        DataUtil.FillByPivotData(mdKospi, new List<MarketData> { md });
                    _priceData.Add(key, output[0]);
                }
                catch (Exception ex)
                {
                    logger.Warn(ex.ToString());
                }
            }
        }