emprical 模块学习与分析 note6

简介: emprical 模块学习与分析 note6

对于如何使用这个模块做了一些简单的例子,主要是调用empyrical里面的函数计算相应的指标

  import empyrical 
  import numpy 
  as np
  import pandas 
  as pd
  import matplotlib.pyplot 
  as plt
  #读取数据
  returns=pd.read_csv(
  'C:/code/empyrical/empyrical/empyrical/tests/test_data/returns.csv',
  names=[
  'date',
  'rate'])
  returns[
  'rate']=returns[
  'rate']/
  100
  rate=returns[
  'rate']
  #计算相关的指标
  print(
  '计算年化收益率',
   empyrical.annual_return(rate) )
  print(
  '计算年化的波动率(标准差)',
   empyrical.annual_volatility(rate))
  print(
  '画出累计收益图')
  empyrical.cum_returns(rate).plot()
  print(
  '计算夏普率',
   empyrical.sharpe_ratio(rate))
  print(
  '计算时间序列的稳定程度',
   empyrical.stability_of_timeseries(rate))


接下来,继续学习逼格比较高的pyfolio,pyfolio也是quantpian公司出品的,并且调用了empyrical的分析结果,并且能够很好的画图展示结果,方便能够直观的分析策略的绩效和风险。                

目录
相关文章
|
6月前
|
测试技术 KVM 开发工具
【OS Pintos】Pintos 内核库基本数据结构 | 运行测试用例 alarm-multiple
【OS Pintos】Pintos 内核库基本数据结构 | 运行测试用例 alarm-multiple
74 0
|
6月前
|
编译器 Go 开发工具
JetBrains GoLand 以debug运行Go程序时出现could not launch process: decoding dwarf section info at offset 0x0: too short报错之保姆级别解决方案
JetBrains GoLand 以debug运行Go程序时出现could not launch process: decoding dwarf section info at offset 0x0: too short报错之保姆级别解决方案
60 0
|
机器学习/深度学习 人工智能 自然语言处理
EasyNLP集成K-Global Pointer算法,支持中文信息抽取
K-Global Pointer的技术解读,以及如何在EasyNLP框架中使⽤K-Global Pointer模型。
EasyNLP集成K-Global Pointer算法,支持中文信息抽取
|
机器人
Robot Framework(14)- Variables 表的详细使用和具体例子
Robot Framework(14)- Variables 表的详细使用和具体例子
208 0
Robot Framework(14)- Variables 表的详细使用和具体例子
DHL
|
算法 前端开发 安全
Kotlin StateFlow 搜索功能的实践 DB + NetWork
这篇文章主要来分析一下 PokemonGo 搜索功能的实践
DHL
429 0
Kotlin StateFlow 搜索功能的实践 DB + NetWork
|
机器人
Robot Framework(6)- BuiltIn 测试库常用的关键字列表
Robot Framework(6)- BuiltIn 测试库常用的关键字列表
219 0
Robot Framework(6)- BuiltIn 测试库常用的关键字列表
SAP QM初阶之启用了Multiple Specification功能后检验批的不同之处?
SAP QM初阶之启用了Multiple Specification功能后检验批的不同之处?
SAP QM初阶之启用了Multiple Specification功能后检验批的不同之处?
SAP QM 创建ROS维护检验工序,系统报错:Work center NMDC_QA plant NMDC does not exist for task list type S
SAP QM 创建ROS维护检验工序,系统报错:Work center NMDC_QA plant NMDC does not exist for task list type S
SAP QM 创建ROS维护检验工序,系统报错:Work center NMDC_QA plant NMDC does not exist for task list type S
SAP QM 源检验(Source Inspection)功能展示
SAP QM 源检验(Source Inspection)功能展示
SAP QM 源检验(Source Inspection)功能展示