投资组合风险收益率公式_投资组合分析的基础收益和亏损

投资组合风险收益率公式

In this story, we are going to do some basic portfolio returns analysis in python.

在这个故事中,我们将使用python做一些基本的投资组合收益分析。

When we analyze a stock, portfolio, or index’s performance, the first thing we look at is usually the returns, and understandably so, since it’s how much money we make from investing in the instrument. So let’s see what are some of the basic techniques involved in the analysis.

当我们分析股票,投资组合或指数的表现时,我们首先要看的是回报,这是可以理解的,因为这是我们从投资该工具中获利多少。 因此,让我们看一下分析中涉及的一些基本技术。

First we need a time series of prices. How do we go about getting that for testing? The easiest way to do it is using the geometric brown motion(GBM) to generate it:

首先,我们需要一个时间序列的价格。 我们如何进行测试? 最简单的方法是使用几何棕色运动(GBM)生成它:

import pandas as pd
import numpy as npdef brownian_prices(start, end):
bdates = pd.bdate_range(start, end)
size = len(bdates)
np.random.seed(1)
wt = np.random.standard_normal(size)
mu = 0.0001
sigma = 0.01
s0 = 100.0
st = s0 * np.cumprod(np.exp((mu - (sigma * sigma / 2.0))) + sigma * wt)
return pd.DataFrame(data={'date': bdates, 'price': st}).set_index('date')prices = brownian_prices('20200101', '20200801')
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值