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

Public Member Functions

 investor_ui ()
 
bool set_investor_id (const string &s)
 
bool set_user_name (const string &s)
 
bool set_first_name (const string &s)
 
bool set_last_name (const string &s)
 
bool set_password (const string &s)
 
bool set_currency (const string &s)
 
bool set_birth_date (const string &s)
 
bool set_simulate_till_age (const string &s)
 
bool is_logged_in ()
 
void logout ()
 
bool set_investor_id_fromEnv ()
 
void login ()
 
void update_last_activity_at ()
 
string parse_user_info (bool parse_wrapper=true)
 
void home_screen ()
 
void show_home_screen_form ()
 
void register_form ()
 
void register_exec ()
 
void account_form ()
 
void account_save ()
 
void login_form ()
 
void login_exec ()
 
void show_disclaimer ()
 
void personalize_screen ()
 
void personalize_save ()
 
void personalize_reload (string action)
 
void show_inventory_form ()
 
void asset_add ()
 
void asset_edit ()
 
void asset_save ()
 
void asset_delete ()
 
void goal_help_form ()
 
void goal_help_save ()
 
void goal_list ()
 
void goal_add ()
 
void goal_edit ()
 
void goal_save ()
 
void goal_delete ()
 
void cash_flow_list ()
 
void cash_flow_add ()
 
void cash_flow_edit ()
 
void cash_flow_save ()
 
void cash_flow_delete ()
 
void feedback ()
 
void show_simulation ()
 
void show_follow_up ()
 
void show_total_portfolio (investment_problem *oInvProbl)
 
void parse_savings_plan (investment_problem *oInvProbl, int g)
 
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')
 

Public Attributes

int active_action = 1
 
html_helper hh
 
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
 

Protected Member Functions

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

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 show_register_form_body ()
 
void show_account_form_body ()
 
void show_goal_help_form_body ()
 
void show_login_form_body ()
 
void show_inventory_form_body ()
 
void parse_bm (std::map< int, float > benchmark, int ref_number)
 
void personalize_form ()
 
void personalize_pref_table ()
 
void personalize_ER_table ()
 
void personalize_vol_table ()
 
void personalize_ERvol_table ()
 
void personalize_covar_table ()
 
void parse_simulation_duration_form (int nbrMonths, string action="s")
 
void parse_simulation_insight (simulation *oSim)
 
void parse_form_open_personalize (string the_content)
 
void parse_form_close_personalize (string the_content, bool show_reload=true)
 
string button_to (string go_to, string description, char type_redir)
 
void personalize_set_general ()
 
void personalize_set_prefs ()
 
void personalize_set_ER ()
 
void personalize_set_vol ()
 
void personalize_set_corr ()
 
void parse_goal_box (investment_problem *oInvProbl, int g, string s_var="", string s_desc="")
 

Private Attributes

std::map< int, string > asset_class_names
 this variable is to be filled out when needed More...
 

Detailed Description

class investor

copyright: (c) Philippe De Brouwer 2014

last modification: 2014-08-25

This class holds the basic functionality to use an investor: retrieve it from database, save, edit and load the_goal essential parameters related to the investor him/herself.

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

Constructor & Destructor Documentation

investor_ui::investor_ui ( )

CONSTRUCTOR

Definition at line 126 of file investor_ui.class.cpp.

Member Function Documentation

void investor_ui::account_form ( )

account_form

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

void investor_ui::account_save ( )

account_save saves the account information

change password!!!!!!!

Definition at line 470 of file investor_ui.class.cpp.

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.

void investor_ui::asset_add ( )

Definition at line 1036 of file investor_ui.class.cpp.

void investor_ui::asset_delete ( )

Definition at line 1110 of file investor_ui.class.cpp.

void investor_ui::asset_edit ( )

asset_edit

Definition at line 1061 of file investor_ui.class.cpp.

void investor_ui::asset_save ( )

Definition at line 1084 of file investor_ui.class.cpp.

string investor_ui::button_to ( string  go_to,
string  description,
char  type_redir 
)
inlineprivate

button_to

type_redir = {a = action, u = url, s = secondary action (variable a2 is set)} go_to is the action or the url

Definition at line 170 of file investor_ui.class.cpp.

void investor_ui::cash_flow_add ( )

Definition at line 1244 of file investor_ui.class.cpp.

void investor_ui::cash_flow_delete ( )

Definition at line 1301 of file investor_ui.class.cpp.

void investor_ui::cash_flow_edit ( )

Definition at line 1265 of file investor_ui.class.cpp.

void investor_ui::cash_flow_list ( )

Definition at line 1228 of file investor_ui.class.cpp.

void investor_ui::cash_flow_save ( )

Definition at line 1285 of file investor_ui.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.

void investor_ui::feedback ( )

feedback

provides the feedback about the goals, risks savings plans, etc.

Definition at line 1642 of file investor_ui.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.

void investor_ui::goal_add ( )

Definition at line 1149 of file investor_ui.class.cpp.

void investor_ui::goal_delete ( )

Definition at line 1209 of file investor_ui.class.cpp.

void investor_ui::goal_edit ( )

Definition at line 1173 of file investor_ui.class.cpp.

void investor_ui::goal_help_form ( )

goal_help

Definition at line 2106 of file investor_ui.class.cpp.

void investor_ui::goal_help_save ( )

goal_help_save saves the account information

— Retirement

— Rainy Day

– Kids

Foreseeable expenses

Life Dreams

Definition at line 2118 of file investor_ui.class.cpp.

void investor_ui::goal_list ( )

goal_list

< list existing and show input form for new items

Definition at line 1133 of file investor_ui.class.cpp.

void investor_ui::goal_save ( )

Definition at line 1193 of file investor_ui.class.cpp.

void investor_ui::home_screen ( )

home_screen

displays the landing screen for the software

Definition at line 255 of file investor_ui.class.cpp.

bool investor_ui::is_logged_in ( )

is_logged_in returns true if the user is logged in

Definition at line 1463 of file investor_ui.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.

void investor_ui::login ( )

login

executes the login of the user (updates the table " + oConfig.tbl_prefix + "_investors and adds the information that the user is logged in

Definition at line 1523 of file investor_ui.class.cpp.

void investor_ui::login_exec ( )

Definition at line 566 of file investor_ui.class.cpp.

void investor_ui::login_form ( )

Definition at line 552 of file investor_ui.class.cpp.

void investor_ui::logout ( )

logout logs out the currently logged in user then loads the home screen

Definition at line 1484 of file investor_ui.class.cpp.

int investor::months2simulate ( )
inlineinherited

months2simulate

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

void investor_ui::parse_bm ( std::map< int, float >  benchmark,
int  goal_number 
)
private

parse_bm

the_goal

Definition at line 1881 of file investor_ui.class.cpp.

void investor_ui::parse_form_close_personalize ( string  the_content,
bool  show_reload = true 
)
private

parse_form_close_personalize

Definition at line 804 of file investor_ui.class.cpp.

void investor_ui::parse_form_open_personalize ( string  the_content)
private

parse_form_open_personalize

Definition at line 774 of file investor_ui.class.cpp.

void investor_ui::parse_goal_box ( investment_problem oInvProbl,
int  g,
string  s_var = "",
string  s_desc = "" 
)
private

parse_goal_box

g = the goal number

Definition at line 1549 of file investor_ui.class.cpp.

void investor_ui::parse_savings_plan ( investment_problem oInvProbl,
int  g 
)

parse_savings_plan

prints the savings plan to the screen

Definition at line 2314 of file investor_ui.class.cpp.

void investor_ui::parse_simulation_duration_form ( int  nbrMonths,
string  action = "s" 
)
private

parse_simulation_duration_form

Definition at line 2398 of file investor_ui.class.cpp.

void investor_ui::parse_simulation_insight ( simulation oSim)
private

parse_simulation_insight

Definition at line 2425 of file investor_ui.class.cpp.

string investor_ui::parse_user_info ( bool  parse_wrapper = true)

parse_user_info

Definition at line 133 of file investor_ui.class.cpp.

void investor_ui::personalize_covar_table ( )
private

personalize_covar_table

Definition at line 678 of file investor_ui.class.cpp.

void investor_ui::personalize_ER_table ( )
private

personalize_ER_table

Definition at line 623 of file investor_ui.class.cpp.

void investor_ui::personalize_ERvol_table ( )
private

personalize_ERvol_table

Definition at line 657 of file investor_ui.class.cpp.

void investor_ui::personalize_form ( )
private

personalize_form

Definition at line 712 of file investor_ui.class.cpp.

void investor_ui::personalize_pref_table ( )
private

personalize_pref_table

Definition at line 595 of file investor_ui.class.cpp.

void investor_ui::personalize_reload ( string  action)

personalize_reload

reloads for the investor the system defaults of ER, vol and/or corr

Definition at line 957 of file investor_ui.class.cpp.

void investor_ui::personalize_save ( )

personalize_save

std_message, error_message

Definition at line 838 of file investor_ui.class.cpp.

void investor_ui::personalize_screen ( )

personalize_screen

Definition at line 826 of file investor_ui.class.cpp.

void investor_ui::personalize_set_corr ( )
private

personalize_set_corr

Definition at line 935 of file investor_ui.class.cpp.

void investor_ui::personalize_set_ER ( )
private

personalize_set_ER

Definition at line 910 of file investor_ui.class.cpp.

void investor_ui::personalize_set_general ( )
private

personalize_set_general

Definition at line 865 of file investor_ui.class.cpp.

void investor_ui::personalize_set_prefs ( )
private

personalize_set_general

Definition at line 889 of file investor_ui.class.cpp.

void investor_ui::personalize_set_vol ( )
private

personalize_set_vol

Definition at line 922 of file investor_ui.class.cpp.

void investor_ui::personalize_vol_table ( )
private

personalize_vol_table

Definition at line 640 of file investor_ui.class.cpp.

void investor_ui::register_exec ( )

register_exec

executes the registration of a new user and if successful shows the asset-screen

xxx goal_help is not defined et TODO

Definition at line 409 of file investor_ui.class.cpp.

void investor_ui::register_form ( )

Definition at line 322 of file investor_ui.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.

bool investor_ui::set_birth_date ( const string &  s)

bool set_birth_date(string s);

Definition at line 1430 of file investor_ui.class.cpp.

bool investor_ui::set_currency ( const string &  s)

bool set_currency(const std::string& s);

sets the currency

Definition at line 1389 of file investor_ui.class.cpp.

bool investor_ui::set_first_name ( const string &  s)

Definition at line 1343 of file investor_ui.class.cpp.

bool investor_ui::set_investor_id ( const string &  s)

bool set_investor_id (const std::string& s);

sets the investor id in the object for an EXISTING user

Definition at line 1410 of file investor_ui.class.cpp.

bool investor_ui::set_investor_id_fromEnv ( )

Definition at line 1494 of file investor_ui.class.cpp.

bool investor_ui::set_last_name ( const string &  s)

Definition at line 1358 of file investor_ui.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.

bool investor_ui::set_password ( const string &  s)

Definition at line 1373 of file investor_ui.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.

bool investor_ui::set_simulate_till_age ( const string &  s)

bool set_simulate_till_age(string s);

Definition at line 1447 of file investor_ui.class.cpp.

bool investor_ui::set_user_name ( const string &  s)

the set functions that follow here could be defined within the investor class, however they are only used in the user interface, so no need to load them for the simulation for example

Definition at line 1325 of file investor_ui.class.cpp.

void investor_ui::show_account_form_body ( )
private

show_account_form shows the account form to be edited

Definition at line 335 of file investor_ui.class.cpp.

void investor_ui::show_disclaimer ( )

show disclaimer

Definition at line 395 of file investor_ui.class.cpp.

void investor_ui::show_follow_up ( )

follow_up

shows a demo-follow up screen

  • eventually with a scenario that the user can fill out: TODO

show a field for the user to change the simulation horizon

show the market evolution

show the dahsboard

show detailed feedback per goal

Definition at line 1804 of file investor_ui.class.cpp.

void investor_ui::show_goal_help_form_body ( )
private

show_goal_help shows the screen that helps to create common goals

Retirement

Rainy Day Savings

Insurances

Savings for (grand-) childeren

Foreseeable expenses

Life Dream

Definition at line 1934 of file investor_ui.class.cpp.

void investor_ui::show_home_screen_form ( )

show_home_screen_form

Definition at line 191 of file investor_ui.class.cpp.

void investor_ui::show_inventory_form ( )

Definition at line 981 of file investor_ui.class.cpp.

void investor_ui::show_inventory_form_body ( )
private

Definition at line 993 of file investor_ui.class.cpp.

void investor_ui::show_login_form_body ( )
private

Definition at line 527 of file investor_ui.class.cpp.

void investor_ui::show_register_form_body ( )
private

register_form_body

shows the register form on the screeen

Definition at line 270 of file investor_ui.class.cpp.

void investor_ui::show_simulation ( )

simulation

< prepare a series of random returns for each asset class and history for each goal (ie. set goalZ[g].simulation_string)

show a field for the user to change the simulation horizon

– report the market evolution

now show the feedback for each goal

Definition at line 1731 of file investor_ui.class.cpp.

void investor_ui::show_total_portfolio ( investment_problem oInvProbl)

show_total_portfolio

shows the benchmark of the the portfolio in month 6

Definition at line 2356 of file investor_ui.class.cpp.

void investor_ui::update_last_activity_at ( )

update_last_activity_at

updates the information in the database when the user had his/her last last_activity

Definition at line 1537 of file investor_ui.class.cpp.

Member Data Documentation

int investor_ui::active_action = 1

Definition at line 27 of file investor_ui.class.cpp.

std::map<int, string> investor_ui::asset_class_names
private

this variable is to be filled out when needed

Definition at line 118 of file investor_ui.class.cpp.

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.

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.

html_helper investor_ui::hh

Definition at line 89 of file investor_ui.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, float> investor::max_exposure
protectedinherited

the maximum exposure per asset class

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

string investor::password
inherited

Definition at line 18 of file investor.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.


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