当前位置:网站首页>投资组合分析: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 |
+--------+---------+----------+---------+----------+
边栏推荐
- Deep Blue Academy - 14 Lectures on Visual SLAM - Chapter 7 Homework
- ScholarOne Manuscripts submits journal LaTeX file and cannot convert PDF successfully!
- The most authoritative information query steps for SCI journals!
- 数据复制系统设计(2)-同步复制与异步复制
- [Study Notes] How to Create an Operation and Maintenance Organizational Structure
- Scalar value for argument ‘color‘ is not numeric错误处理
- Platts Analysis-MATLAB Toolbox Function
- Kubernetes中Pod对象学习笔记
- CaDDN代码调试
- 视觉SLAM十四讲--第13讲 实践:设计SLAM系统(最详细的代码调试运行步骤)
猜你喜欢
并发性,时间和相对性(1)-确定前后关系
吴恩达机器学习系列课程笔记——第六章:逻辑回归(Logistic Regression)
3D目标检测之数据集
数学建模学习(76):多目标线性规划模型(理想法、线性加权法、最大最小法),模型敏感性分析
Computer Basics
EasyCVR视频广场切换通道,视频播放协议异常的问题修复
深度学习基础之batch_size
如何让固定点的监控设备在EasyCVR平台GIS电子地图上显示地理位置?
2022-08-01:以下go语言代码输出什么?A:panic;B:5;C:6;D:编译错误。 package main import ( “fmt“ ) func main() {
吴恩达机器学习系列课程笔记——第八章:神经网络:表述(Neural Networks: Representation)
随机推荐
6个月测试经验,面试跳槽狮子大开口要18K,只会点点点,给我整无语了。。
数据可视化之百变柱状图
生物识别学习资源推荐
Deep Learning Basics Overfitting, Underfitting Problems, and Regularization
多主复制下处理写冲突(3)-收敛至一致的状态及自定义冲突解决逻辑
科研笔记(七) 基于路径规划和WiFi指纹定位的多目的地室内导航
批量--09---批量读文件入表
Arduino框架下STM32F1/F4系列HID模式程序烧录教程
ADSP21489数据手册表摘要
什么是接触电流怎么测?
micro-ros arduino esp32 ros2 笔记
MySQL读写分离mysql-proxy部署
三维目标检测之OpenPCDet环境配置及demo测试
VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tupl
深蓝学院-视觉SLAM十四讲-第四章作业
日本痴汉打赏女主播1.5亿,结果。。。
Excel操作技巧大全
【学习笔记】如何打造运维组织架构
2022华为软件精英挑战赛(初赛)-总结
falco 【1】入门