public static JArray GetArrayQuotations(string path, DateTime dateBegin, DateTime dateEnd)
        {
            CultureInfo.CurrentCulture = new CultureInfo("ru-RU");

            var quotationsCsv = FinanceApi.GetFinanceQuotations(dateBegin, dateEnd);

            Converter.ConvertCsvToXlsx(quotationsCsv, path);
            var quotations = Converter.ConvertCsvToListQuotation(quotationsCsv);

            for (int i = 0; i < quotations.Count; i++)
            {
                var valCurs = CbrApi.GetValCursUsd(quotations[i].DateQuotation);
                quotations[i].ChangeCurrencyToRub(valCurs);
            }

            JArray jArray = Converter.ConvertListQuotationToJArray(quotations);

            return(jArray);
        }
Example #2
0
        public void TestFinanceApi()
        {
            string quotationsCsv = FinanceApi.GetFinanceQuotations(new DateTime(2020, 12, 14), new DateTime(2020, 12, 15));

            Assert.AreEqual(2, quotationsCsv.Split('\n').Length);
        }