public ModelManager( GlobeTraverser traverser, ModelBuilder modelBuilder, TaxonomyToModelTransformer taxonomyToModelTransformer, BaseValueInitializer baseValueInitializer, BenchmarkValueInitializer benchmarkValueInitializer, OverlayInitializer overlayInitializer, PortfolioAdjustmentInitializer portfolioAdjustmentInitializer, ModelToJsonSerializer breakdownSerializer, ModelFromJsonDeserializer breakdownDeserializer, RepositoryManager repositoryManager, Overlaying.OverlayManager overlayManager, MissingCountriesDetector countriesDetector, ModelApplier modelApplier, ModelChangeDetector changeDetector ) { this.Traverser = traverser; this.modelBuilder = modelBuilder; this.taxonomyTransformer = taxonomyToModelTransformer; this.baseValueInitializer = baseValueInitializer; this.benchmarkValueInitializer = benchmarkValueInitializer; this.overlayInitializer = overlayInitializer; this.portfolioAdjustmentInitializer = portfolioAdjustmentInitializer; this.breakdownSerializer = breakdownSerializer; this.breakdownDeserializer = breakdownDeserializer; this.repositoryManager = repositoryManager; this.overlayManager = overlayManager; this.countriesDetector = countriesDetector; this.modelApplier = modelApplier; this.changeDetector = changeDetector; }
public Computations CreateComputations(GlobeModel root, GlobeTraverser traverser) { var computations = new Computations(); computations.BaseActiveFormula = this.CreateBaseActiveFormula(); var portfolioAdjustmentTotal = computations.PortfolioAdjustmentTotal = root.PortfolioAdjustment; var baseWherePortfoioAdjustmentSetTotal = computations.BaseWherePortfoioAdjustmentSetTotal = this.CreateBaseWherePortfoioAdjustmentSetTotal(traverser, root); computations.BaseLessOverlayFormula = this.CreateBaseLessOverlayFormula( this.CreateRescaledBaseFormula( computations.BaseWherePortfoioAdjustmentSetTotal, computations.PortfolioAdjustmentTotal ) ); computations.CashBase = this.CreateBaseForCash(this.CreateBaseForCashFormula(root)); computations.CashRescaledBase = this.CreateRescaledBaseForCash(this.CreateRescaledBaseForCashFormula(computations.CashBase, baseWherePortfoioAdjustmentSetTotal, portfolioAdjustmentTotal)); computations.BaseLessOverlayPositiveTotal = this.CreateBaseLessOverlayPositiveTotalExpression(root, traverser, computations.BaseLessOverlayFormula, computations.CashRescaledBase); computations.BaseLessOverlayTotal = this.CreateBaseLessOverlayTotalExpression(root, traverser, computations.BaseLessOverlayFormula, computations.CashRescaledBase); computations.PortfolioScaledFormula = this.CreatePortfolioScaledFormula(computations.BaseLessOverlayFormula, computations.BaseLessOverlayPositiveTotal, computations.BaseLessOverlayTotal); computations.CashPortfolioScaled = this.CreateScaledCash(this.CreateCashScaledFormula(computations.CashRescaledBase, computations.BaseLessOverlayPositiveTotal, computations.BaseLessOverlayTotal)); computations.TrueExposureFormula = this.CreateTrueExposureFormula(); computations.TrueActiveFormula = this.CreateTrueActiveFormula(); return(computations); }
public OverlayInitializer( GlobeTraverser traverser, TargetsFlattener targetsFlattener ) { this.traverser = traverser; this.targetsFlattener = targetsFlattener; }
/// <summary> /// Sum of the base values of the records that have their portfolio adjustment values set. /// </summary> public IExpression <Decimal?> CreateBaseWherePortfoioAdjustmentSetTotal(GlobeTraverser traverser, GlobeModel root) { var result = new Expression <Decimal?>( ValueNames.BaseWherePortfolioAdjustmentSetTotal, new Computing.BaseWherePortfoioAdjustmentSetTotalFormula(root, traverser), this.commonParts.NullableDecimalValueAdapter, this.commonParts.ValidateWhatever ); return(result); }
public ModelFromJsonDeserializer( ExpressionPicker picker, ModelBuilder modelBuilder, GlobeTraverser traverser, ExpressionFromJsonDeserializer expressionDeserializer ) { this.picker = picker; this.modelBuilder = modelBuilder; this.traverser = traverser; this.expressionDeserializer = expressionDeserializer; }
public IExpression <Decimal?> CreateBaseLessOverlayTotalExpression( GlobeModel root, GlobeTraverser traverser, IModelFormula <IModel, Decimal?> baseLessOverlayFormula, IExpression <Decimal?> cashRescaledBase ) { var models = traverser.TraverseGlobe(root); var result = new Expression <Decimal?>( ValueNames.BaseLessOverlayTotal, new BaseLessOverlayTotalFormula( models, baseLessOverlayFormula, cashRescaledBase ), this.commonParts.NullableDecimalValueAdapter, this.commonParts.ValidateWhatever ); return(result); }
protected void RegisterMissingCountriesIfAny(ManagingBpt.RootModel result, Computations computations, CountryRepository countryRepository, TargetingType targetingType, SecurityRepository securityRepository, PortfolioRepository portfolioRepository, ManagingPst.PortfolioSecurityTargetRepository portfolioSecurityTargetRepository, IEnumerable <BenchmarkSumByIsoInfo> benchmarks) { // figuring out missing ISO country codes (if any) from benchmarks and overlays var missingCountriesIsoCodes = this.countriesDetector.FindMissingCountries( targetingType.Taxonomy, benchmarks, result.Factors.Items.Where(x => x.OverlayFactor.EditedValue.HasValue).Select(x => x.BottomUpPortfolio.Name), portfolioSecurityTargetRepository, portfolioRepository, securityRepository ); if (missingCountriesIsoCodes.Any()) { List <string> clearedMissingCountriesIsoCode; var traverser = new GlobeTraverser(); var otherModel = traverser.TraverseGlobe(result.Globe).Where(m => m.TryAsOther() != null).FirstOrDefault(); if (otherModel != null) { clearedMissingCountriesIsoCode = new List <string>(); var codesInModel = otherModel.TryAsOther().UnsavedBasketCountries.Select(b => b.Country.IsoCode).Union(otherModel.TryAsOther().BasketCountries.Select(b => b.Basket.Country.IsoCode)); clearedMissingCountriesIsoCode.AddRange(codesInModel.Except(missingCountriesIsoCodes)); } else { clearedMissingCountriesIsoCode = new List <string>(missingCountriesIsoCodes); } if (clearedMissingCountriesIsoCode.Any()) { // there are some missing ISO country codes // we need to resolve them to countries // and put these countries to the taxonomy var missingCountries = clearedMissingCountriesIsoCode.Select(x => countryRepository.GetCountry(x)); this.RegisterMissingCountries(result, missingCountries, computations); } } }
public BenchmarkValueInitializer(GlobeTraverser traverser) { this.traverser = traverser; }
public ModelExpressionTraverser(GlobeTraverser traverser) { this.traverser = traverser; }
public PortfolioAdjustmentInitializer(GlobeTraverser traverser) { this.traverser = traverser; }
public TraverseOnceResolved_IRegionModelResidentResolver(GlobeTraverser traverser) { this.traverser = traverser; }
public TraverseOnceResolved_IBreakdownModelResidentResolver(GlobeTraverser traverser) { this.traverser = traverser; }
public ModelValidator(GlobeTraverser traverser) { this.tarverser = traverser; }