Exemple #1
0
        private static TickData ReadLinesToTickData(string[] lines)
        {
            TickData data = new TickData(lines.Length - 1);

            for (int i = 0; i < lines.Length - 1; i++)
            {
                String line = lines[i];
                if (line.Equals(""))
                {
                    continue;
                }
                String[] dataArr = line.Split(',');
                if (dataArr.Length < 5)
                {
                    continue;
                }
                data.arr_time[i]       = double.Parse(dataArr[0]);
                data.arr_price[i]      = float.Parse(dataArr[1]);
                data.arr_mount[i]      = int.Parse(dataArr[2]);
                data.arr_totalMount[i] = int.Parse(dataArr[3]);
                data.arr_add[i]        = int.Parse(dataArr[4]);
                data.arr_buyPrice[i]   = (int)float.Parse(dataArr[5]);
                data.arr_buyMount[i]   = int.Parse(dataArr[6]);
                data.arr_sellPrice[i]  = (int)float.Parse(dataArr[7]);
                data.arr_sellMount[i]  = int.Parse(dataArr[8]);
                data.arr_isBuy[i]      = dataArr[9].Equals("1");
            }
            return(data);
        }
Exemple #2
0
        public TickData SubData(int start, int end)
        {
            TickData data = this;
            TickData d1   = new TickData(end - start + 1);

            for (int i = start; i <= end; i++)
            {
                d1.arr_time[i - start]       = data.arr_time[i];
                d1.arr_price[i - start]      = data.arr_price[i];
                d1.arr_mount[i - start]      = data.arr_mount[i];
                d1.arr_totalMount[i - start] = data.arr_totalMount[i];
                d1.arr_add[i - start]        = data.arr_add[i];
                d1.arr_buyPrice[i - start]   = data.arr_buyPrice[i];
                d1.arr_buyMount[i - start]   = data.arr_buyMount[i];
                d1.arr_sellPrice[i - start]  = data.arr_sellPrice[i];
                d1.arr_sellMount[i - start]  = data.arr_sellMount[i];
                d1.arr_isBuy[i - start]      = data.arr_isBuy[i];
            }
            return(d1);
        }
Exemple #3
0
        private static TickData ReadLinesToTickData_OrignalFormat(string code, string[] lines)
        {
            int      cnt  = GetEmptyLines(lines);
            TickData data = new TickData(lines.Length - 1 - cnt);

            data.Code = code.ToUpper();
            for (int i = 0; i < lines.Length - 1 - cnt; i++)
            {
                String line = lines[i + 1];
                if (line.Equals(""))
                {
                    continue;
                }
                String[] dataArr = line.Split(',');
                if (dataArr.Length < 5)
                {
                    continue;
                }

                String[] dateArr  = dataArr[0].Split('-');
                double   date     = double.Parse(dateArr[0] + dateArr[1] + dateArr[2]);
                String[] timeArr  = dataArr[1].Split(':');
                double   time     = double.Parse(timeArr[0] + timeArr[1] + timeArr[2]);
                double   fulltime = date + time / 1000000;

                data.arr_time[i]       = fulltime;
                data.arr_price[i]      = float.Parse(dataArr[2]);
                data.arr_mount[i]      = int.Parse(dataArr[3]);
                data.arr_totalMount[i] = int.Parse(dataArr[4]);
                data.arr_add[i]        = int.Parse(dataArr[5]);
                data.arr_buyPrice[i]   = (int)float.Parse(dataArr[6]);
                data.arr_buyMount[i]   = int.Parse(dataArr[7]);
                data.arr_sellPrice[i]  = (int)float.Parse(dataArr[12]);
                data.arr_sellMount[i]  = int.Parse(dataArr[13]);
                data.arr_isBuy[i]      = dataArr[18].Equals("B");
            }
            return(data);
        }