【发布时间】:2020-08-09 21:32:07
【问题描述】:
我有一个表格,其中包含每种资产的预期收益和波动率,还有这些资产的协方差矩阵,最后,其中一些资产是寻求回报的一部分,其余资产是寻求负债的一部分,我想为 Return Seeking 和 Liabilities Seeking 添加权重约束。
我正在使用优化方法来解决有效边界,但我想在优化问题中添加两个约束。我的优化问题是:
Minimise Volatility
x
subject to portfolio returns = target
Sum of weights = 1
我想添加两个额外的约束 寻求权重的回报总和 = 0.65 寻求权重的负债总和 = 0.35 我的代码写成:
def efficient_return(mean_returns, cov_matrix, target):
num_assets = len(mean_returns)
args = (mean_returns, cov_matrix)
def portfolio_return(weights):
return portfolio_annualised_performance(weights, mean_returns, cov_matrix)[1]
constraints = ({'type': 'eq', 'fun': lambda x: portfolio_return(x) - target},
{'type': 'eq', 'fun': lambda x: np.sum(x) - 1})
bounds = tuple((0,1) for asset in range(num_assets))
result = sco.minimize(portfolio_volatility, num_assets*[1./num_assets,], args=args, method='SLSQP', bounds=bounds, constraints=constraints)
return result
def efficient_frontier(mean_returns, cov_matrix, returns_range):
efficients = []
for ret in returns_range:
efficients.append(efficient_return(mean_returns, cov_matrix, ret))
return efficients
我的投资组合列表是:
lista_labels = ['Global Equity', 'TIPS','Long Duration Bonds – Gov’t / Credit', 'Long Duration Bonds – Credit',
'High Yield Bonds','Emerging Market Bonds','Real Estate (Broad Market)','Global REITs',
'Commodities','Private Infrastructure','25-year Government Bond','Broad Hedge Funds (Universe)'
,'Public Infrastructure','Tactical Asset Allocation','Core Plus Fixed Income']
我的退货清单是:
lista_RS = ['Global Equity','High Yield Bonds','Emerging Market Bonds','Real Estate (Broad Market)',
'Global REITs','Commodities','Private Infrastructure','Broad Hedge Funds (Universe)',
'Public Infrastructure','Tactical Asset Allocation']
我的责任是:
lista_LS = ['TIPS','Long Duration Bonds – Gov’t / Credit','Long Duration Bonds – Credit','25-year Government Bond',
'Core Plus Fixed Income']
我想复制这张表http://prntscr.com/twredz。提前致谢。
【问题讨论】:
-
0.65 的寻求回报是什么意思?整个投资组合的组成是多头的 65%? 0.35的负债寻求是什么意思?整个投资组合的构成是 35% 的空头头寸?寻求回报和寻求负债的成分加起来是否必须为 1?
-
嗨,亲爱的开发者。是的,退货寻求列表中的资产权重总和必须为 0.65。另一方面,在负债搜索列表中的资产的权重总和必须为 0.35。并且所有资产(寻求回报和寻求负债)的权重总和必须为1。希望你能帮助我。提前致谢。
标签: python optimization constraints