当前位置:网站首页>投资组合分析: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 |
+--------+---------+----------+---------+----------+
边栏推荐
- this指向问题
- 3D object detection dataset
- SCI期刊最权威的信息查询步骤!
- 吴恩达机器学习系列课程笔记——第八章:神经网络:表述(Neural Networks: Representation)
- Reinforcement Learning (Chapter 16 of the Watermelon Book) Mind Map
- Scientific research notes (5) SLAC WiFi Fingerprint+ Step counter fusion positioning
- SCI writing strategy - with common English writing sentence patterns
- 视觉SLAM十四讲--第13讲 实践:设计SLAM系统(最详细的代码调试运行步骤)
- 多主复制下处理写冲突(3)-收敛至一致的状态及自定义冲突解决逻辑
- 科研笔记(八) 深度学习及其在 WiFi 人体感知中的应用(上)
猜你喜欢

如何解决QByteArray添加quint16双字节时错误?

SCI writing strategy - with common English writing sentence patterns

Scientific research notes (5) SLAC WiFi Fingerprint+ Step counter fusion positioning

MySQL8.0与MySQL5.7区别

CaDDN code debugging

EasyCVR视频广场切换通道,视频播放协议异常的问题修复

吴恩达机器学习系列课程笔记——第九章:神经网络的学习(Neural Networks: Learning)
深度剖析-class的几个对象(utlis,component)-瀑布流-懒加载(概念,作用,原理,实现步骤)

DOM系列之 click 延时解决方案

【学习笔记】如何打造运维组织架构
随机推荐
ES6中变量的使用及结构赋值
2022-08-01:以下go语言代码输出什么?A:panic;B:5;C:6;D:编译错误。 package main import ( “fmt“ ) func main() {
数据复制系统设计(3)-配置新的从节点及故障切换
How to save a section of pages in a PDF as a new PDF file
吴恩达机器学习系列课程笔记——第十四章:降维(Dimensionality Reduction)
SCI writing strategy - with common English writing sentence patterns
可视水印的实现——1使用加法实现(add,+)
多数据中心操作和检测并发写入
日本痴汉打赏女主播1.5亿,结果。。。
Pycharm平台导入scikit-learn
6个月测试经验,面试跳槽狮子大开口要18K,只会点点点,给我整无语了。。
深度剖析-class的几个对象(utlis,component)-瀑布流-懒加载(概念,作用,原理,实现步骤)
Your device is corrupt. It cant‘t be trusted and may not work propely.
MapFi paper structure organization
Platts Analysis-MATLAB Toolbox Function
Go 语言是如何实现切片扩容的?【slice】
深度学习基础之批量归一化(BN)
吴恩达机器学习系列课程笔记——第十六章:推荐系统(Recommender Systems)
BOM学习
ScholarOne Manuscripts提交期刊LaTeX文件,无法成功转换PDF!