protected Decimal?TryGetTotalByBasket(RegionBasket basket, BenchmarkRepository benchmarkRepository, String benchmarkId) { Decimal?result = null; foreach (var country in basket.Countries) { var value = TryGetTotalByCountry(country, benchmarkRepository, benchmarkId); if (value.HasValue) { if (result.HasValue) { result = result.Value + value.Value; } else { result = value.Value; } } else { // do nothing } } return(result); }
public Boolean IsSecurityFromRegionBasket(ISecurity security, RegionBasket basket) { var stockOpt = security.TryAsCompanySecurity(); if (stockOpt != null) { var result = basket.Countries.Any(x => x.IsoCode == stockOpt.Country.IsoCode); return(result); } else { return(false); } }
public BasketRegionModel( RegionBasket basket, IExpression <Decimal> benchmarkExpression, EditableExpression baseExpression, Func <BasketRegionModel, IExpression <Decimal?> > baseActiveExpressionCreator, IExpression <Decimal> overlayExpression, EditableExpression portfolioAdjustmentExpression, Func <BasketRegionModel, IExpression <Decimal?> > portfolioScaledExpressionCreator, Func <BasketRegionModel, IExpression <Decimal?> > trueExposureExpressionCreator, Func <BasketRegionModel, IExpression <Decimal?> > trueActiveExpressionCreator, IEnumerable <CountryModel> countries ) { this.Basket = basket; this.Benchmark = benchmarkExpression; this.Base = baseExpression; this.BaseActive = baseActiveExpressionCreator(this); this.Overlay = overlayExpression; this.PortfolioAdjustment = portfolioAdjustmentExpression; this.PortfolioScaled = portfolioScaledExpressionCreator(this); this.TrueExposure = trueExposureExpressionCreator(this); this.TrueActive = trueActiveExpressionCreator(this); this.Countries = countries; }
public void Resolve(RegionBasket basket) { this.Result = this.initializer.TryGetTotalByBasket(basket, benchmarkRepository, this.benchmarkId); }
public String RenderBasket(RegionBasket basket) { var result = basket.Name + "(" + String.Join(", ", basket.Countries.Select(x => x.IsoCode).ToArray()) + ")"; return(result); }
public void Resolve(RegionBasket basket) { this.Result = this.renderer.RenderBasket(basket); }
public BasketRegionNode(RegionBasket basket) { this.Basket = basket; }
public String RenderBasket(RegionBasket basket) { return(basket.Name); }
public void Resolve(RegionBasket basket) { this.RegionBasketOpt = basket; }
public void Resolve(RegionBasket basket) { this.Result = this.investigator.IsSecurityFromRegionBasket(security, basket); }
public void Resolve(RegionBasket basket) { this.Result = this.serializer.SerializeRegionBasket(basket); }