Beispiel #1
0
        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("计算结束");
        }
Beispiel #2
0
        private IndexState CalculateState(IndexDefinitionInfo define)
        {
            var result = IndexCalculate.GetState(define.algorithm_script, GetLastIndexData(define));

            return(result);
        }