コード例 #1
0
        private IList <TaskMessage> ComputeStockState(Task.Interface.IMessageSender sender)
        {
            this.Log().Info("开始计算个股形态");
            IList <stockcategory> cateList = cateService.FindAll();


            IList <TaskMessage> msgList = new List <TaskMessage>();

            TechCycle[] cycleList = new TechCycle[] { TechCycle.day, TechCycle.week, TechCycle.month };
            foreach (var category in cateList)
            {
                IList <stock> stockList = stockService.GetStockByCategory(category.code);

                foreach (var stock in stockList)
                {
                    this.Log().Info("计算股票:" + stock.name);

                    foreach (var cycle in cycleList)
                    {
                        var task1 = new IndexTask
                        {
                            type  = ObjectType.Stock,
                            code  = stock.code,
                            cycle = cycle
                        };
                        sender.Send(JsonConvert.SerializeObject(task1));
                        Thread.Sleep(100);
                    }
                }
            }

            //string[] list = new string[] { "0600265" };
            //foreach (var code in list)
            //{
            //    foreach (var cycle in cycleList)
            //    {
            //        var task1 = new IndexTask
            //        {
            //            type = ObjectType.Stock,
            //            code = code,
            //            cycle = cycle
            //        };
            //        sender.Send(JsonConvert.SerializeObject(task1));
            //    }
            //}

            return(msgList);
        }
コード例 #2
0
        private void ComputeCategoryState(Task.Interface.IMessageSender sender)
        {
            IList <stockcategory> cateList = cateService.FindAll();

            TechCycle[] cycleList = new TechCycle[] { TechCycle.day, TechCycle.week, TechCycle.month };
            this.Log().Info("开始计算行业形态");
            foreach (var category in cateList)
            {
                this.Log().Info("计算行业:" + category.name);

                foreach (var cycle in cycleList)
                {
                    var task1 = new IndexTask
                    {
                        type  = ObjectType.Category,
                        code  = category.code,
                        cycle = cycle
                    };
                    sender.Send(JsonConvert.SerializeObject(task1));
                    Thread.Sleep(100);
                }
            }
        }
コード例 #3
0
        private void ComputeMarketState(Task.Interface.IMessageSender sender)
        {
            var objList = objService.FindAll();

            TechCycle[] cycleList = new TechCycle[] { TechCycle.day, TechCycle.week, TechCycle.month };

            this.Log().Info("开始计算大盘形态");
            foreach (var obj in objList)
            {
                this.Log().Info("计算大盘:" + obj.name);

                foreach (var cycle in cycleList)
                {
                    var task1 = new IndexTask
                    {
                        type  = ObjectType.Object,
                        code  = obj.code,
                        cycle = cycle
                    };
                    sender.Send(JsonConvert.SerializeObject(task1));
                    Thread.Sleep(100);
                }
            }
        }