10x - Public Applications - Retirement Plan

Public facing endpoints and integration instructions for the Retirement Plan app and tools.

Index

Playground Functions

Retirement Plan Playground

Endpoints

UAT
https://publicappsuat.10x.co.za/dists/retirementplan/retirementplan.js

Production
https://apps.10x.co.za/dists/retirementplan/retirementplan.js

How to use

Add a container div, the stylesheet, and the script to your page.

Initialize the tool by calling the initRetirementPlan function on the window object.


<!DOCTYPE html>
    <html>
        <head>
            ...
            <link rel='stylesheet' href='https://publicappsuat.10x.co.za//dists/retirementplan/css/styles.css'>
            <link rel='stylesheet' href='https://publicappsuat.10x.co.za//dists/retirementplan/css/main.css'>
        </head>
        ...
        <body>
            ...
            <div id='retirementPlanEmbed'></div>
            ...
            <script src='https://publicappsuat.10x.co.za/dists/retirementplan/retirementplan.js' type='text/javascript'></script>
            <script type='text/javascript'>
                var initialValues = { /* object containing initial values, see example below */ };
                function exitFunction (results) { /* function that executes when the user continues */ };
      
                window.initRetirementPlan(initialValues, exitFunction);
            </script>
        </body>
    </html>
    

Initialization values

The initialize function requires an object with the following properties

{
retirementAge          number // goal retirement age
age                    number // current age
gender                 string // either 'M' or 'F'
salary                 number // current salary
goalLumpsum            number // Lumpsum goal (can be calculated with the functions below)
goalPm                 number // Monthly income goal (can be calculated with the functions below)
salaryTargetPercent    number // percentage of current salary (0 to 100) to be earned after retirement
monthlySavingPercent   number // percentage of current salary being saved each month
totalSavings           number // Current total retirement savings
return                 number // (optional) Expected market performance. Options [1: Average, 2: Below Average]
portfolio              number // (optional) The projection portfolio to use. Options [1: Default, 2: Low Equity, 3: Medium Equity, 4: High Equity]
realWageGrowthPercent  number // (optional) a factor between 0 and 1. Defaults to 1 if excluded
}

Exit values

The exit function will be called with an object with the following properties

{
... all user selected values, and ...
projectedLumpsumTotal                number // Projected final lumpsum amount
projectedLumpsumGrowth               number // Projected final growth
projectedLumpsumContribution         number // Total contribution amount
calculatedMonthlyTotal               number // Projected monthly income
projected10xOnlyLumpsumTotal         number // Projected final lumpsum amount (using 10x model)
calculated10xOnlyMonthlyTotal        number // Projected monthly income (using 10x model)
projected3rdPartyOnlyLumpsumTotal    number // Projected final lumpsum amount (industry model)
calculated3rdPartyOnlyMonthlyTotal   number // Projected monthly income (industry model)
}

Example of RP Playground --

Change the initial values and re-initialize:

To use the retirement goal functions

Script Endpoints


    UAT
    http://appsuat.10x.co.za/dists/retirementplan/retirementgoal.functions.js

    Production
    http://apps.10x.co.za/dists/retirementplan/retirementgoal.functions.js

How to use

Add the script to your page, then the two goal functions will be available on the window object

<html>
    ...
    <body>
        ...
        <script src='http://appsuat.10x.co.za/dists/retirementplan/retirementgoal.functions.js' type='text/javascript'></script>
        <script type='text/javascript'>
            // You can subsequently use the two provided functions (see below for parameter types):

            var goalMonthly = window.retirementPlanFunctions.calculateGoalPerMonth(retirementAge, currentAge, salary, salaryTargetPercent, realWageGrowthPercent);

            var goalLumpsum = window.retirementPlanFunctions.calculateGoalLumpsum(retirementAge, currentAge, gender, salary, salaryTargetPercent, realWageGrowthPercent);             
        </script>
    </body>
</html>

Function parameter types

retirementAge:          number // goal retirement age  
currentAge:             number // current age
gender:                 string // either "M" or "F"
salary:                 number // current salary
salaryTargetPercent     number // percentage of current salary (0 to 100) to be earned after retirement
realWageGrowthPercent:  number // (optional) a factor between 0 and 1. Defaults to 1 if excluded