Anonymous Anonymous - 20 days ago
459 0

No description

C#

DataLoader.cs

using Excel;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Macro_Correlation_Divergence_Arbitrage {
    class DataLoader {
        public DataSet LoadData() {
            FileStream stream = File.Open(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/Stocks.xlsx", FileMode.Open, FileAccess.Read);
            IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
            excelReader.IsFirstRowAsColumnNames = true;
            DataSet result = excelReader.AsDataSet();
            excelReader.Close();
            return result;
        }
    }
}