示例#1
0
        /// <summary>
        /// GetPortfolio Method to get Portfolio and return a static PortfolioVM object
        /// </summary>
        /// <param></param>
        /// <returns></returns>
        public PortfolioVM GetPortfolio()
        {
            PortfolioVM portfolio = null;

            try
            {
                portfolio = new PortfolioVM
                {
                    Positions = new List <PositionVM>
                    {
                        new PositionVM {
                            Code = "NL0000009165", Name = "Heineken", Value = 12345
                        },
                        new PositionVM {
                            Code = "NL0000287100", Name = "Optimix Mix Fund", Value = 23456
                        },
                        new PositionVM {
                            Code = "LU0035601805", Name = "DP Global Strategy L High", Value = 34567
                        },
                        new PositionVM {
                            Code = "NL0000292332", Name = "Rabobank Core Aandelen Fonds T2", Value = 45678
                        },
                        new PositionVM {
                            Code = "LU0042381250", Name = "Morgan Stanley Invest US Gr Fnd", Value = 56789
                        }
                    }
                };
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(portfolio);
        }
        /// <summary>
        /// This Method accepts xml file path and returns PortfolioVM.
        /// Portfolio view model contains static position view model, calls fillMandate method which fills mandate object inside postion view model.
        /// </summary>
        /// <param name="path">XML file path</param>
        /// <returns> returns portfolioVM</returns>
        public PortfolioVM GetPortfolio(string path)
        {
            FundsOfMandatesData fundsOfMandatesData = this.GetFundOfMandates(path);
            PortfolioVM         portfolioVM         = new PortfolioVM();

            portfolioVM.Positions.Add(new PositionVM()
            {
                Code = "NL0000009165", Name = "Heineken", Value = 12345
            });
            portfolioVM.Positions.Add(new PositionVM()
            {
                Code = "NL0000287100", Name = "Optimix Mix Fund", Value = 23456
            });
            portfolioVM.Positions.Add(new PositionVM()
            {
                Code = "LU0035601805", Name = "DP Global Strategy L High", Value = 34567
            });
            portfolioVM.Positions.Add(new PositionVM()
            {
                Code = "NL0000292332", Name = "Rabobank Core Aandelen Fonds T2", Value = 45678
            });
            portfolioVM.Positions.Add(new PositionVM()
            {
                Code = "LU0042381250", Name = "Morgan Stanley Invest US Gr Fnd", Value = 56789
            });
            return(this.FillMandate(portfolioVM, fundsOfMandatesData));
        }
示例#3
0
 /// <summary>
 /// Get Calculated Mandates
 /// </summary>
 /// <param name="portfolioVM"></param>
 /// <param name="fundsOfMandates"></param>
 /// <returns></returns>
 public List <PositionVM> GetCalculatedMandates(PortfolioVM portfolioVM, List <FundOfMandates> fundsOfMandates)
 {
     portfolioVM.Positions.ForEach(position => {
         FundOfMandates fund = fundsOfMandates.Where(funds => funds.InstrumentCode == position.Code).FirstOrDefault();
         if (fund != null)
         {
             position.Mandates = new List <MandateVM>();
             fund.Mandates.ToList().ForEach(mandate => {
                 MandateVM mandateVM  = new MandateVM();
                 mandateVM.Name       = mandate.MandateName;
                 mandateVM.Allocation = (mandate.Allocation / 100);
                 mandateVM.Value      = (mandate.Allocation / 100) * position.Value;
                 position.Mandates.Add(mandateVM);
             });
             if (fund.LiquidityAllocation > 0)
             {
                 position.Mandates.Add(new MandateVM
                 {
                     Name       = "Liquidity",
                     Allocation = (fund.LiquidityAllocation / 100),
                     Value      = (fund.LiquidityAllocation / 100) * position.Value
                 });
             }
         }
     });
     return(portfolioVM.Positions);
 }
示例#4
0
        /// <summary>
        /// Get Portfolio
        /// </summary>
        /// <returns></returns>
        public PortfolioVM GetPortfolio()
        {
            PortfolioVM portfolioVM = new PortfolioVM();

            portfolioVM.Positions = new List <PositionVM>()
            {
                new PositionVM()
                {
                    Code = "NL0000009165", Name = "Heineken", Value = 12345
                },
                new PositionVM()
                {
                    Code = "NL0000287100", Name = "Optimix Mix Fund", Value = 23456
                },
                new PositionVM()
                {
                    Code = "LU0035601805", Name = "DP Global Strategy L High", Value = 34567
                },
                new PositionVM()
                {
                    Code = "NL0000292332", Name = "Rabobank Core Aandelen Fonds T2", Value = 45678
                },
                new PositionVM()
                {
                    Code = "LU0042381250", Name = "Morgan Stanley Invest US Gr Fnd", Value = 56789
                }
            };
            return(portfolioVM);
        }
 /// <summary>
 /// This function calls calculateMandate and updates mandates object for each postion item.
 /// if fundsofMandateData or portfolioVM is null or empty then it is not doing anything, returning same portfoliovm object which was passed as argument.
 /// </summary>
 /// <param name="portfolioVM">The portfolio vm.</param>
 /// <param name="fundsOfMandatesData">The funds of mandates data.</param>
 /// <returns>returns portfolioVM</returns>
 public PortfolioVM FillMandate(PortfolioVM portfolioVM, FundsOfMandatesData fundsOfMandatesData)
 {
     if (fundsOfMandatesData?.FundsOfMandates?.Length > 0 && portfolioVM?.Positions?.Count > 0)
     {
         foreach (var position in portfolioVM.Positions)
         {
             position.Mandates = CalculateMandate(position.Code, position.Value, fundsOfMandatesData);
         }
     }
     return(portfolioVM);
 }
示例#6
0
 public async Task <PortfolioVM> GetPortfolio()
 {
     try
     {
         PortfolioVM       portVMObj   = new PortfolioVM();
         List <PositionVM> positionObj = new List <PositionVM>();
         positionObj.Add(new PositionVM
         {
             Code  = "NL0000009165",
             Name  = "Heineken",
             Value = 12345
         });
         positionObj.Add(new PositionVM
         {
             Code  = "NL0000287100",
             Name  = "Optimix Mix Fund",
             Value = 23456
         });
         positionObj.Add(new PositionVM
         {
             Code  = "LU0035601805",
             Name  = "DP Global Strategy L High",
             Value = 34567
         });
         positionObj.Add(new PositionVM
         {
             Code  = "NL0000292332",
             Name  = "Rabobank Core Aandelen Fonds T2",
             Value = 45678
         });
         positionObj.Add(new PositionVM
         {
             Code  = "LU0042381250",
             Name  = "Morgan Stanley Invest US Gr Fnd",
             Value = 56789
         });
         portVMObj.Positions = positionObj;
         return(await Task.Run(() => { return portVMObj; }));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.ToString());
     }
 }
示例#7
0
        /// <summary>
        ///  Method to get the updated portfolio after the Calculated Mandates
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public PortfolioVM GetUpdatedPortfolio(string fileName)
        {
            PortfolioVM           portfolioVM   = null;
            List <FundOfMandates> mandates      = null;
            IFundProcessor        fundProcessor = new FundProcessor();

            portfolioVM = fundProcessor.GetPortfolio();
            mandates    = fundProcessor.ReadFundOfMandateFile(fileName);

            portfolioVM.Positions.ForEach(position =>
            {
                mandates.ForEach(fundofmandate =>
                {
                    position = fundProcessor.GetCalculatedMandates(position, fundofmandate);
                });
            });

            return(portfolioVM);
        }