Beispiel #1
0
        //同步股票数据
        //2018-03-14 Reviewed
        private void SyncData()
        {
            //更新进度
            int statusNum = 0;

            //删除已有股票
            StockSQL.DeleteStock();
            this.btn_syncData.Enabled = false;

            foreach (object obj in filelist)
            {
                statusNum++;
                string filename = (string)obj;

                StockData stock = new StockData();
                stock.Init(filename);
                UtilLog.AddInfo(TAG, "Start to analyse " + stock.code + ";");
                StockAttribute attri = new StockAttribute(stock);
                StockKPI       kpi   = new StockKPI(stock);

                if (!stock.IsValid())
                {
                    UtilLog.AddInfo(TAG, statusNum + "/" + filelist.Count + "  " + stock.code + " skipped");
                }
                else
                {
                    attri.InitAttribute();
                    kpi.InitKPI();

                    StockSQL.InsertStockWithItem(stock);
                    UtilLog.AddInfo(TAG, statusNum + "/" + filelist.Count + "  " + stock.code + " initialization finished");
                }
                int status = statusNum * 100 / filelist.Count;
                if (statusNum % 100 == 0)
                {
                    GC.Collect();
                }
                prog.SetProgress(status);
            }
            StockData.SetStockFull();
            StockDapan.InsertStockDaPan();
            this.btn_syncData.Enabled = true;
        }
Beispiel #2
0
 public StockAttribute UpdateStockAttribute(StockAttribute stockAttribute)
 {
     return(_stockAttributes.Update(stockAttribute));
 }
Beispiel #3
0
 public StockAttribute AddStockAttribute(StockAttribute stockAttribute)
 {
     return(_stockAttributes.Add(stockAttribute));
 }
 public static StockAttribute ToModel(StockAttributeDTO d)
 {
     return(StockAttribute.New(d.Id, d.StockId, d.AttributeId, d.AsOf));
 }
 public static StockAttributeDTO FromModel(StockAttribute m)
 {
     return(new StockAttributeDTO(m.Id, m.StockId, m.AttributeId, m.AsOf));
 }