![]() |
eFinancialPlanner
V1.0 (proof of concept)
Personal Financial Planning based on Maslowian Portfolio Theory
|
Public Member Functions | |
| void | show_simulation () |
| simulation (int investor) | |
| void | simulate () |
| int | get_nbrMonths2simulate () |
| returns the number of months to simulate as in "37" More... | |
| void | plot_market_evol () |
| void | solve () |
| allocates means (with a benchmark) to goals More... | |
| int | get_nbr_goals () |
| int | get_max_month_for_lower_goals (int g) |
| void | javaGraph (int g, string xtra_var="", string xtra_label="", int followup_mnth=0) |
| void | prepare_javaVars_colors (int g, int followup_mnth) |
| void | parse_javaGraph (int g, string xtra_var="", string xtra_label="") |
| plots the chartOverview More... | |
| string | get_full_name () |
| float | age (int Mnbr=0) |
| int | months2simulate () |
| int | load_from_db (string investorID) |
| void | load_ER (int person=0, char person_type= 'i') |
| void | save_ER (int person=0, char person_type= 'i') |
| void | load_covar (int person, char person_type= 'i') |
| void | save_covar (int person, char person_type= 'i') |
| bool | get_portf_from_db (int id) |
| string | get_description () |
| void | set_mu (float(*AssetClass_mu)) |
| void | set_sigma (float(*AssetClass_varCov)) |
Public Attributes | |
| std::map< int, aGOAL > | goalZ |
| map containing all goals More... | |
| int | investor_id |
| string | user_name |
| string | first_name |
| string | last_name |
| string | password |
| string | currency |
| the default currency for that customer More... | |
| struct tm | birth_date |
| float | simulate_till_age |
| float * | assetClass_covar = new float[(NBR_ASSET_CLASSES + 1) * (NBR_ASSET_CLASSES + 1)] |
| float | assetClass_mu [(NBR_ASSET_CLASSES+1)] |
| note: index 0 not used More... | |
| std::map< int, string > | assetClass_name |
| note: index 0 not used More... | |
| std::map< int, float > | ER |
| std::map< int, std::map< int, float > > | covar |
| int | portfolio_id |
| string | description |
| float | weights [NBR_ASSET_CLASSES] |
| the weights of the asset classes (ordered as the asset classes) More... | |
| float | pMu |
| the MONTHLY return More... | |
| float | pLogR |
| the MONTHLY log-return More... | |
| float | pSigma |
| the MONTHLY volatility More... | |
Protected Member Functions | |
| void | set_followup_color_prae (float Vlow, float Vmed, float Vhigh, int g) |
| void | set_followup_color_post (float V, int g) |
| int | age2monthNbr (float theAge) |
| string | dateStr2Age (string the_date) |
| bool | save () |
| int | get_from_db (string investorID, string password) |
| bool | add_to_db () |
| bool | exists (int iid) |
| void | load_preferences () |
| sets the experience, knowledge and desirability vectors More... | |
| bool | save_preferences () |
| sets the experience, knowledge and desirability vectors More... | |
| void | set_max_exposure () |
| sets the max_exposure vector based on the experience, knowledge and desirability More... | |
| bool | set_scale (string scale_type, int ac, int val) |
| void | reload_ER (int person, char person_type= 'i') |
| TODO: the ER and assetClass_mu as well as the covar and assetClass_covar are redundant ==> eliminate the C-style assetClass_*. More... | |
| void | reload_covar (int person, char what2do, char person_type= 'i') |
Protected Attributes | |
| int | nbrMonths |
| the number of months to simulate, per goal we simulate max(realization_monthNbr, nbrMonths) More... | |
| std::map< int, std::map< int, float > > | market_return |
| std::map< int, portfolio > | portfolios |
| the standard portfolios More... | |
| std::map< int, int > | experience |
| std::map< int, int > | knowledge |
| std::map< int, int > | desirability |
| std::map< int, float > | max_exposure |
| the maximum exposure per asset class More... | |
Private Member Functions | |
| void | set_nbrMonths2simulate_from_env () |
| void | simulate_market () |
| sets nbrMonths More... | |
| void | simulate_portfolios () |
simulation
class used to simulate behaviour of the investment problem after optimization
(c) Philippe J.S. De Brouwer
last modification: 2014-08
Definition at line 12 of file simulation.class.cpp.
| simulation::simulation | ( | int | investor | ) |
CONSTRUCTOR of the class simulation
Definition at line 37 of file simulation.class.cpp.
|
protectedinherited |
add_to_db
does not check data any more, simply tries to push it to the DB only returns 0 if the userID already exists.
Definition at line 313 of file investor.class.cpp.
|
inlineinherited |
returns the age of a customer in years (with decimal part)
Definition at line 108 of file investor.class.cpp.
|
inlineprotectedinherited |
age2monthNbr
returns the month number for a given age note that this is negative for ages younger than the actual age.
Definition at line 200 of file investor.class.cpp.
|
inlineprotectedinherited |
dateStr2Age
Definition at line 209 of file investor.class.cpp.
|
protectedinherited |
exists
checks if a given investor-id really exists
Definition at line 343 of file investor.class.cpp.
|
inherited |
returns the label of the portfolio
Definition at line 86 of file portfolio.class.cpp.
|
protectedinherited |
get_from_db returns the investor_id if successful (otherwise 0)
Definition at line 249 of file investor.class.cpp.
|
inherited |
overloading << operator overload the << operator to output the goal in a readable format get_full_name returns the full name of an investor
Definition at line 103 of file investor.class.cpp.
|
inherited |
returns the maximum term of all the other LOWER ranking goals. The higher ranking goals already have allocated all the means that they require, so we can disregard them here.
goal_type = 0 is the unallocated goal type, so this goal should not be taken into account here.
Definition at line 945 of file investment_problem.class.cpp.
|
inherited |
returns the number of goals
Definition at line 936 of file investment_problem.class.cpp.
| int simulation::get_nbrMonths2simulate | ( | ) |
returns the number of months to simulate as in "37"
returns nbrMonths (to simulate)
Definition at line 259 of file simulation.class.cpp.
|
inherited |
load the definitions from the database
note: we have to create a second instance of the sql connection as this is called while the object db is in use!
Definition at line 32 of file portfolio.class.cpp.
|
inherited |
javaGraph
plots the overview-graph for the given goal
xtav_Var and xtra_label add a series of data that is delivered in text format xtra_var = [45,2000], [45.5,2200] xtra_label = "history" followup_mnth = 0 for feedback and simulation screen, and for the follow up screen it is the number of months we look into the future.
Definition at line 1089 of file investment_problem.class.cpp.
|
inherited |
load_covar
< note: person_type = 'i' for persons (later to provide for 'a' advisor, organization, etc.)
< TODO eliminate this
if we did not find a personalized expectation for each asset class, then we load the default values
< TODO eliminate this
Definition at line 135 of file market.class.cpp.
|
inherited |
load_ER
< note: person_type = 'i' for persons (later to provide for 'a' advisor, organization, etc.)
Definition at line 61 of file market.class.cpp.
|
inherited |
returns the investor_id if successful (otherwise 0) NOTE for user interaction use get_from_db(uid, password) for password verification!!
Definition at line 134 of file investor.class.cpp.
|
protectedinherited |
sets the experience, knowledge and desirability vectors
set_preferences
Definition at line 383 of file investor.class.cpp.
|
inlineinherited |
months2simulate
Definition at line 124 of file investor.class.cpp.
|
inherited |
plots the chartOverview
parse_javaGraph
parses the line plot of the three scenarios and the goal to the output (webbrowser). It parses as well the
Definition at line 1103 of file investment_problem.class.cpp.
| void simulation::plot_market_evol | ( | ) |
plot_market_evol
plots the evolution of the different asset classes (is goal independent)
initialize:
show the table if desired
build the simulation variables:
cout the script
Definition at line 138 of file simulation.class.cpp.
|
inherited |
prepare_javaVars_colors
followup_mnth is used as the startmonth for the followUp-Screen (in all other graphs it will be zero – its default)
exp = expected value med = median low = alpha quantile high = 1- alpha quantile
< the weighted average of the number of months that investments are in portfolio
TODO in the function below use another rate for NEGATIVE amounts, to mymic lending!
parse_javaGraph(g, s1, s2, s3, s4, xtra_var, xtra_label);
< place al the variables
Definition at line 970 of file investment_problem.class.cpp.
|
protectedinherited |
reload_vol
the situation here is more complex as the user expect that only the volatilities will be reset to the default values and not the correlations ...
what2do = [v|c|b] as in [vol | corr | both]
< both
< volatilities
< correlations
Definition at line 281 of file market.class.cpp.
|
protectedinherited |
TODO: the ER and assetClass_mu as well as the covar and assetClass_covar are redundant ==> eliminate the C-style assetClass_*.
set_mu
the expect value for all asset classes set_covar
the expect value for all assets reload_ER
note: person_type = 'i' for persons (later to provide for 'a' advisor, organization, etc.)
this function simply deletes the personalized expected returns. This is sufficient because later we check if they exists and only then load them (see function load_ER().
Definition at line 247 of file market.class.cpp.
|
protectedinherited |
save
Definition at line 220 of file investor.class.cpp.
|
inherited |
save_covar
Definition at line 172 of file market.class.cpp.
|
inherited |
save_ER
Definition at line 109 of file market.class.cpp.
|
protectedinherited |
sets the experience, knowledge and desirability vectors
Definition at line 416 of file investor.class.cpp.
|
inlineprotectedinherited |
set_followup_color_post sets the color of the goal in case the simulation is LONGER than the realization date of the goal
Definition at line 1246 of file investment_problem.class.cpp.
|
inlineprotectedinherited |
set_followup_color_prae
sets the color of the goal in case the simulations ends PRIOR to the realization date of the goal
Definition at line 1234 of file investment_problem.class.cpp.
|
protectedinherited |
sets the max_exposure vector based on the experience, knowledge and desirability
get_max_exposure
sets the map max_exposure in this object
Definition at line 363 of file investor.class.cpp.
|
inherited |
sets the expected return for the portfolio
Definition at line 94 of file portfolio.class.cpp.
|
private |
get_nbrMonths2simulate_from_env
returns nothing sets this->nbrMonths
if nMonths is supplied, then test and use it, otherwise use defaultValue
Definition at line 223 of file simulation.class.cpp.
|
protectedinherited |
set_scale
Definition at line 402 of file investor.class.cpp.
|
inherited |
sets the standard deviation for the portfolio: this->sigma
Definition at line 112 of file portfolio.class.cpp.
| void simulation::show_simulation | ( | ) |
| void simulation::simulate | ( | ) |
simulate
simulates one possible scenario for what can happen after the goals are set
TODO in absense of gGaol.load() we solve again ...!!!!!!!!!!
< does this for each goal and sets goalZ[g].simulation_string (requires solve())
Definition at line 49 of file simulation.class.cpp.
|
private |
sets nbrMonths
simulate_market
simulates one possible scenario for the market evolution
Definition at line 62 of file simulation.class.cpp.
|
private |
simulate_portfolios
simulates the evolutions of the portfolios given a certain market scenario
Definition at line 103 of file simulation.class.cpp.
|
inherited |
allocates means (with a benchmark) to goals
solve is the main attribute to be used by other classes
a cls_currency object that will facilitate currency conversions
note: set_assets, set_cfs,set_goals,set_mu are done in the constructor
< initialize means_left for g=1 (all in investor.currency)
< initialize means_left for g=1 (all in investor.currency)
< do nothing right now for unallocated goals, so take the next goal (for loop)
try the free means (not used by other –lower ranking– goals)
< initialize
and means that are allocated to this goal):
for the asap-goals we take the first cash flows first
for all other goal types we take the last possible
if the free means are not sufficient, try all the previous also
block the resources for this goal
set the benchmark
set comments and colors:
add the risk info
put all the remaining means into the unallocated goal
Definition at line 396 of file investment_problem.class.cpp.
|
inherited |
Definition at line 16 of file market.class.cpp.
|
inherited |
note: index 0 not used
Definition at line 17 of file market.class.cpp.
|
inherited |
note: index 0 not used
Definition at line 18 of file market.class.cpp.
|
inherited |
Definition at line 20 of file investor.class.cpp.
|
inherited |
Definition at line 26 of file market.class.cpp.
|
inherited |
the default currency for that customer
Definition at line 19 of file investor.class.cpp.
|
inherited |
Definition at line 15 of file portfolio.class.cpp.
|
protectedinherited |
Definition at line 41 of file investor.class.cpp.
|
inherited |
Definition at line 25 of file market.class.cpp.
|
protectedinherited |
Definition at line 39 of file investor.class.cpp.
|
inherited |
Definition at line 16 of file investor.class.cpp.
|
inherited |
map containing all goals
Definition at line 22 of file investment_problem.class.cpp.
|
inherited |
Definition at line 14 of file investor.class.cpp.
|
protectedinherited |
Definition at line 40 of file investor.class.cpp.
|
inherited |
Definition at line 17 of file investor.class.cpp.
|
protected |
Definition at line 25 of file simulation.class.cpp.
|
protectedinherited |
the maximum exposure per asset class
Definition at line 42 of file investor.class.cpp.
|
protected |
the number of months to simulate, per goal we simulate max(realization_monthNbr, nbrMonths)
Definition at line 22 of file simulation.class.cpp.
|
inherited |
Definition at line 18 of file investor.class.cpp.
|
inherited |
the MONTHLY log-return
Definition at line 25 of file portfolio.class.cpp.
|
inherited |
the MONTHLY return
Definition at line 24 of file portfolio.class.cpp.
|
inherited |
Definition at line 14 of file portfolio.class.cpp.
|
protectedinherited |
the standard portfolios
Definition at line 29 of file investment_problem.class.cpp.
|
inherited |
the MONTHLY volatility
Definition at line 26 of file portfolio.class.cpp.
|
inherited |
Definition at line 21 of file investor.class.cpp.
|
inherited |
Definition at line 15 of file investor.class.cpp.
|
inherited |
the weights of the asset classes (ordered as the asset classes)
Definition at line 17 of file portfolio.class.cpp.