public async Task <EdgarSearch> NextPageAsync() { if (NextPageUrl == null) { throw new Exception("There is not another page to request"); } string content = await SecRequestManager.Instance.SecGetAsync(NextPageUrl); EdgarSearch es = new EdgarSearch(); es.ParseFromWebHtml(content); return(es); }
public static async Task <EdgarSearch> CreateAsync(string stock_symbol, string filing_type = "", DateTime?prior_to = null, EdgarSearchOwnershipFilter ownership_filter = EdgarSearchOwnershipFilter.exclude, EdgarSearchResultsPerPage results_per_page = EdgarSearchResultsPerPage.Entries40) { EdgarSearch es = new EdgarSearch(); #region "Save search parameters" es.StockSymbol = stock_symbol; es.FilingType = filing_type; es.OwnershipFilter = ownership_filter; es.ResultsPerPage = results_per_page; #endregion #region "Construct the query URL" string URL = "https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany"; //Add the stock symbol URL = URL + "&CIK=" + stock_symbol; //Filing type? if (filing_type != "") { URL = URL + "&type=" + filing_type; } //Prior to? if (prior_to != null) { string fs = prior_to.Value.Year.ToString("0000") + prior_to.Value.Month.ToString("00") + prior_to.Value.Day.ToString("00"); URL = URL + "&dateb=" + fs; } //Edgar ownership if (ownership_filter == EdgarSearchOwnershipFilter.exclude) { URL = URL + "&owner=exclude"; } else if (ownership_filter == EdgarSearchOwnershipFilter.include) { URL = URL + "&owner=include"; } else if (ownership_filter == EdgarSearchOwnershipFilter.only) { URL = URL + "&owner=only"; } //Results per page if (results_per_page == EdgarSearchResultsPerPage.Entries10) { URL = URL + "&count=10"; } else if (results_per_page == EdgarSearchResultsPerPage.Entries20) { URL = URL + "&count=20"; } else if (results_per_page == EdgarSearchResultsPerPage.Entries40) { URL = URL + "&count=40"; } else if (results_per_page == EdgarSearchResultsPerPage.Entries80) { URL = URL + "&count=80"; } else if (results_per_page == EdgarSearchResultsPerPage.Entries100) { URL = URL + "&count=100"; } #endregion //Get web data string web = await SecRequestManager.Instance.SecGetAsync(URL); //Now load and return the data es.ParseFromWebHtml(web); return(es); }