Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
personal:portfolio:portopt [2014/06/06 10:22]
antonello [Usage]
personal:portfolio:portopt [2015/03/30 14:20]
antonello [Theorical Background]
Line 54: Line 54:
 \end{equation} \end{equation}
  
-where $x_i$ is the share of the asset $i$, $p_i$ is its productivity and hence $\sum_i {x_i p_i}$ is the overall portfolio productivity and $\sum_i { \sum_j { x_i x_j \sigma_{i,j}}}$ its variance.+where $x_i$ is the share of the asset $i$, $p_i$ is its productivity, $\sigma_{i,j}$ is the covariance between assets $i$ and $j$ and hence $\sum_i {x_i p_i}$ is the overall portfolio productivity and $\sum_i { \sum_j { x_i x_j \sigma_{i,j}}}$ is its variance.
  
 As the only quadratic term arises when $i=j$ and $\sigma_{i,j}$ being the variance is always positive, the problem is convex and hence easily numerically solved. As the only quadratic term arises when $i=j$ and $\sigma_{i,j}$ being the variance is always positive, the problem is convex and hence easily numerically solved.
Line 97: Line 97:
 == As a lib using Python: == == As a lib using Python: ==
   import portopt   import portopt
-  results = portopt.solveport(var,means,alpha,tollerance) # tollerance is optional, default to 0.000001+  results = portopt.solveport(var,means,alpha,tolerance) # tolerance is optional, default to 0.000001
   functioncost = results[0]   functioncost = results[0]
   shares       = results[1]   shares       = results[1]
Line 120: Line 120:
   * Set alpha to zero to retrieve the portfolio with the highest mean, independently from variance (solution not guaranteed to be unique);   * Set alpha to zero to retrieve the portfolio with the highest mean, independently from variance (solution not guaranteed to be unique);
   * Assets shares are returned in the x_h vector, eventual error code (0: all fine, 1: input data error, 2: no solutions, 3: didn't solve, 4: solver internal error) in the errorcode parameter.    * Assets shares are returned in the x_h vector, eventual error code (0: all fine, 1: input data error, 2: no solutions, 3: didn't solve, 4: solver internal error) in the errorcode parameter. 
-  * Use option "tollerance" with two l up to version 1.1+  * Use option "tollerance" with two l up to version 1.1 included
      
      
personal/portfolio/portopt.txt · Last modified: 2018/06/18 15:11 (external edit)
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0