Example #1
0
        public PensionFundInfo GetPensionFundInfo(string pensionFundContractAddress)
        {
            PensionFund pensionFund = GetByContract(pensionFundContractAddress);
            Dictionary <int, double> assetReference = new Dictionary <int, double>();
            List <Asset>             assets         = new List <Asset>();

            foreach (PensionFundReferenceContract reference in pensionFund.Option.PensionFundContract.PensionFundReferenceContract)
            {
                ReferenceContract contract = ReferenceContractBusiness.Get(reference.ReferenceType);
                assets.Add(new Asset()
                {
                    Address    = contract.Address,
                    Name       = contract.Description,
                    Percentage = reference.Percentage
                });
                IEnumerable <ReferenceValue> values = contract.ReferenceValue.OrderBy(c => c.Period);
                double baseValue = values.ElementAt(0).Value;
                foreach (ReferenceValue value in values)
                {
                    if (!assetReference.ContainsKey(value.Period))
                    {
                        assetReference[value.Period] = 0;
                    }
                    assetReference[value.Period] += (value.Value / baseValue) * reference.Percentage / 100;
                }
            }
            return(new PensionFundInfo()
            {
                PensionFundName = pensionFund.Name,
                EmployeeName = pensionFund.Option.Company.Employee.Name,
                CompanyName = pensionFund.Option.Company.Name,
                PensionFundAddress = pensionFund.Option.Address,
                EmployeeAddress = pensionFund.Option.Company.Employee.Address,
                CompanyAddress = pensionFund.Option.Company.Address,
                PensionFundFee = pensionFund.Option.Fee,
                PensionFundLatePenalty = pensionFund.Option.LatePenalty,
                AuctusFee = PensionFundContractBusiness.AUCTUS_FEE,
                ContractAddress = pensionFund.Option.PensionFundContract.Address,
                ContractTransactionHash = pensionFund.Option.PensionFundContract.TransactionHash,
                ContractBlockNumber = pensionFund.Option.PensionFundContract.BlockNumber.Value,
                AssetsReferenceValue = assetReference.Select(c => new AssetsReferenceValue()
                {
                    Period = c.Key, Value = c.Value
                }),
                Assets = assets,
                EmployeeBaseContribution = pensionFund.Option.Company.Employee.Salary * pensionFund.Option.Company.Employee.Contribution / 100,
                CompanyBaseContribution = pensionFund.Option.Company.Employee.Salary * pensionFund.Option.Company.BonusRate / 100 *
                                          Math.Min(pensionFund.Option.Company.MaxSalaryBonusRate, pensionFund.Option.Company.Employee.Contribution) / 100
            });
        }
Example #2
0
 public ReferenceContract GetBitcoinReference()
 {
     return(ReferenceContractBusiness.GetBitcoinReference());
 }
Example #3
0
 public ReferenceContract GetVWEHXReference()
 {
     return(ReferenceContractBusiness.GetVWEHXReference());
 }
Example #4
0
 public ReferenceContract GetMSCIWorldReference()
 {
     return(ReferenceContractBusiness.GetMSCIWorldReference());
 }
Example #5
0
 public ReferenceContract GetSP500Reference()
 {
     return(ReferenceContractBusiness.GetSP500Reference());
 }