Files
obsidian-vault/06 平台与配置/TA-lib库安装.md
2026-06-23 00:24:32 +08:00

39 lines
1.7 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#软件配置 #量化交易
今日对于[[基于单币种监测脚本构建我自己的第一个量化策略并回测]]的思考又有新的进展。
在完成数据获取、数据整理和格式转换后,就到了核心策略的构建阶段。构建完成后,则根据策略信号进行下单模块的编写。
目前甚至在较为久远的未来策略还是由技术指标构成参与的。为了不重复造轮子快速实现对技术指标的引用和使用我立刻反应上来ta-lib库存在的重要意义。
如果可以熟练使用ta-lib库对技术指标相关参数和场景进行描述和捕捉将给我本阶段策略的构建提供关键的进展。
---
ta-lib库的安装此前给我巨大的心理压力。
经历了Mac一下午安装失败和Ubuntu一键安装的对比我曾甚至因为这个原因都想过放弃Mac这个平台好在今日安装成功避免了设备选择上的一个困扰。
---
今日测试在Ubuntu和Mac上安装ta-lib库均使用conda命令安装成功。在此记录。
* 在Ubuntu下安装使用一条命令即可。
* 但是前提条件是已经成功安装anaconda并配置完成。参考[[Ubuntu配置之四 安装anaconda3]] ,[[Anaconda的环境配置]]两篇文章。
```
conda install -c conda-forge ta-lib
```
* 在Mac上使用以下命令
```bash
conda config --add channels conda-forge
conda config --set channel_priority strict
conda install ta-lib
```
---
## 关于TA-lib和pandas-ta的使用
目前没有深入学习但是看到关于talib相关的库有两个。
文章提到pandas-ta主要是针对pandas的dataframe格式数据支持更好但是文档也相对较少因此把两个库都安装了。
```python
pip install pandas-ta
```