private static void LoadData(List <OhlcModel> list, string fileName)
        {
            Assembly assembly = typeof(FinancialDataModel).GetTypeInfo().Assembly;
            string   path     = "Chart.Stock.Data." + fileName + ".txt";

            using (StreamReader reader = new StreamReader(assembly.GetManifestResourceStream(path)))
            {
                string line = string.Empty;
                while (!string.IsNullOrEmpty(line = reader.ReadLine()))
                {
                    string[] values = line.Split('\t');
                    double[] args   = new double[values.Length - 1];

                    // first argument is the Date, start from the second splitted value
                    for (int i = 1; i < values.Length; i++)
                    {
                        args[i - 1] = double.Parse(values[i], CultureInfo.InvariantCulture);
                    }

                    OhlcModel model = new OhlcModel(0.5, args);
                    model.Date = DateTime.Parse(values[0], CultureInfo.InvariantCulture);

                    list.Add(model);
                }
            }
        }
예제 #2
0
 public OhlcModel(OhlcModel source, double offset)
 {
     this.date          = source.date;
     this.open          = source.open + offset;
     this.high          = source.high + offset;
     this.low           = source.low + offset;
     this.close         = source.close + offset;
     this.volume        = source.volume + offset;
     this.adjacentClose = source.adjacentClose + offset;
 }