Пример #1
0
        public void AdviserCanCreateClientForGroup()
        {
            var repo    = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;

            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName     = "client first name",
                LastName      = "client last name",
                Address       = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob           = DateTime.Now,
                Phone         = "03699999",
                Email         = "Email"
            }).Wait();

            //adviser.SetProfileEndDate(DateTime.Now);
            var groups = adviser.GetAllClientGroups().Result;

            adviser.CreateNewClient(new ClientRegistration()
            {
                GroupNumber = groups[0].ClientGroupNumber,
                FirstName   = "second first name",
                LastName    = "second last name",
                Address     = "address",
                Dob         = DateTime.Now,
                Phone       = "039999999",
                Email       = "*****@*****.**"
            }).Wait();
            //adviser.SetProfileEndDate(DateTime.Now);
            groups = adviser.GetAllClientGroups().Result;
            Assert.IsTrue(groups.Count == 1);
            Assert.IsTrue(groups[0].GetClients().Result.Count == 2);
            repo.Dispose();
        }
Пример #2
0
        public void CanCreateAdviser()
        {
            var repo    = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;

            Assert.IsTrue(adviser.FirstName == "Test");
            repo.Dispose();
        }
 public CorrespondenceController()
 {
     edisDbEntities db = new edisDbEntities();
     comRepo = new CommonReferenceDataRepository(db);
     corresRepo = new CorrespondenceRepository(db);
     //advRepo = new AdviserRepository(db);
     edisRepo = new EdisRepository();
 }
Пример #4
0
        public void CanCalculateAssetCashAccountTypeDiversification()
        {
            var repo = new EdisRepository();

            var adviser = repo.CreateAdviser("Test", "Adviser").Result;

            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName     = "client first name",
                LastName      = "client last name",
                Address       = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob           = DateTime.Now,
                Phone         = "03699999",
                Email         = "Email"
            }).Wait();

            var groups = adviser.GetAllClientGroups().Result;

            groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait();
            var account = groups[0].GetAccounts()[0];

            account.MakeTransaction(new CashAccountTransactionAccountCreation()
            {
                Amount = 150000,
                AnnualInterestSoFar = 0,
                Bsb                   = "123456",
                CashAccountName       = "Account name",
                CashAccountNumber     = "Number",
                CashAccountType       = CashAccountType.TermDeposit,
                CurrencyType          = CurrencyType.AustralianDollar,
                Frequency             = Frequency.Annually,
                InterestRate          = 0.9,
                MaturityDate          = DateTime.Now.AddYears(1),
                TermsInMonths         = 20,
                TransactionDate       = DateTime.Now,
                TransactionFeeRecords = new List <TransactionFeeRecordCreation>()
                {
                    new TransactionFeeRecordCreation()
                    {
                        Amount = 1000,
                        TransactionExpenseType = TransactionExpenseType.AdviserTransactionFee
                    }
                }
            }).Wait();

            var assets = account.GetAssets();

            var cashAccountDiversification = assets.GetCashAccountTypeDiversification(repo).Result;



            Assert.IsTrue(cashAccountDiversification.Count == 5);
            Assert.IsTrue(cashAccountDiversification["TermDeposit"] == 150000);

            repo.Dispose();
        }
Пример #5
0
        //  private EdisRepository repo;
        public CorrespondenceController()
        {
            edisDbEntities db = new edisDbEntities();

            //comRepo = new CommonReferenceDataRepository(db);
            corresRepo = new CorrespondenceRepository(db);
            //advRepo = new AdviserRepository(db);
            edisRepo = new EdisRepository();
        }
Пример #6
0
        public void CanCreateHomeLoan()
        {
            var repo    = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;

            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName     = "client first name",
                LastName      = "client last name",
                Address       = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob           = DateTime.Now,
                Phone         = "03699999",
                Email         = "Email"
            }).Wait();

            var groups = adviser.GetAllClientGroups().Result;

            groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait();
            var account = groups[0].GetAccounts()[0];

            account.MakeTransaction(new PropertyTransactionCreation()
            {
                FeesRecords = new List <TransactionFeeRecordCreation>()
                {
                    new TransactionFeeRecordCreation()
                    {
                        Amount = 888,
                        TransactionExpenseType = TransactionExpenseType.AdviserTransactionFee
                    }
                },
                FullAddress     = "668 Bourke Street, Melbourne, 3000",
                IsBuy           = true,
                Price           = 1980000,
                PropertyType    = "Home",
                TransactionDate = DateTime.Now
            }).Wait();
            var assets = account.GetAssets();

            account.MakeTransaction(new HomeLoanTransactionCreation()
            {
                ExpiryDate          = DateTime.Now.AddYears(2),
                GrantedOn           = DateTime.Now,
                Institution         = "ANZ",
                IsAcquire           = true,
                LoanAmount          = 300000,
                LoanRate            = 0.07,
                LoanRepaymentType   = LoanRepaymentType.DirectDebt,
                PropertyId          = assets[0].Id,
                TypeOfMortgageRates = TypeOfMortgageRates.Combination
            }).Wait();
            var liabilities = account.GetLiabilities();

            Assert.IsTrue(liabilities.Count == 1);
            Assert.IsTrue(liabilities[0] is MortgageAndHomeLiability);
        }
Пример #7
0
        public void AccountCanMakeTransactionWithExpenses()
        {
            var repo    = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;

            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName     = "client first name",
                LastName      = "client last name",
                Address       = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob           = DateTime.Now,
                Phone         = "03699999",
                Email         = "Email"
            }).Wait();

            var groups = adviser.GetAllClientGroups().Result;

            groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait();
            var account = groups[0].GetAccounts()[0];

            account.MakeTransaction(new EquityTransactionCreation()
            {
                EquityType  = EquityTypes.AustralianEquity,
                FeesRecords = new List <TransactionFeeRecordCreation>()
                {
                    new TransactionFeeRecordCreation()
                    {
                        Amount = 100,
                        TransactionExpenseType = TransactionExpenseType.Brokerage
                    }
                },
                Name            = "Test Stock",
                NumberOfUnits   = 100,
                Price           = 20,
                Sector          = "Test Sector",
                Ticker          = "Test Ticker 01",
                TransactionDate = DateTime.Now,
            }).Wait();

            account = groups[0].GetAccounts()[0];
            Assert.IsTrue(account.GetAssets().Count == 1);
            var asset = account.GetAssets()[0];

            Assert.IsTrue(asset.LatestPrice == 20);
            Assert.IsTrue(asset.TotalNumberOfUnits == 100);
            var assets      = account.GetAssets();
            var marketvalue = assets.GetTotalMarketValue();
            var cost        = assets.GetTotalCost();

            Assert.IsTrue(marketvalue == 2000);
            Assert.IsTrue(cost.AssetCost == 2000);
            Assert.IsTrue(cost.Total == 2100);
            Assert.IsTrue(cost.Expense == 100);
            repo.Dispose();
        }
Пример #8
0
        public void CanCreateInsuranceAndRecordPayment()
        {
            var repo    = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;

            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName     = "client first name",
                LastName      = "client last name",
                Address       = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob           = DateTime.Now,
                Phone         = "03699999",
                Email         = "Email"
            }).Wait();
            var groups = adviser.GetAllClientGroups().Result;

            groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait();
            var account = groups[0].GetAccounts()[0];

            account.MakeTransaction(new InsuranceTransactionCreation()
            {
                ExpiryDate      = DateTime.Now.AddYears(1),
                AmountInsured   = 1000,
                EntitiesInsured = "something",
                GrantedOn       = DateTime.Now,
                InsuranceType   = InsuranceType.AssetInsurance,
                IsAcquire       = true,
                Issuer          = "Issuer",
                NameOfPolicy    = "Name",
                PolicyAddress   = "Address",
                PolicyNumber    = "Number",
                PolicyType      = PolicyType.Accident,
                Premium         = 100
            }).Wait();


            account.RecordRepayment(new RepaymentCreation()
            {
                PaymentOn       = DateTime.Now,
                PrincipleAmount = 300,
                InterestAmount  = 200,
                PolicyName      = "Name",
                PolicyNumber    = "Number",
                PropertyId      = null,
                LiabilityTypes  = LiabilityTypes.Insurance
            }).Wait();

            var liabilities = account.GetLiabilities();

            Assert.IsTrue(liabilities[0].CurrentBalance == 700);
        }
Пример #9
0
 static void ImportDataFromExcelEquity()
 {
     using (EdisRepository edisRepo = new EdisRepository()) {
         Console.WriteLine("Program start......");
         //string excelFilePath = "C:/Users/ahksysuser06/Desktop/EDISData/Australian Equity Daily Closing Price 20131211.xlsx";
         string excelFilePath = "C:/Users/ahksysuser06/Desktop/EDISData/International_Equity_Daily_Closing_Price_20131211.xlsx";
         // make sure your sheet name is correct, here sheet name is sheet1, so you can change the sheet name if have    different 
         string excelQuery = "select SecId,Name,Symbol from [Sheet1$]";
         try
         {
             string excelConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excelFilePath +
             ";Extended Properties='Excel 12.0;HDR=YES;IMEX=1;'";
             OleDbConnection oleConn = new OleDbConnection(excelConnectionString);
             oleConn.Open();
             OleDbDataReader oleReader = new OleDbCommand(excelQuery, oleConn).ExecuteReader();
             //while (oleReader.Read())
             //{
             //    Domain.Portfolio.AggregateRoots.Asset.Equity equity = new AustralianEquity(edisRepo)
             //    {
             //        Name = oleReader.GetString(1),
             //        Sector = oleReader.GetString(0),
             //        Ticker = oleReader.GetString(2),
             //        EquityType = EquityTypes.AustralianEquity,
             //    };
             //    Console.WriteLine("inserting");
             //    edisRepo.InsertEquityData(equity);
             //}
             while (oleReader.Read())
             {
                 Domain.Portfolio.AggregateRoots.Asset.Equity equity = new InternationalEquity(edisRepo)
                 {
                     Name = oleReader.GetString(1),
                     Sector = oleReader.GetString(0),
                     Ticker = oleReader.GetString(2),
                     EquityType = EquityTypes.InternationalEquity,
                 };
                 Console.WriteLine("inserting");
                 edisRepo.InsertEquityData(equity);
             }
             oleReader.Close();
             oleConn.Close();
             Console.WriteLine("Finished");
         }
             
         catch (Exception ex)
         {
             Console.WriteLine(ex.Message);
             throw;
         }
     }
     
 }
Пример #10
0
        static void ImportDataFromExcelEquity()
        {
            using (EdisRepository edisRepo = new EdisRepository()) {
                Console.WriteLine("Program start......");
                //string excelFilePath = "C:/Users/ahksysuser06/Desktop/EDISData/Australian Equity Daily Closing Price 20131211.xlsx";
                string excelFilePath = "C:/Users/ahksysuser06/Desktop/EDISData/International_Equity_Daily_Closing_Price_20131211.xlsx";
                // make sure your sheet name is correct, here sheet name is sheet1, so you can change the sheet name if have    different
                string excelQuery = "select SecId,Name,Symbol from [Sheet1$]";
                try
                {
                    string excelConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excelFilePath +
                                                   ";Extended Properties='Excel 12.0;HDR=YES;IMEX=1;'";
                    OleDbConnection oleConn = new OleDbConnection(excelConnectionString);
                    oleConn.Open();
                    OleDbDataReader oleReader = new OleDbCommand(excelQuery, oleConn).ExecuteReader();
                    //while (oleReader.Read())
                    //{
                    //    Domain.Portfolio.AggregateRoots.Asset.Equity equity = new AustralianEquity(edisRepo)
                    //    {
                    //        Name = oleReader.GetString(1),
                    //        Sector = oleReader.GetString(0),
                    //        Ticker = oleReader.GetString(2),
                    //        EquityType = EquityTypes.AustralianEquity,
                    //    };
                    //    Console.WriteLine("inserting");
                    //    edisRepo.InsertEquityData(equity);
                    //}
                    while (oleReader.Read())
                    {
                        Domain.Portfolio.AggregateRoots.Asset.Equity equity = new InternationalEquity(edisRepo)
                        {
                            Name       = oleReader.GetString(1),
                            Sector     = oleReader.GetString(0),
                            Ticker     = oleReader.GetString(2),
                            EquityType = EquityTypes.InternationalEquity,
                        };
                        Console.WriteLine("inserting");
                        edisRepo.InsertEquityData(equity);
                    }
                    oleReader.Close();
                    oleConn.Close();
                    Console.WriteLine("Finished");
                }

                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    throw;
                }
            }
        }
Пример #11
0
        public void CanUpdateAdviser()
        {
            var repo    = new EdisRepository();
            var adviser = repo.CreateAdviser("Steven", "Wang").Result;

            adviser.FirstName = "Zhenhao";

            var adviser2 = repo.UpdateAdviser(adviser, DateTime.Now).Result;

            Console.WriteLine(adviser2.FirstName);

            Assert.IsTrue(adviser.FirstName == "Zhenhao");
            repo.Dispose();
        }
Пример #12
0
        public void CanGenerateMonthlyCashflowForAssets()
        {
            var repo    = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;

            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName     = "client first name",
                LastName      = "client last name",
                Address       = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob           = DateTime.Now,
                Phone         = "03699999",
                Email         = "Email"
            }).Wait();
            var groups = adviser.GetAllClientGroups().Result;

            groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait();
            var account = groups[0].GetAccounts()[0];

            account.MakeTransaction(new EquityTransactionCreation()
            {
                EquityType  = EquityTypes.AustralianEquity,
                FeesRecords = new List <TransactionFeeRecordCreation>()
                {
                    new TransactionFeeRecordCreation()
                    {
                        Amount = 1000,
                        TransactionExpenseType = TransactionExpenseType.Brokerage
                    }
                },
                Name            = "Test Stock",
                NumberOfUnits   = 100,
                Price           = 20,
                Sector          = "Test Sector",
                Ticker          = "Test Ticker 01",
                TransactionDate = DateTime.Now,
            }).Wait();

            account = groups[0].GetAccounts()[0];
            var assets   = account.GetAssets();
            var cashflow = assets.GetMonthlyCashflows();


            Assert.IsTrue(cashflow != null);
            Assert.IsTrue(cashflow.Count == 12);
            Assert.IsTrue(cashflow.Last().Expenses == 1000);
        }
Пример #13
0
        public void CanCalculateAssetBondTypeDiversification()
        {
            var repo    = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;

            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName     = "client first name",
                LastName      = "client last name",
                Address       = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob           = DateTime.Now,
                Phone         = "03699999",
                Email         = "Email"
            }).Wait();

            var groups = adviser.GetAllClientGroups().Result;

            groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait();
            var account = groups[0].GetAccounts()[0];

            account.MakeTransaction(new BondTransactionCreation()
            {
                BondName              = "Test Bond",
                BondType              = "Bond Type 1",
                Frequency             = Frequency.Annually,
                Issuer                = "Issuer",
                NumberOfUnits         = 1000,
                Ticker                = "Ticker 1",
                TransactionDate       = DateTime.Now,
                UnitPrice             = 27.99,
                TransactionFeeRecords = new List <TransactionFeeRecordCreation>()
                {
                    new TransactionFeeRecordCreation()
                    {
                        Amount = 100,
                        TransactionExpenseType = TransactionExpenseType.Brokerage
                    }
                }
            }).Wait();

            var assets = account.GetAssets();

            var diversification = assets.GetFixedIncomeTypeDiversification(repo).Result;

            Assert.IsTrue(diversification.Count == 2);
            Assert.IsTrue(diversification["Bond Type 1"] == (27.99 * 1000));
        }
Пример #14
0
        public void CanCalculateAssetPropertyTypeDiversification()
        {
            var repo    = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;

            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName     = "client first name",
                LastName      = "client last name",
                Address       = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob           = DateTime.Now,
                Phone         = "03699999",
                Email         = "Email"
            }).Wait();

            var groups = adviser.GetAllClientGroups().Result;

            groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait();
            var account = groups[0].GetAccounts()[0];

            account.MakeTransaction(new PropertyTransactionCreation()
            {
                FeesRecords = new List <TransactionFeeRecordCreation>()
                {
                    new TransactionFeeRecordCreation()
                    {
                        Amount = 888,
                        TransactionExpenseType = TransactionExpenseType.AdviserTransactionFee
                    }
                },
                FullAddress     = "668 Bourke Street, Melbourne, 3000",
                IsBuy           = true,
                Price           = 1980000,
                PropertyType    = "Home",
                TransactionDate = DateTime.Now
            }).Wait();

            var assets = account.GetAssets();
            var propertyTypeDiversification = assets.GetDirectPropertyTypeDiversification(repo).Result;

            Assert.IsTrue(propertyTypeDiversification.Count == 2);
            Assert.IsTrue(propertyTypeDiversification["Home"] == 1980000);
        }
Пример #15
0
        public void TestMethod1()
        {
            EdisRepository repo = new EdisRepository();

            var account = repo.CreateNewClientGroupAccountSync("70b77f8c-9385-427d-adbf-59c224d6d9d8", "", AccountType.GenenralPurpose);
            var equity  = repo.getEquityByTicker("PHAR");

            account.MakeTransactionSync(new EquityTransactionCreation()
            {
                FeesRecords     = new List <TransactionFeeRecordCreation>(),
                Name            = equity.Name,
                NumberOfUnits   = 100,
                Price           = 10,
                Sector          = equity.Sector,
                Ticker          = equity.Ticker,
                TransactionDate = DateTime.Now.AddDays(-10)
            });
            account.MakeTransactionSync(new EquityTransactionCreation()
            {
                FeesRecords     = new List <TransactionFeeRecordCreation>(),
                Name            = equity.Name,
                NumberOfUnits   = -50,
                Price           = 5,
                Sector          = equity.Sector,
                Ticker          = equity.Ticker,
                TransactionDate = DateTime.Now.AddDays(-9)
            });

            var asset = account.GetAssets()[0];

            var assets      = account.GetAssets();
            var marketvalue = assets.GetTotalMarketValue();
            var cost        = assets.GetTotalCost();

            Assert.IsTrue(marketvalue == 0);
            //Assert.IsTrue(cost.)
            Assert.IsTrue(cost.AssetCost == 1000);
            Assert.IsTrue(cost.Total == 1000);
            Assert.IsTrue(cost.Expense == 1000);
            repo.Dispose();
        }
Пример #16
0
        public void AdviserCanCreateClientWithProperAgeCalculation()
        {
            var repo    = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;

            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName     = "client first name",
                LastName      = "client last name",
                Address       = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob           = DateTime.Now.AddYears(-12),
                Phone         = "03699999",
                Email         = "Email"
            }).Wait();

            var groups = adviser.GetAllClientGroups().Result;

            Assert.IsTrue(groups[0].GetClients().Result[0].Age == 12);
            repo.Dispose();
        }
Пример #17
0
        public void TestMethod1()
        {

            EdisRepository repo = new EdisRepository();

            var account = repo.CreateNewClientGroupAccountSync("70b77f8c-9385-427d-adbf-59c224d6d9d8", "", AccountType.GenenralPurpose);
            var equity = repo.getEquityByTicker("PHAR");
            account.MakeTransactionSync(new EquityTransactionCreation() {
                FeesRecords = new List<TransactionFeeRecordCreation>(),
                Name = equity.Name,
                NumberOfUnits = 100,
                Price = 10,
                Sector = equity.Sector,
                Ticker = equity.Ticker,
                TransactionDate = DateTime.Now.AddDays(-10)
            });
            account.MakeTransactionSync(new EquityTransactionCreation()
            {
                FeesRecords = new List<TransactionFeeRecordCreation>(),
                Name = equity.Name,
                NumberOfUnits = -50,
                Price = 5,
                Sector = equity.Sector,
                Ticker = equity.Ticker,
                TransactionDate = DateTime.Now.AddDays(-9)
            });
           
            var asset = account.GetAssets()[0];
         
            var assets = account.GetAssets();
            var marketvalue = assets.GetTotalMarketValue();
            var cost = assets.GetTotalCost();
            Assert.IsTrue(marketvalue == 0);
            //Assert.IsTrue(cost.)
            Assert.IsTrue(cost.AssetCost == 1000);
            Assert.IsTrue(cost.Total == 1000);
            Assert.IsTrue(cost.Expense == 1000);
            repo.Dispose();

        }
Пример #18
0
        public void AdviserCanCreateGroupAccount()
        {
            var repo    = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;

            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName     = "client first name",
                LastName      = "client last name",
                Address       = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob           = DateTime.Now,
                Phone         = "03699999",
                Email         = "Email"
            }).Wait();

            var groups = adviser.GetAllClientGroups().Result;

            groups[0].AddAccount("Testing", AccountType.GenenralPurpose).Wait();
            Assert.IsTrue(groups[0].GetAccounts().Count == 1);
            repo.Dispose();
        }
Пример #19
0
        public void CanCalculateAssetBondTypeDiversification()
        {
            var repo = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;
            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName = "client first name",
                LastName = "client last name",
                Address = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob = DateTime.Now,
                Phone = "03699999",
                Email = "Email"
            }).Wait();

            var groups = adviser.GetAllClientGroups().Result;
            groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait();
            var account = groups[0].GetAccounts()[0];
            account.MakeTransaction(new BondTransactionCreation()
            {
                BondName = "Test Bond",
                BondType = "Bond Type 1",
                Frequency = Frequency.Annually,
                Issuer = "Issuer",
                NumberOfUnits = 1000,
                Ticker = "Ticker 1",
                TransactionDate = DateTime.Now,
                UnitPrice = 27.99,
                TransactionFeeRecords = new List<TransactionFeeRecordCreation>()
                {
                    new TransactionFeeRecordCreation()
                    {
                        Amount = 100,
                        TransactionExpenseType = TransactionExpenseType.Brokerage
                    }
                }
            }).Wait();

            var assets = account.GetAssets();

            var diversification = assets.GetFixedIncomeTypeDiversification(repo).Result;
            Assert.IsTrue(diversification.Count == 2);
            Assert.IsTrue(diversification["Bond Type 1"] == (27.99 * 1000));
        }
Пример #20
0
        public void AccountCanCalculateProfitAndLoss()
        {
            var repo = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;
            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName = "client first name",
                LastName = "client last name",
                Address = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob = DateTime.Now,
                Phone = "03699999",
                Email = "Email"
            }).Wait();

            var groups = adviser.GetAllClientGroups().Result;
            groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait();
            var account = groups[0].GetAccounts()[0];
            account.MakeTransaction(new EquityTransactionCreation()
            {
                EquityType = EquityTypes.AustralianEquity,
                FeesRecords = new List<TransactionFeeRecordCreation>()
                {
                    new TransactionFeeRecordCreation()
                    {
                        Amount = 100,
                        TransactionExpenseType = TransactionExpenseType.Brokerage
                    }
                },
                Name = "Test Stock",
                NumberOfUnits = 100,
                Price = 20,
                Sector = "Test Sector",
                Ticker = "Test Ticker 01",
                TransactionDate = DateTime.Now,
            }).Wait();

            account = groups[0].GetAccounts()[0];
            Assert.IsTrue(account.GetAssets().Count == 1);
            var asset = account.GetAssets()[0];
            Assert.IsTrue(asset.LatestPrice == 20);
            Assert.IsTrue(asset.TotalNumberOfUnits == 100);
            account.RecordIncome(new DividendPaymentCreation()
            {
                Amount = 200,
                Franking = 100,
                PaymentOn = DateTime.Now,
                Ticker = ((AustralianEquity)asset).Ticker
            }).Wait();

            var assets = account.GetAssets();
            var marketvalue = assets.GetTotalMarketValue();
            var cost = assets.GetTotalCost();
            var income = assets.GetTotalIncome();
            var profitLoss = assets.GetProfitAndLoss();

            Assert.IsTrue(marketvalue == 2000);
            Assert.IsTrue(cost.AssetCost == 2000);
            Assert.IsTrue(cost.Total == 2100);
            Assert.IsTrue(cost.Expense == 100);
            Assert.IsTrue(income == 300);
            Assert.IsTrue(profitLoss == 200);
            repo.Dispose();
        }
Пример #21
0
 public ClientController()
 {
     clientRepo = new ClientRepository();
     edisRepo   = new EdisRepository();
 }
Пример #22
0
        public void CanCalculateAssetCashAccountTypeDiversification()
        {
            var repo = new EdisRepository();

            var adviser = repo.CreateAdviser("Test", "Adviser").Result;
            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName = "client first name",
                LastName = "client last name",
                Address = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob = DateTime.Now,
                Phone = "03699999",
                Email = "Email"
            }).Wait();

            var groups = adviser.GetAllClientGroups().Result;
            groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait();
            var account = groups[0].GetAccounts()[0];
            account.MakeTransaction(new CashAccountTransactionAccountCreation()
            {
                Amount = 150000,
                AnnualInterestSoFar = 0,
                Bsb = "123456",
                CashAccountName = "Account name",
                CashAccountNumber = "Number",
                CashAccountType = CashAccountType.TermDeposit,
                CurrencyType = CurrencyType.AustralianDollar,
                Frequency = Frequency.Annually,
                InterestRate = 0.9,
                MaturityDate = DateTime.Now.AddYears(1),
                TermsInMonths = 20,
                TransactionDate = DateTime.Now,
                TransactionFeeRecords = new List<TransactionFeeRecordCreation>()
                {
                    new TransactionFeeRecordCreation()
                    {
                        Amount = 1000,
                        TransactionExpenseType = TransactionExpenseType.AdviserTransactionFee
                    }
                }
            }).Wait();

            var assets = account.GetAssets();

            var cashAccountDiversification = assets.GetCashAccountTypeDiversification(repo).Result;

            Assert.IsTrue(cashAccountDiversification.Count == 5);
            Assert.IsTrue(cashAccountDiversification["TermDeposit"] == 150000);

            repo.Dispose();
        }
Пример #23
0
 public ClientController()
 {
     clientRepo = new ClientRepository();
     edisRepo = new EdisRepository();
 }
 public ClientRepository()
 {
     repo = new EdisRepository();
     db = new edisDbEntities();
 }
Пример #25
0
        public void CanCalculateAssetSectorialDiversification()
        {
            var repo    = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;

            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName     = "client first name",
                LastName      = "client last name",
                Address       = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob           = DateTime.Now,
                Phone         = "03699999",
                Email         = "Email"
            }).Wait();

            var groups = adviser.GetAllClientGroups().Result;

            groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait();
            var account = groups[0].GetAccounts()[0];

            account.MakeTransaction(new EquityTransactionCreation()
            {
                EquityType  = EquityTypes.AustralianEquity,
                FeesRecords = new List <TransactionFeeRecordCreation>()
                {
                    new TransactionFeeRecordCreation()
                    {
                        Amount = 100,
                        TransactionExpenseType = TransactionExpenseType.Brokerage
                    }
                },
                Name            = "Test Stock",
                NumberOfUnits   = 100,
                Price           = 20,
                Sector          = "Sector 1",
                Ticker          = Guid.NewGuid().ToString(),
                TransactionDate = DateTime.Now,
            }).Wait();

            account = groups[0].GetAccounts()[0];
            Assert.IsTrue(account.GetAssets().Count == 1);
            var asset = account.GetAssets()[0];

            Assert.IsTrue(asset.LatestPrice == 20);
            Assert.IsTrue(asset.TotalNumberOfUnits == 100);
            account.RecordIncome(new DividendPaymentCreation()
            {
                Amount    = 200,
                Franking  = 100,
                PaymentOn = DateTime.Now,
                Ticker    = ((AustralianEquity)asset).Ticker
            }).Wait();

            var assets          = account.GetAssets();
            var diversification = assets.GetAssetSectorialDiversification <AustralianEquity>(repo).Result;

            Assert.IsTrue(diversification.Count == 2);
            Assert.IsTrue(diversification["Sector 1"] == 2000);
            Assert.IsTrue(diversification["Sector 2"] == 0);
            repo.Dispose();
        }
Пример #26
0
        public void CanCalculateAssetPropertyTypeDiversification()
        {
            var repo = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;
            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName = "client first name",
                LastName = "client last name",
                Address = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob = DateTime.Now,
                Phone = "03699999",
                Email = "Email"
            }).Wait();

            var groups = adviser.GetAllClientGroups().Result;
            groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait();
            var account = groups[0].GetAccounts()[0];
            account.MakeTransaction(new PropertyTransactionCreation()
            {
                FeesRecords = new List<TransactionFeeRecordCreation>()
                {
                    new TransactionFeeRecordCreation()
                    {
                        Amount = 888,
                        TransactionExpenseType = TransactionExpenseType.AdviserTransactionFee
                    }
                },
                FullAddress = "668 Bourke Street, Melbourne, 3000",
                IsBuy = true,
                Price = 1980000,
                PropertyType = "Home",
                TransactionDate = DateTime.Now
            }).Wait();

            var assets = account.GetAssets();
            var propertyTypeDiversification = assets.GetDirectPropertyTypeDiversification(repo).Result;
            Assert.IsTrue(propertyTypeDiversification.Count == 2);
            Assert.IsTrue(propertyTypeDiversification["Home"] == 1980000);
        }
Пример #27
0
        public void AdviserCanCreateClientForGroup()
        {
            var repo = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;
            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName = "client first name",
                LastName = "client last name",
                Address = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob = DateTime.Now,
                Phone = "03699999",
                Email = "Email"
            }).Wait();

            //adviser.SetProfileEndDate(DateTime.Now);
            var groups = adviser.GetAllClientGroups().Result;
            adviser.CreateNewClient(new ClientRegistration()
            {
                GroupNumber = groups[0].ClientGroupNumber,
                FirstName = "second first name",
                LastName = "second last name",
                Address = "address",
                Dob = DateTime.Now,
                Phone = "039999999",
                Email = "*****@*****.**"
            }).Wait();
            //adviser.SetProfileEndDate(DateTime.Now);
            groups = adviser.GetAllClientGroups().Result;
            Assert.IsTrue(groups.Count == 1);
            Assert.IsTrue(groups[0].GetClients().Result.Count == 2);
            repo.Dispose();
        }
Пример #28
0
 public AdviserController()
 {
     edisRepo = new EdisRepository();
     advisorRepo = new AdviserRepository();
     //randomMoney = new Random();
 }
Пример #29
0
 public AdminController()
 {
     db       = new edisDbEntities();
     edisRepo = new EdisRepository();
 }
Пример #30
0
        public void CanCreateHomeLoan()
        {
            var repo = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;
            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName = "client first name",
                LastName = "client last name",
                Address = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob = DateTime.Now,
                Phone = "03699999",
                Email = "Email"
            }).Wait();

            var groups = adviser.GetAllClientGroups().Result;
            groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait();
            var account = groups[0].GetAccounts()[0];
            account.MakeTransaction(new PropertyTransactionCreation()
            {
                FeesRecords = new List<TransactionFeeRecordCreation>()
                {
                    new TransactionFeeRecordCreation()
                    {
                        Amount = 888,
                        TransactionExpenseType = TransactionExpenseType.AdviserTransactionFee
                    }
                },
                FullAddress = "668 Bourke Street, Melbourne, 3000",
                IsBuy = true,
                Price = 1980000,
                PropertyType = "Home",
                TransactionDate = DateTime.Now
            }).Wait();
            var assets = account.GetAssets();
            account.MakeTransaction(new HomeLoanTransactionCreation()
            {
                ExpiryDate = DateTime.Now.AddYears(2),
                GrantedOn = DateTime.Now,
                Institution = "ANZ",
                IsAcquire = true,
                LoanAmount = 300000,
                LoanRate = 0.07,
                LoanRepaymentType = LoanRepaymentType.DirectDebt,
                PropertyId = assets[0].Id,
                TypeOfMortgageRates = TypeOfMortgageRates.Combination
            }).Wait();
            var liabilities = account.GetLiabilities();

            Assert.IsTrue(liabilities.Count==1);
            Assert.IsTrue(liabilities[0] is MortgageAndHomeLiability);
        }
 public AdviserController()
 {
     edisRepo = new EdisRepository();
     advisorRepo = new AdviserRepository();
 }
        public IHttpActionResult adviserCreateNewClient_Entity(EntityClientCreationBindingModel model)
        {
            if (model != null)          //ModelState.IsValid &&
            {
                using (EdisRepository edisRepo = new EdisRepository())
                {
                    #region create asp user and send email
                    var user = new ApplicationUser
                    {
                        Email       = model.email,
                        UserName    = model.email,
                        PhoneNumber = model.contactPhone
                    };
                    var password    = "******";//Membership.GeneratePassword(10, 0);
                    var userManager = Request.GetOwinContext().GetUserManager <ApplicationUserManager>();
                    userManager.Create(user, password);
                    userManager.AddToRole(user.Id, AuthorizationRoles.Role_Preclient);
                    //EmailUtilities.SendEmailToUser(user.Id, "", "", "");//send password
                    #endregion

                    #region create client profile
                    ClientRegistration client = new ClientRegistration
                    {
                        CreateOn     = DateTime.Now,
                        ClientNumber = user.Id,
                        EntityName   = model.nameOfEntity,
                        EntityType   = model.typeOfEntity,
                        ABN          = model.abn,
                        ACN          = model.acn,
                        Email        = model.email,
                        Phone        = model.contactPhone,
                        ClientType   = BusinessLayerParameters.clientType_entity,
                        GroupNumber  = model.existingGroupId
                    };

                    string code        = userManager.GenerateEmailConfirmationTokenAsync(user.Id).Result;
                    string path        = HttpContext.Current.Server.MapPath("~/EmailTemplate/ConfirmEmail.html");
                    var    Url         = new System.Web.Mvc.UrlHelper(HttpContext.Current.Request.RequestContext);
                    var    callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Current.Request.Url.Scheme);
                    string content     = System.IO.File.ReadAllText(path).Replace("###Name###", user.UserName).Replace("###Confirm###", callbackUrl);
                    userManager.SendEmailAsync(user.Id, "Confirm your account", content);


                    #endregion

                    #region insert both records to db

                    edisRepo.CreateNewClientSync(client);
                    #endregion

                    #region create risk profile if present
                    if (model.riskProfile != null)
                    {
                        var         riskProfile = model.riskProfile;
                        RiskProfile profile     = new RiskProfile {
                            CapitalLossAttitude    = riskProfile.capitalLossAttitude,
                            ClientID               = edisRepo.GetClientSync(user.Id, DateTime.Now).Id,
                            Comments               = riskProfile.comments,
                            DateCreated            = DateTime.Now,
                            DateModified           = DateTime.Now,
                            IncomeSource           = riskProfile.incomeSource,
                            InvestmentKnowledge    = riskProfile.investmentKnowledge,
                            InvestmentObjective1   = riskProfile.investmentObjective1,
                            InvestmentObjective2   = riskProfile.investmentObjective2,
                            InvestmentObjective3   = riskProfile.investmentObjective3,
                            InvestmentProfile      = riskProfile.investmentProfile,
                            InvestmentTimeHorizon  = riskProfile.investmentTimeHorizon,
                            LongTermGoal1          = riskProfile.longTermGoal1,
                            LongTermGoal2          = riskProfile.longTermGoal2,
                            LongTermGoal3          = riskProfile.longTermGoal3,
                            MedTermGoal1           = riskProfile.medTermGoal1,
                            MedTermGoal2           = riskProfile.medTermGoal2,
                            MedTermGoal3           = riskProfile.medTermGoal3,
                            RetirementAge          = string.IsNullOrEmpty(riskProfile.retirementAge) ? (int?)null : Convert.ToInt32(riskProfile.retirementAge),
                            RetirementIncome       = riskProfile.retirementIncome,
                            RiskAttitude           = riskProfile.riskAttitude,
                            ShortTermAssetPercent  = riskProfile.shortTermAssetPercent,
                            ShortTermEquityPercent = riskProfile.shortTermEquityPercent,
                            ShortTermGoal1         = riskProfile.shortTermGoal1,
                            ShortTermGoal2         = riskProfile.shortTermGoal2,
                            ShortTermGoal3         = riskProfile.shortTermGoal3,
                            ShortTermTrading       = riskProfile.shortTermTrading,
                            riskLevel              = Int32.Parse(riskProfile.riskLevel)
                        };
                        edisRepo.CreateRiskProfileForClient(profile);
                    }
                    #endregion

                    //#region save all changes and return ok

                    //db.SaveChanges();
                    return(Ok());
                    //#endregion
                }
            }
            else
            {
                return(BadRequest(ModelState));
            }
        }
Пример #33
0
        public void CanGenerateMonthlyCashflowForAssets()
        {
            var repo = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;
            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName = "client first name",
                LastName = "client last name",
                Address = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob = DateTime.Now,
                Phone = "03699999",
                Email = "Email"
            }).Wait();
            var groups = adviser.GetAllClientGroups().Result;
            groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait();
            var account = groups[0].GetAccounts()[0];
            account.MakeTransaction(new EquityTransactionCreation()
            {
                EquityType = EquityTypes.AustralianEquity,
                FeesRecords = new List<TransactionFeeRecordCreation>()
                {
                    new TransactionFeeRecordCreation()
                    {
                        Amount = 1000,
                        TransactionExpenseType = TransactionExpenseType.Brokerage
                    }
                },
                Name = "Test Stock",
                NumberOfUnits = 100,
                Price = 20,
                Sector = "Test Sector",
                Ticker = "Test Ticker 01",
                TransactionDate = DateTime.Now,
            }).Wait();

            account = groups[0].GetAccounts()[0];
            var assets = account.GetAssets();
            var cashflow = assets.GetMonthlyCashflows();

            Assert.IsTrue(cashflow != null);
            Assert.IsTrue(cashflow.Count == 12);
            Assert.IsTrue(cashflow.Last().Expenses == 1000);
        }
Пример #34
0
        public void AdviserCanCreateGroupAccount()
        {
            var repo = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;
            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName = "client first name",
                LastName = "client last name",
                Address = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob = DateTime.Now,
                Phone = "03699999",
                Email = "Email"
            }).Wait();

            var groups = adviser.GetAllClientGroups().Result;
            groups[0].AddAccount("Testing", AccountType.GenenralPurpose).Wait();
            Assert.IsTrue(groups[0].GetAccounts().Count == 1);
            repo.Dispose();
        }
        public IHttpActionResult adviserCreateNewClient_Entity(EntityClientCreationBindingModel model)
        {
            if (model != null)          //ModelState.IsValid &&
            {
                using (EdisRepository edisRepo = new EdisRepository())
                {
                    #region create asp user and send email
                    var user = new ApplicationUser
                    {
                        Email = model.email,
                        UserName = model.email,
                        PhoneNumber = model.contactPhone
                    };
                    var password = "******";//Membership.GeneratePassword(10, 0);
                    var userManager = Request.GetOwinContext().GetUserManager<ApplicationUserManager>();
                    userManager.Create(user, password);
                    userManager.AddToRole(user.Id, AuthorizationRoles.Role_Preclient);
                    //EmailUtilities.SendEmailToUser(user.Id, "", "", "");//send password
                    #endregion

                    #region create client profile
                    ClientRegistration client = new ClientRegistration
                    {
                        CreateOn = DateTime.Now,
                        ClientNumber = user.Id,
                        EntityName = model.nameOfEntity,
                        EntityType = model.typeOfEntity,
                        ABN = model.abn,
                        ACN = model.acn,
                        Email = model.email,
                        Phone = model.contactPhone,
                        ClientType = BusinessLayerParameters.clientType_entity,
                        GroupNumber = model.existingGroupId
                    };

                    string code = userManager.GenerateEmailConfirmationTokenAsync(user.Id).Result;
                    string path = HttpContext.Current.Server.MapPath("~/EmailTemplate/ConfirmEmail.html");
                    var Url = new System.Web.Mvc.UrlHelper(HttpContext.Current.Request.RequestContext);
                    var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Current.Request.Url.Scheme);
                    string content = System.IO.File.ReadAllText(path).Replace("###Name###", user.UserName).Replace("###Confirm###", callbackUrl);
                    userManager.SendEmailAsync(user.Id, "Confirm your account", content);

                    #endregion

                    #region insert both records to db

                    edisRepo.CreateNewClientSync(client);
                    #endregion

                    //#region create risk profile if present
                    //if (model.riskProfile != null)
                    //{
                    //    var riskProfile = model.riskProfile;
                    //    RiskProfile profile = new RiskProfile
                    //    {
                    //        CapitalLossAttitude = riskProfile.capitalLossAttitude,
                    //        ClientID = client.ClientUserID,
                    //        Comments = riskProfile.comments,
                    //        DateCreated = DateTime.Now,
                    //        DateModified = DateTime.Now,
                    //        IncomeSource = riskProfile.incomeSource,
                    //        InvestmentKnowledge = riskProfile.investmentKnowledge,
                    //        InvestmentObjective1 = riskProfile.investmentObjective1,
                    //        InvestmentObjective2 = riskProfile.investmentObjective2,
                    //        InvestmentObjective3 = riskProfile.investmentObjective3,
                    //        InvestmentProfile = riskProfile.investmentProfile,
                    //        InvestmentTimeHorizon = riskProfile.investmentTimeHorizon,
                    //        LongTermGoal1 = riskProfile.longTermGoal1,
                    //        LongTermGoal2 = riskProfile.longTermGoal2,
                    //        LongTermGoal3 = riskProfile.longTermGoal3,
                    //        MedTermGoal1 = riskProfile.medTermGoal1,
                    //        MedTermGoal2 = riskProfile.medTermGoal2,
                    //        MedTermGoal3 = riskProfile.medTermGoal3,
                    //        RetirementAge = string.IsNullOrEmpty(riskProfile.retirementAge)? (int?)null: Convert.ToInt32(riskProfile.retirementAge),
                    //        RetirementIncome = riskProfile.retirementIncome,
                    //        RiskProfileID = Guid.NewGuid().ToString(),
                    //        RiskAttitude = riskProfile.riskAttitude,
                    //        ShortTermAssetPercent = riskProfile.shortTermAssetPercent,
                    //        ShortTermEquityPercent = riskProfile.shortTermEquityPercent,
                    //        ShortTermGoal1 = riskProfile.shortTermGoal1,
                    //        ShortTermGoal2 = riskProfile.shortTermGoal2,
                    //        ShortTermGoal3 = riskProfile.shortTermGoal3,
                    //        ShortTermTrading = riskProfile.shortTermTrading
                    //    };
                    //    db.RiskProfiles.Add(profile);
                    //}
                    //#endregion

                    //#region save all changes and return ok

                    //db.SaveChanges();
                    return Ok();
                    //#endregion
                }
            }
            else
            {
                return BadRequest(ModelState);
            }
        }
Пример #36
0
        public void CanRecordResearchValuesAndGetRatingForAsset()
        {
            var repo    = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;

            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName     = "client first name",
                LastName      = "client last name",
                Address       = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob           = DateTime.Now,
                Phone         = "03699999",
                Email         = "Email"
            }).Wait();

            var groups = adviser.GetAllClientGroups().Result;

            groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait();
            var account = groups[0].GetAccounts()[0];

            account.MakeTransaction(new EquityTransactionCreation()
            {
                EquityType      = EquityTypes.AustralianEquity,
                FeesRecords     = new List <TransactionFeeRecordCreation>(),
                Name            = "Test Stock",
                NumberOfUnits   = 1000,
                Price           = 29.64,
                Sector          = "Test Sector",
                Ticker          = "Test Ticker 01",
                TransactionDate = DateTime.Now,
            }).Wait();


            account.MakeTransaction(new EquityTransactionCreation()
            {
                EquityType      = EquityTypes.AustralianEquity,
                FeesRecords     = new List <TransactionFeeRecordCreation>(),
                Name            = "Test Stock",
                NumberOfUnits   = 1000,
                Price           = 29.64,
                Sector          = "Test Sector",
                Ticker          = "Test Ticker 02",
                TransactionDate = DateTime.Now,
            }).Wait();

            #region set up research values (this portion is optional, default values will be used if no research values available. Absent of research values will always generate 'Danger' rating)
            //record Australian equity f0 values
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.Beta), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.EarningsStability), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.FiveYearInformation), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.FiveYearReturn), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.Frank), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.InterestCover), 0, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.OneYearReturn), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.PayoutRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.ThreeYearReturn), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.BetaFiveYears), 1.1036, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.Capitalisation), 57225467107, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.CurrentRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.DebtEquityRatio), 0, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.DividendYield), 0.0621, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.EpsGrowth), 0.0772, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.FiveYearAlphaRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.FiveYearSharpRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.FiveYearSkewnessRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.FiveYearStandardDeviation), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.FiveYearTrackingErrorRatio), 1.1036, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.FundSize), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.GlobalCategory), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.CurrentRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.PriceEarningRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.QuickRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.ReturnOnAsset), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Ratios> .Property(r => r.ReturnOnEquity), 1, "Test Ticker 01", "Test Issuer").Wait();

            //record Australian Equity f1 research values
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.FinancialLeverage), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.Frank), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.InterestCover), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.IntrinsicValue), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.OneYearReturn), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.OneYearRevenueGrowth), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.PriceEarningRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.ReturnOnAsset), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.ReturnOnEquity), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.CreditRating), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.DebtEquityRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.DividendYield), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.EpsGrowth), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.FairValueVariation), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.FiveYearTotalReturn), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.MaxManagementExpenseRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.MorningStarAnalyst), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.MorningstarRecommendation), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.OneYearAlpha), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.OneYearInformationRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.OneYearBeta), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.OneYearSharpRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.OneYearTrackingError), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.PerformanceFee), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof <Recommendation> .Property(r => r.YearsSinceInception), 1, "Test Ticker 01", "Test Issuer").Wait();
            #endregion
            var assets = account.GetAssets();
            var equityWithResearchValues    = assets.OfType <Equity>().First(a => a.Ticker == "Test Ticker 01");
            var equityWithNoResearchValues  = assets.OfType <Equity>().First(a => a.Ticker == "Test Ticker 02");
            var rating_withResearchValues   = equityWithResearchValues.GetRating();
            var rating_withNoResearchValues = equityWithNoResearchValues.GetRating();
            Assert.IsTrue(rating_withNoResearchValues.SuitabilityRating == SuitabilityRating.Danger);
            Assert.IsTrue(rating_withResearchValues != null);
        }
Пример #37
0
        public void CanRecordResearchValuesAndGetRatingForAsset()
        {
            var repo = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;
            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName = "client first name",
                LastName = "client last name",
                Address = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob = DateTime.Now,
                Phone = "03699999",
                Email = "Email"
            }).Wait();

            var groups = adviser.GetAllClientGroups().Result;
            groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait();
            var account = groups[0].GetAccounts()[0];
            account.MakeTransaction(new EquityTransactionCreation()
            {
                EquityType = EquityTypes.AustralianEquity,
                FeesRecords = new List<TransactionFeeRecordCreation>(),
                Name = "Test Stock",
                NumberOfUnits = 1000,
                Price = 29.64,
                Sector = "Test Sector",
                Ticker = "Test Ticker 01",
                TransactionDate = DateTime.Now,
            }).Wait();

            account.MakeTransaction(new EquityTransactionCreation()
            {
                EquityType = EquityTypes.AustralianEquity,
                FeesRecords = new List<TransactionFeeRecordCreation>(),
                Name = "Test Stock",
                NumberOfUnits = 1000,
                Price = 29.64,
                Sector = "Test Sector",
                Ticker = "Test Ticker 02",
                TransactionDate = DateTime.Now,
            }).Wait();

            #region set up research values (this portion is optional, default values will be used if no research values available. Absent of research values will always generate 'Danger' rating)
            //record Australian equity f0 values
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.Beta), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.EarningsStability), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.FiveYearInformation), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.FiveYearReturn), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.Frank), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.InterestCover), 0, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.OneYearReturn), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.PayoutRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.ThreeYearReturn), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.BetaFiveYears), 1.1036, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.Capitalisation), 57225467107, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.CurrentRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.DebtEquityRatio), 0, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.DividendYield), 0.0621, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.EpsGrowth), 0.0772, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.FiveYearAlphaRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.FiveYearSharpRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.FiveYearSkewnessRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.FiveYearStandardDeviation), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.FiveYearTrackingErrorRatio), 1.1036, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.FundSize), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.GlobalCategory), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.CurrentRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.PriceEarningRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.QuickRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.ReturnOnAsset), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Ratios>.Property(r => r.ReturnOnEquity), 1, "Test Ticker 01", "Test Issuer").Wait();

            //record Australian Equity f1 research values
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.FinancialLeverage), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.Frank), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.InterestCover), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.IntrinsicValue), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.OneYearReturn), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.OneYearRevenueGrowth), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.PriceEarningRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.ReturnOnAsset), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.ReturnOnEquity), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.CreditRating), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.DebtEquityRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.DividendYield), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.EpsGrowth), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.FairValueVariation), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.FiveYearTotalReturn), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.MaxManagementExpenseRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.MorningStarAnalyst), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.MorningstarRecommendation), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.OneYearAlpha), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.OneYearInformationRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.OneYearBeta), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.OneYearSharpRatio), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.OneYearTrackingError), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.PerformanceFee), 1, "Test Ticker 01", "Test Issuer").Wait();
            repo.FeedResearchValueForEquity(Nameof<Recommendation>.Property(r => r.YearsSinceInception), 1, "Test Ticker 01", "Test Issuer").Wait();
            #endregion
            var assets = account.GetAssets();
            var equityWithResearchValues = assets.OfType<Equity>().First(a => a.Ticker == "Test Ticker 01");
            var equityWithNoResearchValues = assets.OfType<Equity>().First(a => a.Ticker == "Test Ticker 02");
            var rating_withResearchValues = equityWithResearchValues.GetRating();
            var rating_withNoResearchValues = equityWithNoResearchValues.GetRating();
            Assert.IsTrue(rating_withNoResearchValues.SuitabilityRating == SuitabilityRating.Danger);
            Assert.IsTrue(rating_withResearchValues != null);
        }
Пример #38
0
        public void AdviserCanCreateClientWithProperAgeCalculation()
        {
            var repo = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;
            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName = "client first name",
                LastName = "client last name",
                Address = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob = DateTime.Now.AddYears(-12),
                Phone = "03699999",
                Email = "Email"
            }).Wait();

            var groups = adviser.GetAllClientGroups().Result;
            Assert.IsTrue(groups[0].GetClients().Result[0].Age == 12);
            repo.Dispose();
        }
Пример #39
0
 public void CanCreateAdviser()
 {
     var repo = new EdisRepository();
     var adviser = repo.CreateAdviser("Test", "Adviser").Result;
     Assert.IsTrue(adviser.FirstName == "Test");
     repo.Dispose();
 }
Пример #40
0
        //private RebalanceRepository rebRepo;

        public RebalanceController()
        {
            //rebRepo = new RebalanceRepository();
            edisRepo = new EdisRepository();
        }
Пример #41
0
        public void CanCreateInsuranceTransaction()
        {
            var repo = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;
            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName = "client first name",
                LastName = "client last name",
                Address = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob = DateTime.Now,
                Phone = "03699999",
                Email = "Email"
            }).Wait();
            var groups = adviser.GetAllClientGroups().Result;
            groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait();
            var account = groups[0].GetAccounts()[0];
            account.MakeTransaction(new InsuranceTransactionCreation()
            {
                ExpiryDate = DateTime.Now.AddYears(1),
                AmountInsured = 10000,
                EntitiesInsured = "something",
                GrantedOn = DateTime.Now,
                InsuranceType = InsuranceType.AssetInsurance,
                IsAcquire = true,
                Issuer = "Issuer",
                NameOfPolicy = "Name",
                PolicyAddress = "Address",
                PolicyNumber = "Number",
                PolicyType = PolicyType.Accident,
                Premium = 100
            }).Wait();

            var liabilities = account.GetLiabilities();
            Assert.IsTrue(liabilities.Count == 1);
        }
Пример #42
0
 public AdviserController()
 {
     edisRepo    = new EdisRepository();
     advisorRepo = new AdviserRepository();
     //randomMoney = new Random();
 }
Пример #43
0
        public void CanCalculateAssetSectorialDiversification()
        {
            var repo = new EdisRepository();
            var adviser = repo.CreateAdviser("Test", "Adviser").Result;
            adviser.CreateNewClientGroup(new ClientGroupRegistration()
            {
                AdviserNumber = adviser.AdviserNumber,
                FirstName = "client first name",
                LastName = "client last name",
                Address = "668 Bourke Street, Melbourne, 3000, Victoria",
                Dob = DateTime.Now,
                Phone = "03699999",
                Email = "Email"
            }).Wait();

            var groups = adviser.GetAllClientGroups().Result;
            groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait();
            var account = groups[0].GetAccounts()[0];
            account.MakeTransaction(new EquityTransactionCreation()
            {
                EquityType = EquityTypes.AustralianEquity,
                FeesRecords = new List<TransactionFeeRecordCreation>()
                {
                    new TransactionFeeRecordCreation()
                    {
                        Amount = 100,
                        TransactionExpenseType = TransactionExpenseType.Brokerage
                    }
                },
                Name = "Test Stock",
                NumberOfUnits = 100,
                Price = 20,
                Sector = "Sector 1",
                Ticker = Guid.NewGuid().ToString(),
                TransactionDate = DateTime.Now,
            }).Wait();

            account = groups[0].GetAccounts()[0];
            Assert.IsTrue(account.GetAssets().Count == 1);
            var asset = account.GetAssets()[0];
            Assert.IsTrue(asset.LatestPrice == 20);
            Assert.IsTrue(asset.TotalNumberOfUnits == 100);
            account.RecordIncome(new DividendPaymentCreation()
            {
                Amount = 200,
                Franking = 100,
                PaymentOn = DateTime.Now,
                Ticker = ((AustralianEquity)asset).Ticker
            }).Wait();

            var assets = account.GetAssets();
            var diversification = assets.GetAssetSectorialDiversification<AustralianEquity>(repo).Result;
            Assert.IsTrue(diversification.Count == 2);
            Assert.IsTrue(diversification["Sector 1"] == 2000);
            Assert.IsTrue(diversification["Sector 2"] == 0);
            repo.Dispose();
        }
Пример #44
0
 public AdminController()
 {
     db = new edisDbEntities();
     edisRepo = new EdisRepository();
 }
Пример #45
0
        //private RebalanceRepository rebRepo;

        public RebalanceController()
        {
            //rebRepo = new RebalanceRepository();
            edisRepo = new EdisRepository();
        }