This is a simple calculation of Markowitz Portfolio method to find efficient portfolios,global minimum portfolios, tangency portfolios. A testing function has also being provided to report the proposed return with differenct portfolios.
import pylab as pl import numpy as np import PortfolioMatrixAlgebra import DataProcessing
BTC = np.loadtxt("BTC-USD.csv", delimiter = ",",skiprows = 1,usecols = (5))
ETC = np.loadtxt("ETC-USD.csv", delimiter = ",",skiprows = 1,usecols = (5))
LTC = np.loadtxt("LTC-USD.csv", delimiter = ",",skiprows = 1,usecols = (5))
BTC2 = np.loadtxt("BTC-USD2.csv", delimiter = ",",skiprows = 1,usecols = (5))
Ln_return_BTC = DataProcessing.compute_ln_return (BTC ) Ln_return_ETC = DataProcessing.compute_ln_return (ETC ) Ln_return_LTC = DataProcessing.compute_ln_return (LTC ) Ln_return_BTC2 = DataProcessing.compute_ln_return (BTC2 )
Create an array with different risky asset, not able to copy two same asset since inverse of covariance matrix would return error.
Ln_return_input = [Ln_return_BTC,Ln_return_ETC,Ln_return_LTC,Ln_return_BTC2 ]
Initialise PortfolioMatrixAlgebra class, with input of Ln_return_input and value of risk free asset (0.001)
port = PortfolioMatrixAlgebra.PortfolioMatrixAlgebra (Ln_return_input, 0.001)
Print report of efficient frontier graph, efficient portfolios,global minimum portfolios, tangency portfolios.
x = port.tangency_portfolio()[2]
DataProcessing.investment_report (x ,1000,inputData)


