private static BelStockArchiveLine ToBelStockArchiveDate(IGrouping <DateTime, BelStockArchiveOneCurrencyDay> day)
        {
            var belStockDay = new BelStockArchiveLine()
            {
                Date = day.Key, Timestamp = $"{day.Key:dd.MM.yyyy}"
            };

            var usd = day.FirstOrDefault(l => l.Currency == Currency.Usd);

            if (usd == null)
            {
                return(belStockDay);
            }
            belStockDay.UsdTurnover = usd.TurnoverInCurrency;
            belStockDay.UsdRate     = usd.TurnoverInByn / usd.TurnoverInCurrency;

            var euro = day.FirstOrDefault(l => l.Currency == Currency.Eur);

            belStockDay.EuroTurnover = euro?.TurnoverInByn / belStockDay.UsdRate ?? 0;
            belStockDay.EuroRate     = euro?.TurnoverInByn / euro?.TurnoverInCurrency ?? 0;

            var rub = day.FirstOrDefault(l => l.Currency == Currency.Rub);

            belStockDay.RubTurnover = rub?.TurnoverInByn / belStockDay.UsdRate ?? 0;
            belStockDay.RubRate     = rub?.TurnoverInByn / rub?.TurnoverInCurrency * 100 ?? 0;

            return(belStockDay);
        }
        private static BelStockArchiveLine ToBelStockArchiveDayOfMonth(IGrouping <string, BelStockArchiveLine> days)
        {
            var belStockMonth = new BelStockArchiveLine()
            {
                Timestamp = days.Key
            };

            belStockMonth.UsdTurnover  = days.Sum(d => d.UsdTurnover) / days.Count();
            belStockMonth.EuroTurnover = days.Sum(d => d.EuroTurnover) / days.Count();
            belStockMonth.RubTurnover  = days.Sum(d => d.RubTurnover) / days.Count();
            return(belStockMonth);
        }
        private static BelStockArchiveLine ToBelStockArchiveMonth(IGrouping <string, BelStockArchiveLine> days)
        {
            var belStockMonth = new BelStockArchiveLine()
            {
                Timestamp = days.Key
            };

            belStockMonth.UsdTurnover = days.Sum(d => d.UsdTurnover);
            var usdTurnoverInByn = days.Sum(d => d.UsdRate * d.UsdTurnover);

            belStockMonth.UsdRate = usdTurnoverInByn / belStockMonth.UsdTurnover;

            belStockMonth.EuroTurnover = days.Sum(d => d.EuroTurnover);
            var euroTurnoverInByn = days.Sum(d => d.EuroRate * d.EuroTurnover);

            belStockMonth.EuroRate = euroTurnoverInByn / belStockMonth.EuroTurnover;

            belStockMonth.RubTurnover = days.Sum(d => d.RubTurnover);
            var rubTurnoverInByn = days.Sum(d => d.RubRate * d.RubTurnover);

            belStockMonth.RubRate = rubTurnoverInByn / belStockMonth.RubTurnover;

            return(belStockMonth);
        }