当前位置:网站首页>投资组合分析: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 |
+--------+---------+----------+---------+----------+
边栏推荐
- 吴恩达机器学习系列课程笔记——第六章:逻辑回归(Logistic Regression)
- 【FreeRTOS】12 任务通知——更省资源的同步方式
- Location、navigator和History对象
- 我们擅长的地方很多
- 力扣 剑指 Offer 56 - I. 数组中数字出现的次数
- Andrew Ng's Machine Learning Series Course Notes - Chapter 18: Application Example: Image Text Recognition (Application Example: Photo OCR)
- 吴恩达机器学习系列课程笔记——第十八章:应用实例:图片文字识别(Application Example: Photo OCR)
- 多数据中心操作和检测并发写入
- Excel skills daquan
- ScholarOne Manuscripts submits journal LaTeX file and cannot convert PDF successfully!
猜你喜欢

HyperLynx中层叠设计实例

2022-08-01:以下go语言代码输出什么?A:panic;B:5;C:6;D:编译错误。 package main import ( “fmt“ ) func main() {

深度学习基础之批量归一化(BN)

How to save a section of pages in a PDF as a new PDF file

ESP32-C5 简介:乐鑫首款双频 Wi-Fi 6 MCU

可视水印的实现——2使用图像加法

3D目标检测之数据集

7亿听众背后的在线音频掘金故事

如何让固定点的监控设备在EasyCVR平台GIS电子地图上显示地理位置?

数学建模学习(76):多目标线性规划模型(理想法、线性加权法、最大最小法),模型敏感性分析
随机推荐
Deep Learning Basics Overfitting, Underfitting Problems, and Regularization
数据可视化之百变柱状图
吴恩达机器学习系列课程笔记——第八章:神经网络:表述(Neural Networks: Representation)
Arduino框架下STM32F1/F4系列HID模式程序烧录教程
ESP32-C5 简介:乐鑫首款双频 Wi-Fi 6 MCU
单目3D目标检测之入门
批量--09---批量读文件入表
多主复制下处理写冲突(4)-多主复制拓扑
UI自动化测试框架搭建——标记性能较差用例
MySQL8.0与MySQL5.7区别
Qt编写物联网管理平台49-设备模拟工具
吴恩达机器学习系列课程笔记——第六章:逻辑回归(Logistic Regression)
深蓝学院-手写VIO作业-第二章
使用 Fastai 构建食物图像分类器
Research Notes (6) Indoor Path Planning Method Based on Environment Perception
论人生自动化
Qt处理传输协议数据时QByteArray添加多字节的使用案例
PHP5.6安装ssh2扩展用与执行远程命令
3D目标检测之数据集
jetracer_pro_2GB AI Kit system installation instructions