private static List <OhlcModel> LoadData() { var list = new List <OhlcModel>(); Assembly assembly = typeof(ExampleViewModel).GetTypeInfo().Assembly; string path = "Chart.Interactivity.Data.MSFT.csv"; using (StreamReader reader = new StreamReader(assembly.GetManifestResourceStream(path))) { //skip header reader.ReadLine(); string line = string.Empty; while (!string.IsNullOrEmpty(line = reader.ReadLine())) { string[] values = line.Split(','); 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); } } return(list); }
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; }