Exemplo n.º 1
0
        public void ParseAllFunds()
        {
            var parser = new ExcelParser("etfbook.xlsx", 0, new EtfConverterFactory());

            var funds = parser.Parse();

            var fundsRepository = new FundRepository();

            fundsRepository.AddOrUpdate(funds);
        }
Exemplo n.º 2
0
        public void ParseAllFunds()
        {
            var fundsRepository = new FundRepository();

            fundsRepository.AddOrUpdate(_allFunds);
        }
Exemplo n.º 3
0
        public void GetAllIndexesDetails()
        {
            var fundRepository = new FundRepository();
            var fundsLinks = this.etfsec.GetFundsLinks();
            foreach (var fundLink in fundsLinks.Take(5))
            {
                var singleFund = this.etfsec.GetSingleFundMainPageByLinkAsXElement(SingleFundUrl);
                var parser = GetSectionParser.GetDetailsParser(singleFund);
                var indexPage = EtfSecurities.GetDetailsBySingleFundElement(parser, SingleFundUrl, EtfSecurities.DetailsSection.Index);
                var detailsXElement = EtfSecurities.GetDetailsByPage(indexPage);
                var etfConverter = new EtfConverter();
                EtfSecurities.ExtractFromPropertiesFromTrs(etfConverter, detailsXElement.Descendants("tr"));
                var fund = etfConverter.Convert();
                fund.FundUrl = fundLink;

                fundRepository.AddOrUpdate(fund);
            }
        }
Exemplo n.º 4
0
        public void GetFullFund()
        {
            var fundRepository = new FundRepository();
            var fundsLinks = this.etfsec.GetFundsLinks();
            foreach (var fundLink in fundsLinks)
            {
                try
                {
                    if(fundRepository.GetByFundUrl(fundLink)!=null)
                        continue;

                    //var etfConverter = new EtfConverter();
                    var etfConverter = this.etfsec.GetSingleFundByLink(fundLink);

                    var fund = etfConverter.Convert();
                    //fund.FundUrl = fundLink;

                    var sb = new StringBuilder();
                    sb.AppendLine("Not defined attributes: ");
                    EtfConverter.Attributes.Except(etfConverter.EtfFund.Keys).ForEach(x => sb.Append(x + "; "));
                    sb.AppendLine();
                    etfConverter.EtfFund.ForEach(x => sb.AppendLine(x.Key + " : " + x.Value));
                    sb.AppendLine("Fund url :" + etfConverter.FundUrl);
                    sb.AppendLine("Fund postdata :" + etfConverter.FundPostData);

                    var indexOfLastBackslash = fundLink.LastIndexOf('/');
                    var fileName = "Results/" + fundLink.Substring(indexOfLastBackslash + 1) + ".xml";
                    File.WriteAllText(fileName, sb.ToString());

                    fundRepository.AddOrUpdate(fund);
                }
                catch
                {

                }
            }

            //Assert.IsTrue(fundRepository.GetFunds().Count > 100, "Initial set is not parsed");
            Assert.IsTrue(fundRepository.GetFunds().Count > 200, "Full set is not parsed");
        }
Exemplo n.º 5
0
        public void FullParseTests()
        {
            var fundRepository = new FundRepository();
            var fundsLinks = this.etfsec.GetFundsLinks();

            foreach (var fundsLink in fundsLinks)
            {
                var etfConverter = this.etfsec.GetSingleFundByLink(fundsLink);

                fundRepository.AddOrUpdate(etfConverter.Convert());
            }
        }