New answers tagged

0

You would calculate return for each single position and for each segment of time. Following that you would geometrically link all these separate returns.


0

There are a few ways to do this. For example, the FRBNY (google FRBNY and nowcasting) creates a weekly GDP number from monthly and weekly series. You can sift through that to see how they change the time steps. In the past I generated weekly unemployment data (which is a monthly series) from the pattern of weekly unemployment claims or something like ...


0

I used an example from the paper: An Introduction to Shrinkage Estimation of the Covariance Matrix: A Pedagogic Illustration I was able to get the same Shrinkage matrix. I have provided the same matrix they use in their paper. Hope this helps import numpy as np import pandas from math import pow def get_shrunk_covariance_matrix(obs, c, zeros): ...


1

Convex Optimisation - CVXOpt and CVXPy. Textbook by Boyd & Vandenberghe Aside from CVXOPT (known for its cone programming, see http://cvxopt.org/) with extensive documentation by the authors, Boyd and Vandenberghe http://stanford.edu/~boyd/cvxbook/, there is CVXPY which provides an easier front end. CVXPY was designed and implemented by Steven ...


0

I would suggest the qq-pat library (https://github.com/QuriQuant/qq-pat) with this library you can presently do minimum variance portfolio optimization using some simple code. This is a simple example with three assets: import pandas as pd from pandas_datareader import data import datetime import qqpat aapl = data.get_data_yahoo('AAPL', ...


0

You can check the Euler-based risk attribution/ risk allocation, for example here: http://arxiv.org/pdf/0708.2542.pdf


-2

Say you want to optimize for max sharpe ratio, you could do something like this with scipy: import scipy.optimize as spopt allocations = [] #allocations def Sharpe(): #An function to compute Sharpe ratio, return negative SR compute Sharpe_Ratio return -1*Sharpe_Ratio bnd = [] #bounds cns [] #constraints result = spopt.minimize(Sharpe, ...



Top 50 recent answers are included