private SerializableReturnResult CalculateNetOfFeesReturn(
            InvestmentVehicle portfolio,
            CalculateReturnRequest request)
        {
            var result = portfolio.CalculateReturn(request, FeeType.NetOfFees);

            return(new SerializableReturnResult(result));
        }
        public IEnumerable <OmniDataFileLineModel> CreateQuarterLineModels(FeeType feeType)
        {
            var models = new List <OmniDataFileLineModel>();

            _januaryToGivenMonth.ForEachMonthInRange(
                m =>
            {
                if (m.IsLastMonthOfQuarter)
                {
                    var calculateQuarterRequest = CalculateReturnRequestFactory.ThreeMonth(m);

                    var netQuarterResult = _portfolio.CalculateReturn(calculateQuarterRequest, feeType);

                    if (!netQuarterResult.HasError)
                    {
                        models.Add(CreateQuarterModel(m, netQuarterResult, feeType));
                    }
                }
            });

            return(models);
        }
        private PerformanceReportExcelReportRecordModel CreateExcelRecord(
            InvestmentVehicle portfolio,
            MonthYear monthYear,
            FeeType feeType,
            string entityType)
        {
            var recordModel = new PerformanceReportExcelReportRecordModel()
            {
                EntityNumber = portfolio.Number,
                Name         = portfolio.Name,
                Type         = entityType,
                FeeType      = feeType.DisplayName,
            };

            var oneMonthRequest = CalculateReturnRequestFactory.OneMonth(monthYear);
            var oneMonthResult  = portfolio.CalculateReturn(oneMonthRequest, feeType);

            recordModel.OneMonth = oneMonthResult.GetValueNullOnError();

            var threeMonthRequest = CalculateReturnRequestFactory.ThreeMonth(monthYear);
            var threeMonthResult  = portfolio.CalculateReturn(threeMonthRequest, feeType);

            recordModel.ThreeMonths = threeMonthResult.GetValueNullOnError();

            var twelveMonthRequest = CalculateReturnRequestFactory.TwelveMonth(monthYear);
            var twelveMonthResult  = portfolio.CalculateReturn(twelveMonthRequest, feeType);

            recordModel.TwelveMonths = twelveMonthResult.GetValueNullOnError();

            var yearToDateRequest = CalculateReturnRequestFactory.YearToDate(monthYear);
            var yearToDateResult  = portfolio.CalculateReturn(yearToDateRequest, feeType);

            recordModel.YearToDate = yearToDateResult.GetValueNullOnError();

            return(recordModel);
        }