public void SubmissionByAccessNumber_Success() { SECApi api = new SECApi(); string cik = ConfigurationManager.AppSettings["SEC_CIK_AAPL"]; string accessNum = ConfigurationManager.AppSettings["SEC_CIK_AAPL_SUBMISSION_FOLDER"]; Submission submission = api.ArchivesEdgarDataCIKSubmission(cik, accessNum); Assert.AreNotEqual(submission, null, "Submission is NULL"); Assert.AreEqual(submission.Name, accessNum, "Invalid submission name"); Assert.IsTrue(submission.Files.Count > 0, "List of files is EMPTY"); }
public void SubmissionByAccessNumber_Success() { SECApi api = new SECApi(); IConfiguration config = GetConfiguration(); string cik = config.GetValue(typeof(string), "SEC_CIK_AAPL").ToString(); string accessNum = config.GetValue(typeof(string), "SEC_CIK_AAPL_SUBMISSION_FOLDER_20170701").ToString(); Submission submission = api.ArchivesEdgarDataCIKSubmission(cik, accessNum); Assert.AreNotEqual(submission, null, "Submission is NULL"); Assert.AreEqual(submission.Name, accessNum, "Invalid submission name"); Assert.IsTrue(submission.Files.Count > 0, "List of files is EMPTY"); }
public ISourceExtractResult ExtractReports(ISourceExtractParams extractParams) { SECSourceExtractResult result = new SECSourceExtractResult(); SECSourceExtractParams extractSECParams = extractParams as SECSourceExtractParams; if (extractSECParams != null) { string cik = _dictionary.LookupRegulatorCompanyCode(extractSECParams.RegulatorCode, extractSECParams.CompanyCode); // TODO: lookup in dictionary if (!string.IsNullOrEmpty(cik)) { foreach (var filing in extractSECParams.Items) { // getting list of files for each filing Submission submission = _secApi.ArchivesEdgarDataCIKSubmission(cik, filing.Name); if (submission != null) { foreach (var fileInfo in submission.Files) { // to speed up we need to extract only xml files and index headers file if (Path.GetExtension(fileInfo.Name) == ".xml" || fileInfo.Name.Contains(".txt")) { SubmissionFile file = _secApi.ArchivesEdgarDataCIKSubmissionFile(cik, filing.Name, fileInfo.Name); if (file != null) { SECSourceItem sourceItem = new SECSourceItem(); sourceItem.Name = fileInfo.Name; sourceItem.FilingName = filing.Name; sourceItem.CompanyCode = extractSECParams.CompanyCode; sourceItem.RegulatorCode = extractSECParams.RegulatorCode; sourceItem.Content = file.Content; result.Items.Add(sourceItem); } } } // saving all uploaded items to storage PutToStorage(result.Items); } else { result.AddError(EErrorCodes.ImporterError, EErrorType.Warning, string.Format("Failed to import filing {0}", filing.Name)); } } result.Success = true; } else { result.Success = false; result.AddError(EErrorCodes.InvalidParserParams, EErrorType.Error, string.Format("Cannot find the SEC CIK for company with code {0}", extractSECParams.CompanyCode)); } } else { result.Success = false; result.AddError(EErrorCodes.InvalidParserParams, EErrorType.Error, "Parameters of invalid type were provided"); } return(result); }