public async Task ProcessFilings(FilingProcessCommandArgs commandLineArgs) { Console.WriteLine("Retrieving panel of reporters"); FFIECPublicWebService.RetrievalService proxy = GetRetrievalServiceProxy(commandLineArgs); int[] rssds = proxy.RetrieveFilersSinceDate(FFIECPublicWebService.ReportingDataSeriesName.Call, commandLineArgs.ReportingCycleEndDate, FilingProcessorProfile.FiledSinceDate); Console.WriteLine("Retrieved filers for reporting cycle {0} who filed since {1}.", commandLineArgs.ReportingCycleEndDate, FilingProcessorProfile.FiledSinceDate); foreach (int rssd in rssds) { Console.WriteLine("Processing ID_RSSD: " + rssd); var reportingInstitution = await ReportingInstitutionTable.Where(riItem => riItem.ID_RSSD == rssd).ToListAsync(); // Should be rare, but if this is a new reporting institution then add it if (reportingInstitution.Count == 0) { // ToDo: Because we only get back rssds (not full ReportingFinancialInstitution // record) you will need to find out how to fetch a single // ReportingFinancialInstitution record that corresponds to rssd so we can add // it to our cached table } var filings = await FilingTable.Where(f => f.ID_RSSD == rssd && f.ReportingCycleEndDate == commandLineArgs.ReportingCycleEndDate).ToListAsync(); // If this is a new filing record then add it if (filings.Count == 0) { CallReporter.Model.Filing filing = new CallReporter.Model.Filing() { ID_RSSD = rssd, ReportingCycleEndDate = commandLineArgs.ReportingCycleEndDate }; await FilingTable.InsertAsync(filing); await AlertInterestedParties(filing); } } // Update the FiledSinceDate now that we have successfully processed the filings // ToDo: Uncomment this line when you are done finished testing //FilingProcessorProfile.FiledSinceDate = DateTime.Now.ToString("MM/dd/yyyy"); await FilingProcessorProfileTable.UpdateAsync(FilingProcessorProfile); Console.WriteLine("Panel of reporters retrieved, press any key to finish"); Console.ReadLine(); }
FFIECPublicWebService.RetrievalService GetRetrievalServiceProxy(FilingProcessCommandArgs commandLineArgs) { FFIECPublicWebService.RetrievalService proxy = new FFIECPublicWebService.RetrievalService(); UsernameToken userToken = new UsernameToken(commandLineArgs.Credentials.UserName, commandLineArgs.Credentials.Password, PasswordOption.SendHashed); proxy.RequestSoapContext.Security.Tokens.Add(userToken); return(proxy); }
static FilingProcessCommandArgs ProcessCommandLineArgs(string[] args) { FilingProcessCommandArgs result = new FilingProcessCommandArgs(); // ToDo: This is just temporary command line arg processing. Need to implement // proper processing later that allows for optional and named command line arguments result.Credentials = new Credentials(args[0], args[1]); result.ReportingCycleEndDate = (args.Length >= 3) ? args[2] : null; result.LoadReportingInstitutions = (args.Length >= 4 && args[3].ToLower() == "/l") ? true : false; return(result); }
static void Main(string[] args) { FilingProcessCommandArgs commandLineArgs = Program.ProcessCommandLineArgs(args); FilingProcessor.Core.FilingProcessor filingProcessor = new FilingProcessor.Core.FilingProcessor(); // If LoadReportingInstitutions command line arg was specified then load/update if (commandLineArgs.LoadReportingInstitutions) { filingProcessor.LoadReportingInstitutions(commandLineArgs).Wait(); } filingProcessor.LoadReportingInstitutions(commandLineArgs); filingProcessor.ProcessFilings(commandLineArgs).Wait(); }
/// <summary> /// method usage of the web service method RetrievePanelOfReporters /// Clients should call this method to obtain a list of all financial institutions who filed Call Report /// for a particular reporting period. This method should typically be called once or infrequently to obtain /// the complete list of banks in the PoR. Subsequently, the web clients should call RetrieveFilersSinceDate /// to find out the list of banks that have filed their original or amended Call Reports. async public void LoadReportingInstitutions(FilingProcessCommandArgs commandLineArgs) { FFIECPublicWebService.ReportingDataSeriesName dsName = FFIECPublicWebService.ReportingDataSeriesName.Call; FFIECPublicWebService.RetrievalService proxy = new FFIECPublicWebService.RetrievalService(); UsernameToken userToken = new UsernameToken(commandLineArgs.Credentials.UserName, commandLineArgs.Credentials.Password, PasswordOption.SendHashed); proxy.RequestSoapContext.Security.Tokens.Add(userToken); proxy.Timeout = 400000; FFIECPublicWebService.ReportingFinancialInstitution[] reporters = proxy.RetrievePanelOfReporters(dsName, commandLineArgs.ReportingCycleEndDate); Console.WriteLine("OK" + "Retrieved panel of reporters. "); foreach (FFIECPublicWebService.ReportingFinancialInstitution reporter in reporters) { Console.WriteLine("Adding " + reporter.Name.Trim() + "|" + reporter.ID_RSSD + "|" + reporter.State + "|" + reporter.HasFiledForReportingPeriod); var reportingInstitution = await ReportingInstitutionTable.Where(riItem => riItem.ID_RSSD == reporter.ID_RSSD).ToListAsync(); if (reportingInstitution.Count == 0) { CallReporter.Model.ReportingFinancialInstitution newInstitution = new CallReporter.Model.ReportingFinancialInstitution(); // ToDo: Put assignment in its own method, create assignment operators newInstitution.Address = reporter.Address; newInstitution.City = reporter.City; newInstitution.FDICCertNumber = reporter.FDICCertNumber; newInstitution.FilingType = reporter.FilingType; newInstitution.HasFiledForReportingPeriod = reporter.HasFiledForReportingPeriod; newInstitution.ID_RSSD = reporter.ID_RSSD; newInstitution.Name = reporter.Name; newInstitution.OCCChartNumber = reporter.OCCChartNumber; newInstitution.OTSDockNumber = reporter.OTSDockNumber; newInstitution.PrimaryABARoutNumber = reporter.PrimaryABARoutNumber; newInstitution.State = reporter.State; newInstitution.ZIP = reporter.ZIP; await ReportingInstitutionTable.InsertAsync(newInstitution); } else { await UpdateAsync(ReportingInstitutionTable, reportingInstitution[0], reporter); } } Console.WriteLine("OK" + "Total members of POR = " + reporters.Length.ToString()); }
/// <summary> /// This method demonstrates the usage of the web service method RetrieveFilersSinceDate /// Clients should call this method to keep up to date with the filings/ammendments filed by financial institutions /// after a given date/time until now. /// </summary> public void GetFilers(FilingProcessCommandArgs commandLineArgs) { FFIECPublicWebService.RetrievalService proxy = GetRetrievalServiceProxy(commandLineArgs); int[] rssds = proxy.RetrieveFilersSinceDate(FFIECPublicWebService.ReportingDataSeriesName.Call, commandLineArgs.ReportingCycleEndDate, FilingProcessorProfile.FiledSinceDate); Console.WriteLine("Retrieved filers for reporting cycle {0} who filed since {1}.", commandLineArgs.ReportingCycleEndDate, FilingProcessorProfile.FiledSinceDate); foreach (int rssd in rssds) { Console.WriteLine("OK" + "ID_RSSD: " + rssd); } }