[关闭]
@Channelchan 2017-12-05T17:00:00.000000Z 字数 775 阅读 81962

Talib


Talib是python用于技术分析的包。


TA_Lib提供什么样的函数?

  1. 重叠研究(Overlap Studies)
  2. 动能指标(Momentum Indicators)
  3. 周期指标(Cycle Indicators)
  4. 成交量指标(Volume Indicators)
  5. 波动率指标(Volatility Indicators)
  6. 数学操作(Math Operators)
  7. 数学变换(Math Transform)
  8. 统计功能(Statistic Functions)
  9. 价格转换(Price Transform)
  10. 形态识别(Pattern Recognition)

TA_Lib需要什么样的数据格式?

  1. 'numpy.ndarray'
  2. dataframe

常用代码

  1. import talib as ta
  2. import pandas as pd
  3. data = pd.read_excel('sz50.xlsx', sheetname='600036.XSHG', index_col='datetime')
  4. #读取'numpy.ndarray'
  5. print(ta.MA(data.close.values, 5)[-5:])
array([ 109.272,  109.902,  110.724,  112.568,  114.85 ])
  1. #直接读取DataFrame,默认读取cloumns名为close的数据。
  2. print(ta.abstract.MA(data, 5).tail())
datetime
2017-11-14 15:00:00    109.272
2017-11-15 15:00:00    109.902
2017-11-16 15:00:00    110.724
2017-11-17 15:00:00    112.568
2017-11-20 15:00:00    114.850
dtype: float64

Github: https://github.com/mrjbq7/ta-lib

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注