Example #1
0
 public FileArrModel(MasterPointModel master, bool flag)
 {
     Tiker = master.Tiker;
     Fname = master.FName;
     SDate = master.SDate;
     EDate = master.EDate;
     Work  = flag;
 }
Example #2
0
        private void LoadFile(string FName, string Tiker, string Scale)
        {
            string[]         _data;
            MasterPointModel CPModel = new MasterPointModel
            {
                Tiker = Tiker,
                FName = Path.GetFileName(FName),
                Data  = new List <DateModel>()
            };

            CPModel.Data.Add(new DateModel());
            CPModel.Data[0].Scale  = Scale;
            CPModel.Data[0].Points = new List <PointModel>();


            if (!File.Exists(FName))
            {
                throw new FileNotFoundException();
            }

            StreamReader reader = new StreamReader(FName, Encoding.Default);

            while (!reader.EndOfStream)
            {
                _data = reader.ReadLine().Split(';');
                if (Double.TryParse(_data[6] /*.Replace(".", ",")*/, out double i) == true)
                {
                    CPModel.Data[0].Points.Add(new PointModel()
                    {
                        Open  = Convert.ToDouble(_data[4] /*.Replace(".", ",")*/),
                        High  = Convert.ToDouble(_data[5] /*.Replace(".", ",")*/),
                        Low   = Convert.ToDouble(_data[6] /*.Replace(".", ",")*/),
                        Close = Convert.ToDouble(_data[7] /*.Replace(".", ",")*/),
                        Vol   = Convert.ToDouble(_data[8]),
                        Date  = Convert.ToDateTime(_data[2] + " " + _data[3])
                    });
                }
                else
                {
                    //MessageBox.Show("!");
                }
            }
            CPModel.SDate = CPModel.Data[0].Points.First().Date;
            CPModel.EDate = CPModel.Data[0].Points.Last().Date;

            CPModel_.Add(CPModel);
        }
Example #3
0
        public List <PointModel> GetMasterPoint(string scale, string tiker)
        {
            MasterPointModel tmp = CPModel_.Find(i => i.Tiker == tiker);

            return(tmp.Data[0].Points);
        }