emprical 模組學習與分析 note6

2021-08-20 11:08:26 字數 950 閱讀 4548

對於如何使用這個模組做了一些簡單的例子,主要是呼叫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']/

100rate=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的分析結果,並且能夠很好的畫圖展示結果,方便能夠直觀的分析策略的績效和風險。

skui學習筆記(二)模組分析

skui分為幾個模組 skui itself add subdirectory core add subdirectory css add subdirectory graphics add subdirectory gui add subdirectory opengl add subdirect...

資料分析 學習模組筆記

目錄 了解資料分析 業務理解與學習 分析基礎 統計學機器學習 資料庫技能 sqlhadoop hive 分析工具運用 python excel 筆試面試 業務理解與學習部落格 精益資料分析 書中筆記 本子筆記 區分定類 定序 定距 定比變數 假設檢驗 u檢驗 t檢驗 卡方檢驗 f檢驗 書 a4紙機器...

Node 學習 一 http模組與url模組

用http模組建立服務 用url模組解析url var url require url req獲取url資訊 request res瀏覽器返回響應資訊 response 傳送http頭部 http狀態值 200 ok 設定http頭部,狀態碼是200,檔案型別是html,字符集是utf 8 res....