当前位置:网站首页>投资组合分析:portfolio_analysis.Tangenvy_portfolio(切点组合)
投资组合分析:portfolio_analysis.Tangenvy_portfolio(切点组合)
2022-08-02 03:59:00 【鹦鹉螺平原】
实证资产定价(Empirical asset pricing)已经发布于Github和Pypi. 包的具体用法(Documentation)博主将会陆续在CSDN中详细介绍,也可以通过Pypi直接查看。
Pypi: pip install --upgrade EAP
Github: GitHub - whyecofiliter/EAP: empirical asset pricing
切点组合是有效前沿上最大夏普比率的组合,它与无风险利率的连线正切于风险资产的投资组合前沿。计算切点组合可以考察新加入的资产或投资组合是否显著影响切点组合,即新加入的资产是否有助于分散化风险和提高收益。如果新加入资产显著地影响切点组合,则说明它提供了已有资产无法提供的更有效的收益风险组合;如果新加入资产没有显著地影响切点组合,则说明它没有提供更有效的收益风险组合,这说明这项资产对提高投资效率或是夏普率没有实质的影响。
切点组合的计算方法为

上式中,t是切点组合的权重,u是资产的收益率,rf是无风险利率,sigma是资产收益率的协方差矩阵。
计算切点组合用的是portfolio_analysis.Tangency_portfolio。具体地说
def test_tangency_portfolio():
'''
This function is for testing rangency_portfolio
'''
import numpy as np
from portfolio_analysis import Tangency_portfolio as tanport
# construct the sample data 1
mu = np.array([0.0427, 0.0015, 0.0285])
cov_mat = np.mat([[0.01, 0.0018, 0.0011], [0.0018, 0.0109, 0.0026], [0.0011, 0.0026, 0.0199]])
rf = 0.005
# calculate the weight and the sharpe ratio
portfolio = tanport(rf, mu, cov_mat)
print(portfolio._portfolio_weight())
print(portfolio.fit())
portfolio.print()
# construct the sample data 2
mu = np.array([0.0427, 0.0015, 0.0285, 0.0028])
cov_mat = np.mat([[0.01, 0.0018, 0.0011, 0], [0.0018, 0.0109, 0.0026, 0], [0.0011, 0.0026, 0.0199, 0], [0, 0, 0, 0.1]])
rf = 0.005
# calculate the weight and the sharpe ratio
portfolio = tanport(rf, mu, cov_mat)
print(portfolio._portfolio_weight())
print(portfolio.fit())
portfolio.print()
test_tangency_portfolio()
================================================================================================================================
[[ 1.02682298]
[-0.32625112]
[ 0.29942815]]
(matrix([[ 1.02682298],
[-0.32625112],
[ 0.29942815]]), 0.4202276695645767)
+--------+---------+----------+---------+
| Weight | asset1 | asset2 | asset3 |
+--------+---------+----------+---------+
| | 1.02682 | -0.32625 | 0.29943 |
+--------+---------+----------+---------+
[[ 1.03285649]
[-0.32816815]
[ 0.30118756]
[-0.00587591]]
(matrix([[ 1.03285649],
[-0.32816815],
[ 0.30118756],
[-0.00587591]]), 0.42028525345017165)
+--------+---------+----------+---------+----------+
| Weight | asset1 | asset2 | asset3 | asset4 |
+--------+---------+----------+---------+----------+
| | 1.03286 | -0.32817 | 0.30119 | -0.00588 |
+--------+---------+----------+---------+----------+
边栏推荐
- 【FreeRTOS】12 任务通知——更省资源的同步方式
- Deep Blue Academy - Fourteen Lectures of Visual SLAM - Chapter 4 Homework
- OpenPCDet environment configuration of 3 d object detection and demo test
- 最后写入胜利(丢弃并发写入)
- 日本痴汉打赏女主播1.5亿,结果。。。
- C# Thread IsBackground作用
- 科研笔记(八) 深度学习及其在 WiFi 人体感知中的应用(上)
- Your device is corrupt. It cant‘t be trusted and may not work propely.
- 可视水印的实现——2使用图像加法
- Deep blue college - handwritten VIO operations - the first chapter
猜你喜欢
随机推荐
jetracer_pro_2GB AI Kit system installation instructions
Your device is corrupt. It cant‘t be trusted and may not work propely.
深蓝学院-手写VIO作业-第二章
Scientific research notes (5) SLAC WiFi Fingerprint+ Step counter fusion positioning
面试官:大量请求 Redis 不存在的数据,从而打倒数据库,有什么方案?
吴恩达机器学习系列课程笔记——第八章:神经网络:表述(Neural Networks: Representation)
如何让固定点的监控设备在EasyCVR平台GIS电子地图上显示地理位置?
2022华为软件精英挑战赛(初赛)-总结
无主复制系统(2)-读写quorum
this指向问题
2022-08-01:以下go语言代码输出什么?A:panic;B:5;C:6;D:编译错误。 package main import ( “fmt“ ) func main() {
热爱和责任
使用docker-compose 安装Redis最新版,并且设置密码
可视水印的实现——2使用图像加法
SCI期刊最权威的信息查询步骤!
Excel操作技巧大全
Nexus 5 phone uses Nexmon tool to get CSI information
OpenPCDet environment configuration of 3 d object detection and demo test
C# Thread IsBackground作用
多主复制下处理写冲突(1)-同步与异步冲突检测及避免冲突









