As clients have unique demands and increasingly expect personalized financial advice, matching them with the right portfolio isn’t always easy. Discover how Bambu’s ‘Health Check’ feature used alongside optimization models can help take this weight off your shoulders by simplifying the recommendation process.
Bambu’s Robo-advisory platform runs a ‘Health Check’ to determine the achievability of clients’ target goals based on analysis of their current financial status. The Goal Optimization API applies results of the ‘Health Check’ to suggest the most relevant portfolios to clients.
Use Case:
We’re examining a goals-based investment platform that recommends users different portfolios annually to help them achieve their financial goals. Each portfolio has an expected return, sorted in an ascending order based on the return (i.e. Portfolio 1 has returns of 3%, Portfolio 2 has returns of 5%, etc.).
For end-clients, their journey begins with indicating the following: the amount of money they have now, how much they plan to invest each year, the portfolio they are keen on investing for each year, the investment time horizon, and what their desired goal amount is at the end of this investment time horizon. With this information, the platform performs a projection to determine if the user can achieve their goal by the investment time horizon. The projected value of a portfolio is based on the formula:
n is the year number based on the client’s time horizon, FVn is the projected future value in the year n, ci is the investment amount in year i, ri is the portfolio returns in year i.


The orange line shows the projected value per year and the purple line shows the desired goal amount.
Using this formula, there are three possible outcomes and recommendations to optimize portfolios.


Outcomes and Solutions
Outcome 1: ‘Just Nice’
Under the ‘Just Nice’ scenario, the projected value meets the desired goal amount. The definition of “meets” is that the projected value is within 0-5% above the desired goal amount. In this scenario, no recommendation is needed.


Outcome 2: ‘Surplus’
A ‘Surplus’ means that the projected value of the chosen portfolio is greater than the desired goal amount. In this case, the recommendation should be to adjust the client’s chosen portfolio (i.e. choose a portfolio that reduces the portfolio’s returns, ri, so that the projected value falls within 0-5% of the desired goal amount). At the same time, the returns of the newly recommended portfolio in year i+1 must be lower or equal to the portfolio returns recommended in year i. This constraint is impacted by the “de-risking” concept, which states that as your time horizon decreases, the amount of risk you take should decrease as well.


To recommend the right portfolio, a Random Search Constraint Programming algorithm is used. The investment amount per year, ci, is fixed and the decision variable is the portfolio returns per year, ri, where the domain ri is the set of possible portfolio returns available for investment. For example, if there are 3 possible portfolios to invest in (portfolio 1 – returns 3%, portfolio 2 – returns 5%, and portfolio 3 – returns 7%), then ri ∈ {3%, 5%, 7%}. The 2 constraints for the function are as follows:
1) The future value at time n must be within 0-5% above the client’s desired goal amount.
2) The portfolio returns in year i+1 must be lower or equal to the portfolio returns in year i.
After inputting the variables, the model recommends a portfolio each year that shifts the result from “Surplus” to “Just Nice”.
The result shows that the new projected value (orange line) “meets” the desired goal amount (purple line) and the black line shows the recommended number of portfolios each year.
Comparing the original projections (blue line) with the recommended projections (orange line), we can see that it’s possible to arrive at the desired outcome by changing the combination of portfolios. Constraint satisfaction is used in place of constraint optimization because the main objective is to “meet” the desired goal amount, i.e. within 0-5% above the desired goal amount, instead of being as close as possible to the desired goal amount. If constraint optimization with an objective minimization function is used instead, it would have taken longer to find a suitable option due to the smaller set of solutions possible.
Outcome 3: ‘Shortfall’
Having a ‘Shortfall’ means that the projected value of the portfolio set is less than the desired goal amount. The recommendation should be to increase the client’s total investment amount ∑ 𝑐𝑖 𝑛 𝑖=0 so that the projected value would increase.


The client can choose one of three options if there is a shortfall – the investment amount, ci, for each year remains constant, increases, or decreases. A linear programming model is used to solve this problem.
Option 1 – Constant Investment Amount per year
The portfolio returns per year, ri, is now fixed and the decision variable is the investment amount per year, ci. The objective of the function is to close the gap between the projected value at year n and the desired goal amount:
The constraints are:
1) The projected value must be equal or greater than the desired goal amount.
Brent’s algorithm was used to find a local minimum. The solution obtained shows that the projected value in year n (green line) meets the desired goal amount (purple line) and the recommended investment amount (red line), ci is the same for all years.


Option 2 – Increasing Investment Amount per year
This portfolio asset allocation is ideal for the younger investors whose capacity to invest will increase over time as they accrue working experience and their income grows. To determine the investment amount for each year, ci, we change the 2nd constraint to fit this requirement, where:
The Sequential Least Squares Programming algorithm is used to solve this problem. The user is still able to achieve their desired goal through increasing the amount invested every year. Figure 10 and 11 illustrate the projected value in year n (green line) meeting the desired goal amount (purple line) and the recommended investment amount (red line) increases each year.


Option 3 – Decreasing Investment Amount per year
For senior investors who have less capacity to invest as their risk tolerance and investment time horizon decreases, this model of asset allocation is recommended. To determine the investment amount for each year, ci, we change the 2nd constraint to fit this requirement, where:
Once again, the Sequential Least Squares Programming algorithm is used. The solution shows that the projected value in year n (green line) meets the desired goal amount (purple line) and the recommended investment amount (red line), ci, decreases each year.


Conclusions: Visualising these solutions
Bambu’s Robo-advisory platform transforms the outcomes of these algorithms into a product feature, illustrating the concepts mentioned so far in a simple and digestible visual for end-clients.


When the right optimization models are deployed appropriately, matching end-clients with the right portfolios becomes substantially easier. If you’re interested in finding out more about Bambu’s ‘Health Check’ feature, you can access and read the documentation from our API Library here. Explore and test run our API repository, at no extra cost.
Appendix: Explaining the Algorithms used
Random Search Algorithm
Let f: ℝn → ℝ be the fitness or cost function which must be minimized. Let x ∈ ℝn designate a position or candidate solution in the search-space. The basic RS algorithm can then be described as:
1) Initialize x with a random position in the search-space.
2) Until a termination criterion is met (e.g. number of iterations performed, or adequate fit achieved), repeat the following:
a. Sample a new position y from the hypersphere of a given radius surrounding the current position x
i.There are a couple of techniques for sampling a hypersphere such as Marsaglia’s technique
b. If f(y) < f(x) then move to the new position by setting x = y
Brent’s Algorithm
Brent’s method is a root-finding algorithm which combines root bracketing, bisection, and inverse quadratic interpolation. The algorithm tries to use the potentially fast-converging secant method or inverse quadratic interpolation if possible, but it falls back to the more robust bisection method if necessary.
It uses a Lagrange interpolating polynomial of degree 2. This method will always converge as long as the values of the function are computable within a given region containing a root. Given three points x1, x2 and x3 Brent’s method fits x as a quadratic function of y, then uses the interpolation formula:
Subsequent root estimates are obtained by setting y=0, giving the following:
Sequential Least Squares Programming
Given a nonlinear programming problem of the form:
Where 𝜆 𝑎𝑛𝑑 𝜎 are Lagrange multipliers. xk can be defined as a basic sequential quadratic programming algorithm. An appropriate search direction dk can be defined as a solution to the quadratic programming subproblem. The formula is as follows: