Beispiel #1
0
        public static void ImportFileByReaderOld(string sid, string date, TextReader reader)
        {
            //string sid = file.Substring(file.LastIndexOf("\\") + 1);
            StockLog.Log.Debug(sid + " start ");
            DateTime beginning = DateTime.Now;

            BizApi.CreateDataTable(sid);
            string file = sid + "_" + date;

            try
            {
                //decimal weight = BizApi.QueryWeight(sid);
                decimal[] extractlist = BizApi.QueryExtractList(sid);
                DateTime  lastupdate  = BizApi.QueryExtractLastUpdate(sid);

                List <BasicData> list = ReadCsvByReader(sid, date, reader, extractlist, lastupdate);

                foreach (BasicData bd in list)
                {
                    //Console.WriteLine(bd.time+" "+bd.sellshare);
                    BizApi.InsertBasicData(bd);
                }
                TimeSpan end = DateTime.Now - beginning;

                StockLog.Log.Debug(file + " complete at " + end);
            }
            catch
            {
                StockLog.Log.Error(file + " import fail");
            }
        }
Beispiel #2
0
        public static void ImportFileByReader(string sid, string date, TextReader reader)
        {
            //string sid = file.Substring(file.LastIndexOf("\\") + 1);
            StockLog.Log.Debug(sid + " start ");
            DateTime beginning = DateTime.Now;

            //BizApi.CreateDataTable(sid);
            //try
            //{
            //decimal weight = BizApi.QueryWeight(sid);
            //decimal[] extractlist = BizApi.QueryExtractList(sid);
            decimal[] extractlist = new decimal[4];
            extractlist[0] = 0;
            extractlist[1] = 500;
            extractlist[2] = 1000;
            extractlist[3] = 2000;

            DateTime lastupdate = DateTime.MinValue;    //BizApi.QueryExtractLastUpdate(sid);

            List <BasicData> list = ReadCsvByReader(sid, date, reader, extractlist, lastupdate);

            foreach (BasicData bd in list)
            {
                if (bd.big == 0)
                {
                    try
                    {
                        BizApi.InsertBasicData(bd);
                    }
                    catch
                    {
                        StockLog.Log.Error(sid + " " + bd.time + " insert fail");
                    }
                    //Console.WriteLine(sid + " insert " + bd.time + " " + bd.big);
                }
                else
                {
                    //Console.WriteLine(sid + " update " + bd.time + " " + bd.big);

                    try
                    {
                        BizApi.UpdateBasicDataForBigDeal(bd);
                    }
                    catch
                    {
                        StockLog.Log.Error(sid + " " + bd.time + " update fail");
                    }
                }
            }
            TimeSpan end = DateTime.Now - beginning;

            //StockLog.Log.Debug(sid + " complete at " + end);
            //}
            //catch
            //{
            //    StockLog.Log.Error(sid + " import fail");
            //}
        }
Beispiel #3
0
        public static void ImportFileByReader(string sid, string date, TextReader reader)
        {
            //string sid = file.Substring(file.LastIndexOf("\\") + 1);
            StockLog.Log.Debug(sid + " start ");
            DateTime beginning = DateTime.Now;

            //BizApi.CreateDataTable(sid);
            //try
            //{
            //decimal weight = BizApi.QueryWeight(sid);
            decimal[] ext_list    = BizApi.QueryExtractList(sid);
            decimal[] extractlist = new decimal[ext_list.Length + 1];

            for (int i = 0; i < ext_list.Length; i++)
            {
                extractlist[i] = ext_list[i];
            }
            extractlist[ext_list.Length] = 0;
            //decimal[] extractlist = new decimal[4];
            //extractlist[0] = 0;
            //extractlist[1] = 500;
            //extractlist[2] = 1000;
            //extractlist[3] = 2000;
            try
            {
                if (sid == "sh600048")
                {
                    StockLog.Log.Debug(sid + " complete at ");
                }
                DateTime lastupdate = BizApi.QueryExtractLastUpdate(sid);

                List <BasicData> list = ReadCsvByReader(sid, date, reader, extractlist, lastupdate);

                foreach (BasicData bd in list)
                {
                    BizApi.InsertBasicData(bd);
                }
                TimeSpan end = DateTime.Now - beginning;

                StockLog.Log.Debug(sid + " complete at " + end);
            }
            catch (Exception e)
            {
                StockLog.Log.Error(sid + " import fail");
            }
        }