Esempio n. 1
0
        public PortfolioValuationDataReportingModel GetValuationDataReportingModel(DateTime valuationDate, IAccount account)
        {
            var holdingValuations = new List <HoldingValuationDataReportingModel>();

            foreach (KeyValuePair <string, IHolding> holding in account.AccountHoldings)
            {
                decimal valuation        = holding.Value.CurrentPrice * holding.Value.Quantity;
                var     holdingValuation = new HoldingValuationDataReportingModel {
                    StockSymbol = holding.Key, HoldingValue = valuation
                };
                holdingValuations.Add(holdingValuation);
            }

            var portfolioValuation = new PortfolioValuationDataReportingModel
            {
                ValuationDate      = valuationDate,
                PortfolioValuation = account.CurrentValuation,
                HoldingValuations  = holdingValuations.ToArray()
            };

            return(portfolioValuation);
        }
        private void RebalanceSimulationManager_AccountUpdatedEvent(object sender, AccountUpdatedEventArgs eventArgs)
        {
            PortfolioValuationDataReportingModel portfolioValuation = _xmlModelFactory.GetValuationDataReportingModel(eventArgs.ValuationDate, eventArgs.Account);

            _portfolioValuationSummary.AppendValuationModel(portfolioValuation);
        }