Example #1
0
        public void _01_ETF50Tests()
        {
            var htmlService       = new HtmlService();
            var instrumentService = new InstrumentService(htmlService);
            var etf50Insts        = instrumentService.GetInstruments(SinaInstrumentCategory.Index.Index_Sh_50).Take(10);

            // Category
            var categService = new CategorizationService(htmlService);
            var categorizes  = new HashSet <string>();

            foreach (var inst in etf50Insts)
            {
                var cates = categService.GetCateogories(inst.SymbolShort);
                foreach (var cate in cates)
                {
                    categorizes.Add(cate);
                }
                inst.AsDynamic().Categories = cates;
            }

            // Equity structure
            var structureService = new EquityStructureService(htmlService);

            foreach (var inst in etf50Insts)
            {
                var structure = structureService.GetEquityStructure(inst.SymbolShort);
                inst.AsDynamic().EquityStructure = structure;
            }

            var str = JsonUtil.Serialize(etf50Insts);
        }
Example #2
0
        public void _02_CategorizationServiceTest()
        {
            var html       = new HtmlService();
            var service    = new CategorizationService(html);
            var categories = service.GetCateogories("600519");

            Assert.IsTrue(categories.Count() > 0);
        }