/// <summary> /// Loads the data file /// </summary> /// <returns>0 - success</returns> public int LoadResourceData(string data, DataPeriod period) { var dataParser = new DataParser(); int respond = -1; int parsedBars = dataParser.Parse(data, (int) period); if (parsedBars > 0) { aBar = dataParser.Bar.ToArray(); Bars = parsedBars; RefineData(); DataHorizon(); CheckMarketData(); SetDataStats(); Update = aBar[Bars - 1].Time.AddMinutes((int) period); respond = 0; } return respond; }
/// <summary> /// Loads the data file /// </summary> /// <returns>0 - success</returns> public int LoadData() { // The source data file full name string sourceDataFile = DataDir + instrProperties.BaseFileName + Period + ".csv"; // Checks the access to the file if (!File.Exists(sourceDataFile)) return 1; var sr = new StreamReader(sourceDataFile); string sData = sr.ReadToEnd(); sr.Close(); var dp = new DataParser(); int respond = -1; int parsedBars = dp.Parse(sData, Period); if (parsedBars > 0) { aBar = dp.Bar.ToArray(); Bars = parsedBars; RefineData(); DataHorizon(); CheckMarketData(); SetDataStats(); Update = aBar[Bars - 1].Time.AddMinutes(Period); respond = 0; } return respond; }