talib简介
所属分类 talib
浏览量 162
TA-Lib - Technical Analysis Library
https://ta-lib.org/
https://github.com/TA-Lib/ta-lib
Java ta-lib-0.4.0.jar
https://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0.jar
https://ta-lib.org/functions/
200 indicators such as ADX, MACD, RSI, Stochastic, Bollinger Bands etc...
Candlestick patterns recognition
Core written in C/C++ with API also available for Python.
Open-Source (BSD License). Can be freely integrated in your own open-source or commercial applications.
import pandas as pd
data = pd.read_csv('path_to_your_csv_file.csv', index_col='Date', parse_dates=True)
# 确保数据按日期排序
data.sort_index(inplace=True)
import talib
# 计算简单移动平均线
data['SMA'] = talib.SMA(data['Close'], timeperiod=20)
# 计算指数移动平均线
data['EMA'] = talib.EMA(data['Close'], timeperiod=20)
计算相对强弱指数(RSI)
data['RSI'] = talib.RSI(data['Close'], timeperiod=14)
计算布林带
data['upper_band'], data['middle_band'], data['lower_band'] = talib.BBANDS(data['Close'], timeperiod=20, nbdevup=2, nbdevdn=2, matype=0)
计算收盘价的动量
output = talib.MOM(close, timeperiod=5)
Supported Indicators 支持指标
import talib
print talib.get_functions()
print talib.get_function_groups()
Function Groups
Overlap Studies 重叠研究
Momentum Indicators 动量指标
Volume Indicators 成交量指标
Volatility Indicators 波动性指标
Price Transform 价格指标
Cycle Indicators 周期指标
Pattern Recognition 形态识别
Statistic Functions 统计函数
Math Transform 数学变换
Math Operators 数学运算符
Pattern Recognition Functions 形态识别
https://github.com/HuaRongSAO/talib-document/blob/master/func_groups/pattern_recognition.md
制定交易逻辑/策略
交易逻辑决定了何时买入或卖出资产
一种相对简单的逆向投资策略
买入信号 股价低于SMA且RSI低于30
卖出信号 股价高于SMA且RSI高于70
# 设定买入卖出信号条件
data['Buy_Signal'] = (data['SMA'] > data['Close']) & (data['RSI'] < 30)
data['Sell_Signal'] = (data['SMA'] < data['Close']) & (data['RSI'] > 70)
talib中文文档
https://github.com/HuaRongSAO/talib-document
上一篇
下一篇
vue3 todolist项目 运行
智能搜索工具
Python识别波峰波谷
程序员 如何利用 个人网站 自媒体赚钱
springboot3 自动配置文件
hutool SPI serviceloader 实例