Ejemplo n.º 1
0
        private void Verify(string filename)
        {
            if (!filename.EndsWith(".csv"))
            {
                throw new Exception("I expect a csv file");
            }
            VerificationReport report = new VerificationReport();

            report.Verified = Verifier.VerifySequentiality(filename);
            string reportFileName = filename.Replace(".csv", ".xml");

            Console.WriteLine("Creating report with SequentialityOk = {0} in {1}", report.Verified, reportFileName);
            report.SaveToFile(reportFileName);
        }
Ejemplo n.º 2
0
 private void VerifyOldFiles(SeriesDescriptor seriesDescriptor)
 {
     seriesDescriptor.InstrumentDescriptors.ForEach(instrumentDescriptor => {
         instrumentDescriptor.ProviderDescriptors.ForEach(providerDescriptor => {
             // si no tiene VerificationReport, lo verifico
             Directory.GetFiles(providerDescriptor.Path, "*.csv").ToList().ForEach(csvFileName => {
                 string reportFileName     = csvFileName.Replace(".csv", ".xml");
                 VerificationReport report = VerificationReport.LoadFromFile(reportFileName);
                 if (report == null || !report.Verified)
                 {
                     Verify(csvFileName);
                 }
             });
         });
     });
 }
Ejemplo n.º 3
0
 private void Convert(string providerPath)
 {
     Directory.GetFiles(providerPath, "*.xml").ToList().ForEach(reportFile => {
         string dataFile = reportFile.Replace(".xml", ".csv");
         if (File.Exists(dataFile))
         {
             VerificationReport verificationReport = VerificationReport.LoadFromFile(reportFile);
             if (verificationReport.Verified && !verificationReport.TransformationCompleted)
             {
                 ISeriesConverter converter     = new SeriesConverter();
                 QuotesProcessor processor      = new QuotesProcessor(providerPath);
                 RawDataInformation information = RawDataInformation.FromPath(reportFile);
                 Console.WriteLine("Creating prices from {0}", dataFile);
                 converter.ImportQuotes(dataFile, processor, information.Begin, information.End);
                 verificationReport.TransformationCompleted = true;
                 verificationReport.SaveToFile(reportFile);
             }
         }
         else
         {
             Console.WriteLine("{0} file does not exist!", dataFile);
         }
     });
 }