public BasketCountryModel CreateBasketCountryModel( ManagingBaskets.CountryBasket basket, Computations computations, EditableExpression baseExpression, EditableExpression portfolioAdjustmentExpression ) { var result = new BasketCountryModel( basket, new UnchangableExpression <Decimal>( ValueNames.Benchmark, this.defaultValues.DefaultBenchmark, this.commonParts.DecimalValueAdapter, this.commonParts.ValidateWhatever ), baseExpression, self => new ModelFormulaExpression <IModel, Decimal?>( ValueNames.BaseActive, self, computations.BaseActiveFormula, this.commonParts.NullableDecimalValueAdapter, this.commonParts.ValidateWhatever ), new UnchangableExpression <Decimal>( ValueNames.Overlay, this.defaultValues.DefaultOverlay, this.commonParts.DecimalValueAdapter, this.commonParts.ValidateWhatever ), portfolioAdjustmentExpression, self => new ModelFormulaExpression <IModel, Decimal?>( ValueNames.PortfolioScaled, self, computations.PortfolioScaledFormula, this.commonParts.NullableDecimalValueAdapter, this.commonParts.ValidateWhatever ), self => new ModelFormulaExpression <IModel, Decimal?>( ValueNames.TrueExposure, self, computations.TrueExposureFormula, this.commonParts.NullableDecimalValueAdapter, this.commonParts.ValidateWhatever ), self => new ModelFormulaExpression <IModel, Decimal?>( ValueNames.TrueActive, self, computations.TrueActiveFormula, this.commonParts.NullableDecimalValueAdapter, this.commonParts.ValidateWhatever ), this.commonParts ); return(result); }
protected void TraverseBasketCountry(BasketCountryModel model, List <IExpression> result) { result.Add(model.Base); result.Add(model.BaseActive); result.Add(model.Benchmark); result.Add(model.Overlay); result.Add(model.PortfolioAdjustment); result.Add(model.PortfolioScaled); result.Add(model.TrueActive); result.Add(model.TrueExposure); }
protected void InitializeBasketCountry( BasketCountryModel model, Dictionary <Int32, TargetingTypeBasketPortfolioTargetInfo> dictionary) { TargetingTypeBasketPortfolioTargetInfo info; if (dictionary.TryGetValue(model.Basket.Id, out info)) { model.PortfolioAdjustment.InitialValue = info.Target; } }
protected void SerializeBasketCountry(IJsonWriter writer, BasketCountryModel model, String discriminator, CalculationTicket ticket) { this.AddDiscriminatorIfAny(writer, discriminator); writer.Write(model.Basket.Id, JsonNames.BasketId); this.SerializeCountry(writer, model.Basket.Country); this.expressionWriter.SerializeOnceResolved(model.Benchmark, JsonNames.Benchmark, writer, ticket); this.expressionWriter.SerializeOnceResolved(model.Base, JsonNames.Base, writer, ticket); this.expressionWriter.SerializeOnceResolved(model.BaseActive, JsonNames.BaseActive, writer, ticket); this.expressionWriter.SerializeOnceResolved(model.Overlay, JsonNames.Overlay, writer, ticket); this.expressionWriter.SerializeOnceResolved(model.PortfolioAdjustment, JsonNames.PortfolioAdjustment, writer, ticket); this.expressionWriter.SerializeOnceResolved(model.PortfolioScaled, JsonNames.PortfolioScaled, writer, ticket); this.expressionWriter.SerializeOnceResolved(model.TrueExposure, JsonNames.TrueExposure, writer, ticket); this.expressionWriter.SerializeOnceResolved(model.TrueActive, JsonNames.TrueActive, writer, ticket); }
public UnsavedBasketCountryModel( Country country, UnchangableExpression <Decimal> benchmarkExpression, EditableExpression baseExpression, Func <UnsavedBasketCountryModel, IExpression <Decimal?> > baseActiveExpressionCreator, UnchangableExpression <Decimal> overlayExpression, EditableExpression portfolioAdjustmentExpression, Func <UnsavedBasketCountryModel, IExpression <Decimal?> > portfolioScaledExpressionCreator, Func <UnsavedBasketCountryModel, IExpression <Decimal?> > trueExposureExpressionCreator, Func <UnsavedBasketCountryModel, IExpression <Decimal?> > trueActiveExpressionCreator, BasketCountryModel basketCountry ) : this(country, benchmarkExpression, baseExpression, baseActiveExpressionCreator, overlayExpression, portfolioAdjustmentExpression, portfolioScaledExpressionCreator, trueExposureExpressionCreator, trueActiveExpressionCreator) { this.BasketCountry = basketCountry; }
protected IEnumerable <IValidationIssue> ValidateBasketCountry(BasketCountryModel model, CalculationTicket ticket) { return(base.ValidateScope(model.Basket.Country.Name, issues => { var overlay = model.Overlay.Value(ticket); var baseValue = model.Base.Value(ticket); if (baseValue.HasValue) { if (baseValue.Value < overlay) { model.Base.InjectProblems(new IValidationIssue[] { new WariningIssue("Base is less than overlay.") }); } } issues.AddRange(model.Base.Validate()); issues.AddRange(model.PortfolioAdjustment.Validate()); })); }
public void Resolve(BasketCountryModel model) { }
public void Resolve(BasketCountryModel model) { this.traverser.TraverseBasketCountry(model, this.result); }
public void Resolve(BasketCountryModel model) { this.Result = this.builder.CreateBasketCountry(model); }
public void Resolve(BasketCountryModel model) { this.Result = model.Benchmark; }
public void Resolve(BasketCountryModel model) { this.ResultOpt = model.TrueExposure; }
public void Resolve(BasketCountryModel model) { this.ResultOpt = model.PortfolioAdjustment; }
protected IEnumerable <IModel> TraverseBasketCountry(BasketCountryModel basketCountryModel) { yield return(basketCountryModel); }
public void Resolve(BasketCountryModel model) { this.Result = this.validator.ValidateBasketCountry(model, this.ticket); }
public void Resolve(BasketCountryModel basketCountry) { this.parent.SerializeBasketCountry(this.writer, basketCountry, JsonNames.BasketCountry, this.ticket); }
public void Resolve(BasketCountryModel model) { this.ResultOpt = model.Base; }
public void Resolve(BasketCountryModel model) { this.Result = model.Overlay; }
protected void Initialize(BasketCountryModel model, IsoCodeToOverlayTargetValueResolver valueResolver) { model.Overlay.InitialValue = valueResolver.ResolveOverlayTargetValue(model.Basket.Country.IsoCode, model.Overlay.DefaultValue); }
public void Resolve(BasketCountryModel model) { this.ResultOpt = model.PortfolioScaled; }
public void Resolve(BasketCountryModel model) { this.initializer.Initialize(model, valueResolver); }
public void Resolve(BasketCountryModel model) { this.ResultOpt = model.TrueActive; }
public void Resolve(BasketCountryModel model) { this.initializer.InitializeBasketCountry(model, this.valuesByBasketId); }
public void Resolve(BasketCountryModel model) { model.Benchmark.InitialValue = this.valueResolver.GetBenchmark(model.Basket.Country.IsoCode); }
public BasketCountryNode CreateBasketCountry(BasketCountryModel model) { var result = new BasketCountryNode(model.Basket); return(result); }