Example #1
0
        void LoadExcelData()
        {
            ExcelReader exr = new ExcelReader();
            exr.KeepConnectionOpen = false;
            exr.ExcelFilename = _fileName;
            exr.Headers = true;
            exr.SheetName = _sheetName;
            exr.SetPrimaryKey(0);
            DataTable dt = exr.GetTable();

            foreach (DataRow row in dt.Rows)
            {
                DateTime curDate = Convert.ToDateTime(row[0]);
                double k = Convert.ToDouble(row[1]);
                double b = Convert.ToDouble(row[2]);
                double d = Convert.ToDouble(row[3]);

                this._adjs.Add(curDate, new Tuple<double, double, double>(k * _kospiWeight, b, d));
            }
        }
Example #2
0
        public Boolean LoadDataFromExcel()
        {
            ExcelReader exr = new ExcelReader();
            exr.KeepConnectionOpen = false;
            exr.ExcelFilename = "..\\..\\ExcelData\\BokRate.xlsx";
            exr.Headers = true;
            exr.SheetName = "Sheet1";
            exr.SetPrimaryKey(0);
            DataTable dt = exr.GetTable();

            foreach (DataRow row in dt.Rows)
            {
                DateTime curDate = Convert.ToDateTime(row[0]);
                double rate = Convert.ToDouble(row[1]);
                _data.Add(new Tuple<DateTime, double>(curDate, rate));
            }

            return true;
        }
Example #3
0
        public Boolean LoadDataFromExcel()
        {
            ExcelReader exr = new ExcelReader();
            exr.KeepConnectionOpen = false;
            exr.ExcelFilename = "..\\..\\ExcelData\\ConsumerPriceIndex.xlsx";
            exr.Headers = true;
            exr.SheetName = "Sheet1";
            exr.SetPrimaryKey(0);
            DataTable dt = exr.GetTable();

            MarketData mdPivot = null;

            foreach (DataRow row in dt.Rows)
            {
                string strDate = Convert.ToString(row[0]);

                DateTime curDate = DateTime.ParseExact(strDate, "yyyy-MM", null);
                if (mdPivot == null)
                {
                    mdPivot = DataUtil.GetKeyMarketData(MarketDataSetKey.KospiFuture, curDate, DateTime.Now);
                }
                curDate = curDate.AddMonths(1).AddDays(-1); //월 데이터의 날짜는 월 마지막 날로 설정
                curDate = DataUtil.GetLastTradingDay(mdPivot, curDate); // 월말이 주말인 경우 마지막 금요일로 변환

                double value = Convert.ToDouble(row[1]);
                _data.Add(new Tuple<DateTime, double>(curDate, value));
            }

            return true;
        }
        public Boolean LoadDataFromExcel()
        {
            ExcelReader exr = new ExcelReader();
            exr.KeepConnectionOpen = true;
            exr.ExcelFilename = "..\\..\\ExcelData\\StockPerFinanceAsset.xlsx";
            exr.Headers = true;
            exr.SheetName = "Sheet1";
            exr.SetPrimaryKey(0);
            DataTable dt = exr.GetTable();

            foreach (DataRow row in dt.Rows)
            {
                DateTime curDate = GetDateTimeFromQuarterDate(Convert.ToString(row[0]));
                //double deposit = Convert.ToDouble(row[1]);
                //double credit = Convert.ToDouble(row[2]);
                double rate = Convert.ToDouble(row[3]);

                _data.Add(new Tuple<DateTime, double>(curDate, rate));
            }

            return true;
        }
Example #5
0
        public Boolean LoadDataFromExcel()
        {
            ExcelReader exr = new ExcelReader();
            exr.KeepConnectionOpen = false;
            exr.ExcelFilename = "..\\..\\BokRate\\BokRate.xlsx";
            exr.Headers = true;
            exr.SheetName = "Sheet1";
            exr.SetPrimaryKey(0);
            DataTable dt = exr.GetTable();

            foreach (DataRow row in dt.Rows)
            {
                String raw = Convert.ToString(row[0]);
                DateTime curDate = DateTime.ParseExact(raw.Substring(0, 10), "yyyy MM dd", null);
                double rate = Convert.ToDouble(raw.Substring(11));
                _data.Add(new Tuple<DateTime, double>(curDate, rate));
            }

            return true;
        }