Ejemplo n.º 1
0
        private IncreaseModelBase CalculateIncreaseModel(IEnumerable <DebtModelBase> models)
        {
            models = models.OrderBy((debt) => debt.Time).ToList();
            List <DebtModelBase> modelsList = models.ToList();

            double predictedValue = PredictValue(modelsList);

            DebtModelBase higher = models.Last();
            DebtModelBase lower  = models.First();

            double increment = CalculateOneSecondIncrement(higher, lower);

            IncreaseModelBase model = new IncreaseModelBase
            {
                Time     = DateTime.Now,
                Debt     = predictedValue,
                Increase = increment
            };

            return(model);
        }
        public InternalIncreaseModel ConvertInternalFromBaseModel(IncreaseModelBase model)
        {
            InternalIncreaseModel internalModel = new InternalIncreaseModel(model.Time, model.Debt, model.Increase);

            return(internalModel);
        }
        public ExternalIncreaseModel ConvertExternalFromBaseModel(IncreaseModelBase model)
        {
            ExternalIncreaseModel externalModel = new ExternalIncreaseModel(model.Time, model.Debt, model.Increase);

            return(externalModel);
        }