コード例 #1
0
        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);
        }
コード例 #2
0
 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);
 }
コード例 #3
0
        protected void InitializeBasketCountry(
            BasketCountryModel model,
            Dictionary <Int32, TargetingTypeBasketPortfolioTargetInfo> dictionary)
        {
            TargetingTypeBasketPortfolioTargetInfo info;

            if (dictionary.TryGetValue(model.Basket.Id, out info))
            {
                model.PortfolioAdjustment.InitialValue = info.Target;
            }
        }
コード例 #4
0
 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);
 }
コード例 #5
0
 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;
 }
コード例 #6
0
 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());
     }));
 }
コード例 #7
0
 public void Resolve(BasketCountryModel model)
 {
 }
コード例 #8
0
 public void Resolve(BasketCountryModel model)
 {
     this.traverser.TraverseBasketCountry(model, this.result);
 }
コード例 #9
0
 public void Resolve(BasketCountryModel model)
 {
     this.Result = this.builder.CreateBasketCountry(model);
 }
コード例 #10
0
 public void Resolve(BasketCountryModel model)
 {
     this.Result = model.Benchmark;
 }
コード例 #11
0
 public void Resolve(BasketCountryModel model)
 {
     this.ResultOpt = model.TrueExposure;
 }
コード例 #12
0
 public void Resolve(BasketCountryModel model)
 {
     this.ResultOpt = model.PortfolioAdjustment;
 }
コード例 #13
0
 protected IEnumerable <IModel> TraverseBasketCountry(BasketCountryModel basketCountryModel)
 {
     yield return(basketCountryModel);
 }
コード例 #14
0
 public void Resolve(BasketCountryModel model)
 {
     this.Result = this.validator.ValidateBasketCountry(model, this.ticket);
 }
コード例 #15
0
 public void Resolve(BasketCountryModel basketCountry)
 {
     this.parent.SerializeBasketCountry(this.writer, basketCountry, JsonNames.BasketCountry, this.ticket);
 }
コード例 #16
0
 public void Resolve(BasketCountryModel model)
 {
     this.ResultOpt = model.Base;
 }
コード例 #17
0
 public void Resolve(BasketCountryModel model)
 {
     this.Result = model.Overlay;
 }
コード例 #18
0
 protected void Initialize(BasketCountryModel model, IsoCodeToOverlayTargetValueResolver valueResolver)
 {
     model.Overlay.InitialValue = valueResolver.ResolveOverlayTargetValue(model.Basket.Country.IsoCode, model.Overlay.DefaultValue);
 }
コード例 #19
0
 public void Resolve(BasketCountryModel model)
 {
     this.ResultOpt = model.PortfolioScaled;
 }
コード例 #20
0
 public void Resolve(BasketCountryModel model)
 {
     this.initializer.Initialize(model, valueResolver);
 }
コード例 #21
0
 public void Resolve(BasketCountryModel model)
 {
     this.ResultOpt = model.TrueActive;
 }
コード例 #22
0
 public void Resolve(BasketCountryModel model)
 {
     this.initializer.InitializeBasketCountry(model, this.valuesByBasketId);
 }
コード例 #23
0
 public void Resolve(BasketCountryModel model)
 {
     model.Benchmark.InitialValue = this.valueResolver.GetBenchmark(model.Basket.Country.IsoCode);
 }
コード例 #24
0
        public BasketCountryNode CreateBasketCountry(BasketCountryModel model)
        {
            var result = new BasketCountryNode(model.Basket);

            return(result);
        }