public void Execute(IJobExecutionContext context) { LoggingExtensions.Logging.Log.InitializeWith <LoggingExtensions.log4net.Log4NetLog>(); var cateService = new StockCategoryService(); var stockService = new StockService(); var cycleType = this.CycleType; IList <stockcategory> cateList = cateService.FindAll(); foreach (var category in cateList) { IList <stock> stockList = stockService.GetStockByCategory(category.code); foreach (var stock in stockList) { IList <PriceInfo> priceList = stockService.GetPriceInfo(stock.code, cycleType); this.Log().Error("开始计算股票技术指数:" + stock.name + ",Code:" + stock.code); var tech = new TechCalculate(ObjectType.Stock, cycleType, stock.code, priceList); tech.Run(); this.Log().Error("计算结束:" + stock.name); Thread.Sleep(100); } } }
public void Execute(IJobExecutionContext context) { IStockCategoryService categoryService = new StockCategoryService(); //导入行情分类的组 IStockSync sync = new StockSync_Tencent(); data.stock_category_group categoryGroup = sync.initCategoryGroup(); categoryService.AddCategoryGroup(categoryGroup); //导入行情分类 IList <data.stockcategory> cateList = sync.GetCategorys(); foreach (data.stockcategory sc in cateList) { if (string.IsNullOrEmpty(sc.code) || string.IsNullOrEmpty(sc.name)) { continue; } if (categoryService.Find(sc.code) == null) { categoryService.Add(sc); this.Log().Info("导入行业:" + sc.name); } } //遍历类别,导入股票 IStockService stockService = new StockService(); IList <data.stockcategory> cateList2 = categoryService.GetCategoryList(categoryGroup.code); foreach (data.stockcategory cate in cateList2) { IList <data.stock> stockLIst = sync.GetStocks(cate); if (stockLIst == null || stockLIst.Count == 0) { continue; } foreach (data.stock s in stockLIst) { s.stock_category_map.Add(new stock_category_map { cate_code = cate.code, stock_code = s.code, stock_name = s.name }); if (stockService.Find(s.code) == null) { stockService.Add(s); } else { stockService.Update(s); } this.Log().Info("导入股票:" + s.name); } } this.Log().Info("导入完成"); }
public void Execute(IJobExecutionContext context) { var cateService = new StockCategoryService(); var cycleType = this.CycleType; IList <stockcategory> cateList = cateService.GetCategoryList("tencent"); foreach (var category in cateList) { var priceList = cateService.GetPriceInfo(category.code, cycleType); this.Log().Error("开始计算行业技术指数:" + category.name + ",Code:" + category.code); var tech = new TechCalculate(ObjectType.Category, cycleType, category.code, priceList); tech.Run(); this.Log().Error("开始计算:" + category.name + ",Code:" + category.code); } }
public void Execute(IJobExecutionContext context) { LoggingExtensions.Logging.Log.InitializeWith <LoggingExtensions.log4net.Log4NetLog>(); var cateService = new StockCategoryService(); var stockService = new StockService(); string type = this.CycleType; if (string.IsNullOrEmpty(type)) { this.Log().Error("周期类型cycle参数为设置"); return; } var cycleType = (TechCycle)Enum.Parse(typeof(TechCycle), type, true); string code = string.IsNullOrEmpty(this.ObjectCode) ? "0600015" : this.ObjectCode; IList <PriceInfo> priceList = stockService.GetPriceInfo(code, cycleType); this.Log().Error("开始计算股票技术指数"); string algorithm_script = File.ReadAllText(string.Format(@"Script\{0}.js", this.TechName.Trim())); string contextNew = ""; IndexCalculate.IsDebugg = true; //计算技术数据 IList <IndexData> result = IndexCalculate.GetIndexData(algorithm_script, "{}", "", out contextNew, priceList); //技术形态 var stateResult = IndexCalculate.GetState(algorithm_script, result); var tagReuslt = IndexCalculate.GetTag(algorithm_script, result); this.Log().Info("计算结果:" + this.TechName + ":" + stateResult); this.Log().Error("计算结束"); }