蒙特卡罗模拟与期权:金融投资的量化分析
1. 有效前沿模拟
在金融投资领域,构建有效的投资组合是关键。我们可以通过模拟来构建有效前沿,以直观地展示不同股票组合的风险与回报关系。
1.1 两只股票的有效前沿模拟
首先,我们来看两只股票的情况。以下是相关代码:
std_=round(np.std(np.sum(R*result.x,axis=1)),6)
out_std.append(std_)
out_weight.append(result.x)
# Step 7: plot the efficient frontier
title('Simulation for an Efficient Frontier from given 2 stocks')
xlabel('Standard Deviation of the 2-stock Portfolio (Risk)')
ylabel('Return of the 2-stock portfolio')
figtext(0.2,0.80,' mean = '+str(stockMean))
figtext(0.2,0.75,' std ='+str(std_0))
figtext(0.2,0.70,' correlation ='+str(corr_))
plot(np.array(std_0),np.array(stockMean),'o',markersize=8)
plot(out_std,out_mean,'--',linewidth=3)
这段代码的主要步骤如下:
1. 计算投资组合的
超级会员免费看
订阅专栏 解锁全文
2309

被折叠的 条评论
为什么被折叠?



