当前位置:网站首页>投资组合分析: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 |
+--------+---------+----------+---------+----------+
边栏推荐
- Research Notes (6) Indoor Path Planning Method Based on Environment Perception
- 详解CAN总线:什么是CAN总线?
- SCI写作攻略——附带常见英语写作句式
- 一次跳出最外层循环
- 使用Ansible编写playbook自动化安装php7.3.14
- Pycharm platform import scikit-learn
- 科研笔记(六) 基于环境感知的室内路径规划方法
- internship:数据库表和建立的实体类及对应的枚举类之间的联系示例
- EasyCVR视频广场切换通道,视频播放协议异常的问题修复
- 如何解决QByteArray添加quint16双字节时错误?
猜你喜欢
随机推荐
Scientific research notes (5) SLAC WiFi Fingerprint+ Step counter fusion positioning
数据复制系统设计(3)-配置新的从节点及故障切换
多主复制下处理写冲突(1)-同步与异步冲突检测及避免冲突
ClickHouse的客户端命令行参数
如何让固定点的监控设备在EasyCVR平台GIS电子地图上显示地理位置?
BOM学习
Excel操作技巧大全
Win8.1下QT4.8集成开发环境的搭建
VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tupl
一次跳出最外层循环
micro-ros arduino esp32 ros2 笔记
Batch normalization (BN) based on deep learning
ADSP21489仿真:Failed to set breakpoint: Can‘t set breakpoints in the current state: Running
DOM系列之 click 延时解决方案
Reinforcement Learning (Chapter 16 of the Watermelon Book) Mind Map
数学建模学习(76):多目标线性规划模型(理想法、线性加权法、最大最小法),模型敏感性分析
批量--09---批量读文件入表
日本痴汉打赏女主播1.5亿,结果。。。
Location、navigator和History对象
深蓝学院-手写VIO作业-第一章
![[Win11] PowerShell无法激活Conda虚拟环境](/img/53/464ffb5ef80ce8f6ee19e9ea96c159.png)








