eFinancialPlanner  V1.0 (proof of concept)
Personal Financial Planning based on Maslowian Portfolio Theory
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
follow_up Class Reference
Inheritance diagram for follow_up:
simulation investment_problem investor portfolio market

Public Member Functions

 follow_up (int investor)
 
void parse_dashboard ()
 
void show_simulation ()
 
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, aGOALgoalZ
 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, portfolioportfolios
 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...
 

Detailed Description

follow_up

class used to simulate behaviour of the investment problem after optimization

Definition at line 7 of file follow_up.class.cpp.

Constructor & Destructor Documentation

follow_up::follow_up ( int  investor)

CONSTRUCTOR of the class simulation

Definition at line 17 of file follow_up.class.cpp.

Member Function Documentation

bool investor::add_to_db ( )
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.

float investor::age ( int  Mnbr = 0)
inlineinherited

returns the age of a customer in years (with decimal part)

Definition at line 108 of file investor.class.cpp.

int investor::age2monthNbr ( float  theAge)
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.

string investor::dateStr2Age ( string  the_date)
inlineprotectedinherited

dateStr2Age

Definition at line 209 of file investor.class.cpp.

bool investor::exists ( int  iid)
protectedinherited

exists

checks if a given investor-id really exists

Definition at line 343 of file investor.class.cpp.

string portfolio::get_description ( )
inherited

returns the label of the portfolio

Definition at line 86 of file portfolio.class.cpp.

int investor::get_from_db ( string  uid,
string  password 
)
protectedinherited

get_from_db returns the investor_id if successful (otherwise 0)

Definition at line 249 of file investor.class.cpp.

string investor::get_full_name ( )
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.

int investment_problem::get_max_month_for_lower_goals ( int  g)
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.

int investment_problem::get_nbr_goals ( )
inherited

returns the number of goals

Definition at line 936 of file investment_problem.class.cpp.

int simulation::get_nbrMonths2simulate ( )
inherited

returns the number of months to simulate as in "37"

get_nbrMonths2simulate()

returns nbrMonths (to simulate)

Definition at line 259 of file simulation.class.cpp.

bool portfolio::get_portf_from_db ( int  id)
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.

void investment_problem::javaGraph ( int  g,
string  xtra_var = "",
string  xtra_label = "",
int  followup_mnth = 0 
)
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.

void market::load_covar ( int  person,
char  person_type = 'i' 
)
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.

void market::load_ER ( int  person = 0,
char  person_type = 'i' 
)
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.

int investor::load_from_db ( string  uid)
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.

void investor::load_preferences ( )
protectedinherited

sets the experience, knowledge and desirability vectors

set_preferences

Definition at line 383 of file investor.class.cpp.

int investor::months2simulate ( )
inlineinherited

months2simulate

Definition at line 124 of file investor.class.cpp.

void follow_up::parse_dashboard ( )

parse_dashboard

Definition at line 26 of file follow_up.class.cpp.

void investment_problem::parse_javaGraph ( int  g,
string  xtra_var = "",
string  xtra_label = "" 
)
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

that will get become the plot as the <script> with javascript that will produce the plot.

Definition at line 1103 of file investment_problem.class.cpp.

void simulation::plot_market_evol ( )
inherited

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.

void investment_problem::prepare_javaVars_colors ( int  g,
int  followup_mnth 
)
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.

void market::reload_covar ( int  person,
char  what2do,
char  person_type = 'i' 
)
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.

void market::reload_ER ( int  person,
char  person_type = 'i' 
)
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.

bool investor::save ( )
protectedinherited

save

Definition at line 220 of file investor.class.cpp.

void market::save_covar ( int  person,
char  person_type = 'i' 
)
inherited

save_covar

Definition at line 172 of file market.class.cpp.

void market::save_ER ( int  person = 0,
char  person_type = 'i' 
)
inherited

save_ER

Definition at line 109 of file market.class.cpp.

bool investor::save_preferences ( )
protectedinherited

sets the experience, knowledge and desirability vectors

save_preferences()

Definition at line 416 of file investor.class.cpp.

void investment_problem::set_followup_color_post ( float  V,
int  g 
)
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.

void investment_problem::set_followup_color_prae ( float  Vlow,
float  Vmed,
float  Vhigh,
int  g 
)
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.

void investor::set_max_exposure ( )
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.

void portfolio::set_mu ( float *  AssetClass_mu)
inherited

sets the expected return for the portfolio

Definition at line 94 of file portfolio.class.cpp.

bool investor::set_scale ( string  scale_type,
int  ac,
int  val 
)
protectedinherited

set_scale

Definition at line 402 of file investor.class.cpp.

void portfolio::set_sigma ( float *  AssetClass_varCov)
inherited

sets the standard deviation for the portfolio: this->sigma

Definition at line 112 of file portfolio.class.cpp.

void simulation::show_simulation ( )
inherited
void simulation::simulate ( )
inherited

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.

void investment_problem::solve ( )
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.

Member Data Documentation

float* market::assetClass_covar = new float[(NBR_ASSET_CLASSES + 1) * (NBR_ASSET_CLASSES + 1)]
inherited

Definition at line 16 of file market.class.cpp.

float market::assetClass_mu[(NBR_ASSET_CLASSES+1)]
inherited

note: index 0 not used

Definition at line 17 of file market.class.cpp.

std::map<int, string> market::assetClass_name
inherited

note: index 0 not used

Definition at line 18 of file market.class.cpp.

struct tm investor::birth_date
inherited

Definition at line 20 of file investor.class.cpp.

std::map<int, std::map<int, float> > market::covar
inherited

Definition at line 26 of file market.class.cpp.

string investor::currency
inherited

the default currency for that customer

Definition at line 19 of file investor.class.cpp.

string portfolio::description
inherited

Definition at line 15 of file portfolio.class.cpp.

std::map<int, int> investor::desirability
protectedinherited

Definition at line 41 of file investor.class.cpp.

std::map<int, float> market::ER
inherited

Definition at line 25 of file market.class.cpp.

std::map<int, int> investor::experience
protectedinherited

Definition at line 39 of file investor.class.cpp.

string investor::first_name
inherited

Definition at line 16 of file investor.class.cpp.

std::map<int, aGOAL> investment_problem::goalZ
inherited

map containing all goals

Definition at line 22 of file investment_problem.class.cpp.

int investor::investor_id
inherited

Definition at line 14 of file investor.class.cpp.

std::map<int, int> investor::knowledge
protectedinherited

Definition at line 40 of file investor.class.cpp.

string investor::last_name
inherited

Definition at line 17 of file investor.class.cpp.

std::map<int, std::map <int, float> > simulation::market_return
protectedinherited

Definition at line 25 of file simulation.class.cpp.

std::map<int, float> investor::max_exposure
protectedinherited

the maximum exposure per asset class

Definition at line 42 of file investor.class.cpp.

int simulation::nbrMonths
protectedinherited

the number of months to simulate, per goal we simulate max(realization_monthNbr, nbrMonths)

Definition at line 22 of file simulation.class.cpp.

string investor::password
inherited

Definition at line 18 of file investor.class.cpp.

float portfolio::pLogR
inherited

the MONTHLY log-return

Definition at line 25 of file portfolio.class.cpp.

float portfolio::pMu
inherited

the MONTHLY return

Definition at line 24 of file portfolio.class.cpp.

int portfolio::portfolio_id
inherited

Definition at line 14 of file portfolio.class.cpp.

std::map<int, portfolio> investment_problem::portfolios
protectedinherited

the standard portfolios

Definition at line 29 of file investment_problem.class.cpp.

float portfolio::pSigma
inherited

the MONTHLY volatility

Definition at line 26 of file portfolio.class.cpp.

float investor::simulate_till_age
inherited

Definition at line 21 of file investor.class.cpp.

string investor::user_name
inherited

Definition at line 15 of file investor.class.cpp.

float portfolio::weights[NBR_ASSET_CLASSES]
inherited

the weights of the asset classes (ordered as the asset classes)

Definition at line 17 of file portfolio.class.cpp.


The documentation for this class was generated from the following file: