Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
personal:portfolio:portopt [2014/05/28 14:27] antonello [Bugs and feedbacks] |
personal:portfolio:portopt [2015/03/30 14:20] antonello [Theorical Background] |
||
---|---|---|---|
Line 3: | Line 3: | ||
You have to provide PortOpt (in text files or - if you use the api- using your own code) the variance/ | You have to provide PortOpt (in text files or - if you use the api- using your own code) the variance/ | ||
- | It returns the vector of assets' | + | It returns the vector of assets' |
In order to minimise the variance it internally uses [[http:// | In order to minimise the variance it internally uses [[http:// | ||
Line 28: | Line 28: | ||
In such case the indifference curves can be drawn like a bundle of straight lines having equation $prod = \alpha * var + \beta$, where $\alpha$ is the linear risk aversion coefficient and both $prod$ and $var$ refer to the overall portfolio' | In such case the indifference curves can be drawn like a bundle of straight lines having equation $prod = \alpha * var + \beta$, where $\alpha$ is the linear risk aversion coefficient and both $prod$ and $var$ refer to the overall portfolio' | ||
- | Point $B$ represents the point having the lowest possible portfolio variance. | + | Point $B$ represents the point having the lowest possible portfolio variance. |
\begin{equation} | \begin{equation} | ||
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, | + | where $x_i$ is the share of the asset $i$, $p_i$ is its productivity, $\sigma_{i, |
As the only quadratic term arises when $i=j$ and $\sigma_{i, | As the only quadratic term arises when $i=j$ and $\sigma_{i, | ||
Line 93: | Line 93: | ||
Call: | Call: | ||
- | double solveport (const vector< vector < | + | double solveport (const vector< vector < |
| | ||
- | == As a lib ising Python: == | + | == As a lib using Python: == |
import portopt | import portopt | ||
- | results = portopt.solveport(var, | + | results = portopt.solveport(var, |
+ | functioncost = results[0] | ||
+ | shares | ||
+ | errorcode | ||
+ | errormessage = results[3] | ||
=== Options === | === Options === | ||
Line 106: | Line 110: | ||
-a --alpha [alpha_coefficient] | -a --alpha [alpha_coefficient] | ||
-f --field-delimiter [field_delimiter] | -f --field-delimiter [field_delimiter] | ||
- | -s --decimal-separator [decimal-separator] | + | -s --decimal-separator [decimal-separator] |
+ | -t --tollerance [tolerance] | ||
</ | </ | ||
Line 113: | Line 118: | ||
* Higher the alpha, lower the agent risk aversion; | * Higher the alpha, lower the agent risk aversion; | ||
* Set a negative alpha to retrieve the portfolio with the lowest possible variance; | * Set a negative alpha to retrieve the portfolio with the lowest possible variance; | ||
- | * Set alpha to zero to retrieve the portfolio with the highest mean, indipendently | + | * Set alpha to zero to retrieve the portfolio with the highest mean, independently |
- | * Assets shares are returned in the x_h vector, eventual error code (0: all fine, 1: input data error, 2: problem has no solutions, 3: internal | + | * 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 |
+ | * Use option " | ||
| | ||
| | ||
Line 130: | Line 136: | ||
===== Acknowledgements ===== | ===== Acknowledgements ===== | ||
- | This work was supported by the French National Research Agency through the Laboratory of Excellence ARBRE, a part of the " | + | This work was supported by: |
+ | |||
+ | * a grant overseen by Office National des Forêts through the [[http:// | ||
+ | * the French National Research Agency through the [[http:// | ||
+ | |||