static async Task GetPressReleaseData(Filing filing) { var apiParams = new PressReleaseSearchParams() { CompaniesParameters = new CompaniesParameters() { companyIdentifiers = new[] { filing.ticker } }, PeriodParameters = new PeriodParameters() { Period = (Period)filing.fiscal_period, Year = filing.fiscal_year, }, PageParameters = new PressReleaseParams() { MatchToPreviousPeriod = true, StandardizeBOPPeriods = true } }; var response = await calcbenchClient.PostAsJsonAsync("api/pressReleaseData", apiParams); response.EnsureSuccessStatusCode(); var filingDataPonts = await response.Content.ReadAsAsync <IEnumerable <PressReleaseDataPoint> >(); foreach (var item in filingDataPonts) { Console.WriteLine($"{item.Label}, {item.EffectiveValue}"); // database.writeDatapoint(filingDataPoint); } }
public void Setup() { // Mock _configuration = new Mock <IConfiguration>(MockBehavior.Loose); _filingRepo = new Mock <IFilingRepo>(MockBehavior.Loose); _logger = new Mock <ILogger <FilingController> >(MockBehavior.Loose); // Mapper var config = new MapperConfiguration(cfg => { cfg.AddProfile(new AutoMapperConfig()); }); _mapper = new Mapper(config); // Config Filler <Filing> pFiller = new Filler <Filing>(); Filler <FilingDTO> pFillerDTO = new Filler <FilingDTO>(); filing = pFiller.Create(); filingDTO = pFillerDTO.Create(); // Service under test _filingController = new FilingController(_configuration.Object, _mapper, _filingRepo.Object, _logger.Object); }
public ActionResult Create(FilingDTO filing) { MethodBase method = MethodBase.GetCurrentMethod(); try { Filing newAction = Mapper.Map <Filing>(filing); newAction.IsValid = true; newAction.Id = 0; var response = FilingRepo.Create(newAction); if (response > 0) { CreateLog(Enums.Success, GetMethodCode(method), LogLevel.Information); return(Ok(response)); } else { CreateLog(Enums.BadRequest, GetMethodCode(method), LogLevel.Warning); return(BadRequest(response)); } } catch (Exception ex) { return(HandleError(ex.Message, GetMethodCode(method))); } }
public async Task ReportedFinancialsTest(string symbol, Filing filing, TimeSeries timeSeries = null) { var response = await sandBoxClient.StockFundamentals.ReportedFinancialsAsync(symbol, filing, timeSeries); Assert.IsNull(response.ErrorMessage); foreach (var data in response.Data) { Assert.IsNotNull(data); Assert.IsNotNull(data.AccountsPayableCurrent); } }
public bool AddFiling(FilingDataObject filing) { Filing entity = this.filingRepository.Create(); entity = DyMapper.Map(filing, entity); entity.Involved = this.filingRepository.Context.DoGet <Involved>(p => p.ID == filing.InvolvedID).FirstOrDefault(); entity.SceneRecord = this.filingRepository.Context.DoGet <SceneRecord>(p => p.ID == filing.SceneRecordID).FirstOrDefault(); entity.AskRecord = this.filingRepository.Context.DoGet <AskRecord>(p => p.ID == filing.AskRecordID).FirstOrDefault(); this.filingRepository.Add(entity); return(this.filingRepository.Commit() > 0); }
public FilingDataObject UpdateFiling(FilingDataObject filing) { Filing entity = this.filingRepository.FindByID(filing.ID); entity = DyMapper.Map(filing, entity); entity.Involved = this.filingRepository.Context.DoGet <Involved>(p => p.ID == filing.InvolvedID).FirstOrDefault(); entity.SceneRecord = this.filingRepository.Context.DoGet <SceneRecord>(p => p.ID == filing.SceneRecordID).FirstOrDefault(); entity.AskRecord = this.filingRepository.Context.DoGet <AskRecord>(p => p.ID == filing.AskRecordID).FirstOrDefault(); this.filingRepository.Update(entity); this.filingRepository.Commit(); return(DyMapper.Map <Filing, FilingDataObject>(entity)); }
/// <summary> /// Called by the form, to do some start up stuff. /// </summary> public void Startup() { try { Filing.DoMaintinence(); LoadedCardResources.LoadResources(); this.SetupForm(); VariableStorage.TheForm.Text = VariableStorage.GetRandomTitle(); } catch (Exception TheException) { ErrorReporter.Report(TheException); } }
internal void Parse(Filing filing, string url) { Stream fileStream = Ftp.GetFileStream(url); var xmlString = StreamUtil.ReadText(fileStream); XDocument infoTable = GetInfoTable(xmlString); if (infoTable == null) { Console.WriteLine($"No Info table found for F13 Filing at {url}"); } ; ProcessInfoTable(infoTable, filing); }
private void ProcessFiling(HedgeFund hedgeFund, MasterIndexEntry indexEntry) { Filing filing = _db.Filings.SingleOrDefault(f => f.Url == indexEntry.Url); if (filing == null) { filing = AddFiling(hedgeFund, indexEntry); new F13FilingParser().Parse(filing, indexEntry.Url); } else { Console.WriteLine($"{indexEntry.FormType} filing for {indexEntry.CompanyName} has already been captured, moving on."); Console.WriteLine(""); } }
public long Create(Filing entity) { entity.Id = 0; entity.IsValid = true; if (entity.AuditId == 0) { entity.AuditId = GenerateAudit(null); } if (entity.CorrespondenceTypeId > 0) { entity.Consecutive = GenerateConsecutive(entity.CorrespondenceTypeId); } _context.Filings.Add(entity); _context.SaveChanges(); return(entity.Id); }
private Share ProccessShare(InfoTableItem infoTableItem, Filing filing) { Share share = null; var securityHelper = new SecurityHelper(); Security security = FindSecurity(infoTableItem.NameOfIssuer, infoTableItem.Cusip); if (security != null) { security = securityHelper.SaveSecurity(security); securityHelper.SaveSecurityMap(security, infoTableItem.Cusip); share = AddShare(infoTableItem, filing.FilingId, security.SecurityId); } else { securityHelper.AddUnknownShare(infoTableItem, filing.FilingId); } return(share); }
private void ProcessInfoTable(XDocument infoTable, Filing filing) { string nameSpace = "{" + infoTable.Root.Elements().FirstOrDefault().Name.NamespaceName + "}"; IEnumerable <XElement> infoTableElements = infoTable.Root.Elements(); infoTableElements = infoTableElements as XElement[] ?? infoTableElements.ToArray(); Console.WriteLine($"Processing: {infoTableElements.Count()} elements"); var i = 0; const int parts = 8; ParallelQuery <IEnumerable <XElement> > splits = infoTableElements.AsParallel().GroupBy(item => i++ % parts).Select(part => part.AsEnumerable()); Task[] tasks = splits.Select(elements => Task.Factory.StartNew(() => ProcessShareBatch(elements, nameSpace, filing))).ToArray(); Task.WaitAll(tasks); Console.WriteLine("Finished writing to DB"); Console.WriteLine(""); }
private Filing AddFiling(HedgeFund hedgeFund, MasterIndexEntry indexEntry) { Filing filing = _db.Filings.SingleOrDefault(r => r.Url == indexEntry.Url); if (filing == null) { FormType formType = _db.FormTypes.SingleOrDefault(f => f.Name == "13F-HR"); filing = new Filing { HedgeFund = hedgeFund, FormType = formType, Date = indexEntry.DateFiled, Url = indexEntry.Url, MasterIndexId = indexEntry.MasterIndexId }; _db.Filings.Add(filing); _db.SaveChanges(); } return(filing); }
public ActionResult Delete(FilingDTO filing) { MethodBase method = MethodBase.GetCurrentMethod(); try { if (filing.Id > 0) { Filing delAction = Mapper.Map <Filing>(filing); FilingRepo.Delete(delAction); CreateLog(Enums.Success, GetMethodCode(method), LogLevel.Information); return(Ok(true)); } else { CreateLog(Enums.BadRequest, GetMethodCode(method), LogLevel.Information); return(BadRequest()); } } catch (Exception ex) { return(HandleError(ex.Message, GetMethodCode(method))); } }
/// <param name='id'> /// Required. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> public async Task <HttpOperationResponse <Filing> > DeleteWithOperationResponseAsync(int id, CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // Tracing bool shouldTrace = ServiceClientTracing.IsEnabled; string invocationId = null; if (shouldTrace) { invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary <string, object> tracingParameters = new Dictionary <string, object>(); tracingParameters.Add("id", id); ServiceClientTracing.Enter(invocationId, this, "DeleteAsync", tracingParameters); } // Construct URL string url = ""; url = url + "/2016/Filing/"; url = url + Uri.EscapeDataString(id.ToString()); string baseUrl = this.Client.BaseUri.AbsoluteUri; // Trim '/' character from the end of baseUrl and beginning of url. if (baseUrl[baseUrl.Length - 1] == '/') { baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); } if (url[0] == '/') { url = url.Substring(1); } url = baseUrl + "/" + url; url = url.Replace(" ", "%20"); // Create HTTP transport objects HttpRequestMessage httpRequest = new HttpRequestMessage(); httpRequest.Method = HttpMethod.Delete; httpRequest.RequestUri = new Uri(url); // Set Credentials if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (shouldTrace) { ServiceClientTracing.SendRequest(invocationId, httpRequest); } cancellationToken.ThrowIfCancellationRequested(); HttpResponseMessage httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); if (shouldTrace) { ServiceClientTracing.ReceiveResponse(invocationId, httpResponse); } HttpStatusCode statusCode = httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); if (statusCode != HttpStatusCode.OK) { HttpOperationException <object> ex = new HttpOperationException <object>(); ex.Request = httpRequest; ex.Response = httpResponse; ex.Body = null; if (shouldTrace) { ServiceClientTracing.Error(invocationId, ex); } throw ex; } // Create Result HttpOperationResponse <Filing> result = new HttpOperationResponse <Filing>(); result.Request = httpRequest; result.Response = httpResponse; // Deserialize Response if (statusCode == HttpStatusCode.OK) { Filing resultModel = new Filing(); JToken responseDoc = null; if (string.IsNullOrEmpty(responseContent) == false) { responseDoc = JToken.Parse(responseContent); } if (responseDoc != null) { resultModel.DeserializeJson(responseDoc); } result.Body = resultModel; } if (shouldTrace) { ServiceClientTracing.Exit(invocationId, result); } return(result); }
private void ProcessShareBatch(IEnumerable <XElement> elements, string nameSpace, Filing filing) { foreach (XElement element in elements) { var infoTableItem = new InfoTableItem(element, nameSpace); ProccessShare(infoTableItem, filing); } }
private void linkLabel8_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Filing f = new Filing(); f.Endorsement.DocketType = DOCKET_TYPES.DEED; }
public void Update(Filing entity) { _context.Entry(entity).State = EntityState.Modified; _context.SaveChanges(); }
public void Delete(Filing entity) { _context.Filings.Remove(entity); _context.SaveChanges(); }
private static void InsertFilings(IEnumerable <CIKInfo> cikInfos) { string baseUrl = "https://www.sec.gov"; List <SECFilingInfo> filings = new List <SECFilingInfo>(); foreach (var cik in cikInfos) { SECFilingInfo filingInfo = new SECFilingInfo { CompanyInfo = cik, Filings = new List <Filing>() }; Console.WriteLine("Downloading Ticker={0}, CIK={1}", cik.Ticker, cik.CIK); string downloadFile = GetSECFilling(cik, ReportType.Annual); string path = string.Format("{0}\\{1}_{2}", downloadReportFolder, cik.Ticker, cik.CIK); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } XElement xml = XElement.Load(downloadFile); //TODO: all entry and go through each entry to store info IEnumerable <XElement> entries = xml.Descendants().Where(x => x.Name.LocalName.Equals("entry")); Parallel.ForEach(entries, (entry) => { Filing filing = new Filing(); var href = entry.Descendants().Where(x => x.Name.LocalName.Equals("filing-href")).FirstOrDefault(); filing.fileNumber = entry.Descendants().Where(x => x.Name.LocalName.Equals("file-number")).FirstOrDefault().Value.Trim(); filing.fileNumberHref = entry.Descendants().Where(x => x.Name.LocalName.Equals("file-number-href")).FirstOrDefault().Value.Trim(); filing.FilingDate = entry.Descendants().Where(x => x.Name.LocalName.Equals("filing-date")).FirstOrDefault().Value.Trim(); filing.FilingHref = entry.Descendants().Where(x => x.Name.LocalName.Equals("filing-href")).FirstOrDefault().Value.Trim(); filing.FilingType = entry.Descendants().Where(x => x.Name.LocalName.Equals("filing-type")).FirstOrDefault().Value.Trim(); string filePath = string.Format("{0}\\{1}_{2}.htm", path, filing.FilingDate, filing.FilingType.Replace("\\", "").Replace("/", "")); filing.DownloadReportPath = filePath; filing.DownloadStatus = "Success"; if (File.Exists(filePath)) { Console.WriteLine("File={0} already existed!!!", filePath); } else { //get content from filing_href string content = DownloadContent(href.Value); //search content from report Regex regex = new Regex("Archives(.)*10(.){0,4}k(.){0,20}.htm\">", RegexOptions.Singleline); Match result = regex.Match(content); if (result.Value.Length < 10) { Console.WriteLine("UNABLE TO FIND FILING REPORT!!!"); filing.DownloadStatus = "Fail"; } else { string reportHref = result.Value.Substring(0, result.Value.IndexOf("\">", 0)); string reportUrl = string.Format("{0}/{1}", baseUrl, reportHref); filing.ReportOriginalUrl = reportUrl; DownloadContentToFile(reportUrl, filePath); } } lock (filingInfo) { filingInfo.Filings.Add(filing); } }); lock (filings) { filings.Add(filingInfo); } } string json = JsonConvert.SerializeObject(filings, Newtonsoft.Json.Formatting.Indented); string summaryPath = string.Format("{0}\\{1}_summary.json", downloadReportFolder, DateTime.Now.ToString("yyyyMMdd")); File.WriteAllText(summaryPath, json); SECFilingCollection repo = new SECFilingCollection(); Task.Run(async() => { await repo.MongoInsert(filings); }).GetAwaiter().GetResult(); }
public async Task <IEXResponse <IEnumerable <ReportedFinancialResponse> > > ReportedFinancialsAsync(string symbol, Filing filing = Filing.Quarterly, TimeSeries timeSeries = null) { const string urlPattern = "time-series/reported_financials/[symbol]/[filing]"; var qsb = new QueryStringBuilder(); timeSeries?.AddTimeSeriesQueryParams(qsb); var pathNvc = new NameValueCollection { { "symbol", symbol }, { "filing", filing.GetDescriptionFromEnum() } }; return(await executor.ExecuteAsync <IEnumerable <ReportedFinancialResponse> >(urlPattern, pathNvc, qsb)); }