FairPortfolio.apply_f_from_2nd_row
— Methodapply_f_from_2nd_row(prices::Matrix, f::Function, top_row_value)
Per column, apply function f to the prices row-by-row, depending on current and prev value Good data from 2nd row.
FairPortfolio.calc_dret
— Methodcalc_lnret(prices::Matrix)
Input: prices Output: nominal returns, good from 2nd row https://en.wikipedia.org/wiki/Continuouslycompoundednominalandreal_returns
FairPortfolio.calc_lnret
— Methodcalc_lnret(prices::Matrix)
Input: prices Output: continuous returns, good from 2nd row https://en.wikipedia.org/wiki/Continuouslycompoundednominalandreal_returns
FairPortfolio.calc_new_variance
— Methodcalc_new_variance
Running variance calculation of time series data. Calculates the variance given the prev one, the prev point and the new point.
FairPortfolio.calc_norm_dret
— Methodcalc_norm_dret(dret::Matrix, running_var_homogenizer::Matrix)
Given the nominal returns (dret) and running variance homogenizer, calculate the homogenized nominal returns. Good data from 1 rows after input
FairPortfolio.calc_running_homogenizer
— Methodcalc_running_homogenizer
Given running variance, calculates the homogenizing factor required to have a stable variance across assets and time (heteroskadasticity -> homoskadasticity). Good data same as input.
FairPortfolio.calc_running_variance
— Methodcalc_running_variance(lnret::Matrix)
Output: Matrix of running variances with VARWINDOW. Good data from 1+VARWINDOW ≤ nrows
FairPortfolio.create_constant_diagonals!
— Methodcreate_constant_diagonals!(C)
Takes a Assets that C is square and replaces it's diagonal with the mean of it's diagonal
FairPortfolio.explain
— Methodexplain(weights, running_var_homogenizer, prices_matrix)
User friendly results.
FairPortfolio.optimize
— Methodoptimize(C)
(nassets, nassets) = size(C) Takes a full (square) covariance matrix (C) (symmetric and positive semi-definite) and with constant diagonals. Output: optimal weights per asset.
FairPortfolio.optimize
— Methodoptimize(prices...)
Expects a vector per asset, rows are per time period. Each asset has the same # of rows. Calculates the homogenized and shrunk covariance matrix before running the core optimization. Output: optimal weights per asset.
FairPortfolio.separate_cov_matrix
— Methodseparate_cov_matrix(C)
(nassets, nassets) = size(C) Takes a full (square) covariance matrix (C) (symmetric and positive semi-definite) and with constant diagonals. Returns C split into four parts as required by the optimization.
FairPortfolio.shrink
— Methodshrink(C)
Statistical Shrinkage stabilizes the covariance matrix C https://en.wikipedia.org/wiki/Shrinkage_(statistics)
FairPortfolio.tuple_to_matrix
— Methodtuple_to_matrix(prices::Tuple)
Input are prices vectors per asset as a tuple or separated as arguments. E.g. tupletomatrix(asset1prices, asset2prices, asset3prices, ...) Returns a Matrix with a column per asset and a row per time period.