Loading...
Searching...
No Matches
markowitz.py File Reference

This is a small graphical program that plots the efficient frontier of Markowitz' portfolio selection problem with the two objectives return and risk. More...

Go to the source code of this file.

Variables

str markowitz.GAMS_MODEL
 
sys markowitz.sys_dir = sys.argv[1] if len(sys.argv) > 1 else None
 
GamsWorkspace markowitz.ws = GamsWorkspace(system_directory=sys_dir)
 
GamsWorkspace markowitz.job = ws.add_job_from_string(GAMS_MODEL)
 
GamsWorkspace markowitz.opt = ws.add_options()
 
 markowitz.all_model_types
 
GamsWorkspace markowitz.cp = ws.add_checkpoint()
 
GamsWorkspace markowitz.mi = cp.add_modelinstance()
 
GamsWorkspace markowitz.l = mi.sync_db.add_parameter("lambda", 0, "")
 
list markowitz.data_points = []
 
 markowitz.value
 
GamsWorkspace markowitz.min_ret = mi.sync_db["ret"].first_record().level
 
GamsWorkspace markowitz.max_ret = mi.sync_db["ret"].first_record().level
 
float markowitz.gap = 0.02
 
list markowitz.intervals = [((0.0, min_ret), (1.0, max_ret))]
 
list markowitz.i = intervals.pop()
 
 markowitz.min_l
 
 markowitz.max_l
 
tuple markowitz.l_val = (min_l + max_l) / 2
 
GamsWorkspace markowitz.cur_ret = mi.sync_db["ret"].first_record().level
 
 markowitz.key
 
list markowitz.ret = [x[0] for x in data_points]
 
list markowitz.var = [x[1] for x in data_points]
 
 markowitz.marker
 
 markowitz.markersize
 

Detailed Description

This is a small graphical program that plots the efficient frontier of Markowitz' portfolio selection problem with the two objectives return and risk.

The example utilizes the GamsModelInstance class to solve the parameterized objective max lambda*return - (1-lambda)*risk in the most efficient way. This example requires the Python package matplotlib to be installed.

Definition in file markowitz.py.