[英]How to find the content of Functions or Methods in TA Library?
I am working with Technical Analysis Library (TA lib) and I like to know the content of the methods in this library.我正在使用技术分析库 (TA lib),我想知道这个库中方法的内容。
I have a sample code below.我在下面有一个示例代码。 How could I find the content of the SMA method in talib?
如何在 talib 中找到 SMA 方法的内容?
import talib as ta
import pandas as pd
# Reading Stock data from csv file
df = pd.read_csv('./Update_Data_Python/_APPE1.csv')
# Calculate the Moving Average of previous 20 days--> return a series of numbers
ma20_series = ta.SMA(df.Close, 20)
Thanks in advance.提前致谢。
Python's TA-Lib library is just a wrapper for TA-Lib library written in C language. Python 的 TA-Lib 库只是用 C 语言编写的 TA-Lib 库的包装器。 C library is compiled to binary code, so no chance to check what inside at runtime.
C 库被编译成二进制代码,所以没有机会在运行时检查里面的内容。 You may investigate its C sources to find the code behind the methods.
您可以调查其 C 源代码以找到方法背后的代码。 The ta-lib wrapper downloads the sources from address: http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
ta-lib wrapper 从地址下载源码: http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
You may investigate this archieve or browse the sources online at您可以调查此档案或在线浏览资源,网址为
https://sourceforge.net/p/ta-lib/code/HEAD/tree/trunk/ https://sourceforge.net/p/ta-lib/code/HEAD/tree/trunk/
Or you may browse it's fork on GitHub:或者您可以在 GitHub 上浏览它的 fork:
https://github.com/TA-Lib/ta-lib https://github.com/TA-Lib/ta-lib
Anyway, for example, the SMA implementation is in ya_SMA.c file at /ta-lib/src/ta_func/
or ta-lib/c/src/ta_func/
.无论如何,例如,SMA 实现位于
/ta-lib/src/ta_func/
或ta-lib/c/src/ta_func/
的 ya_SMA.c 文件中。
Btw, there is API in Python to get the list of indicators' names and their parameters (input arguments, settings, output arguments etc.) - so called TA-Lib's abstract API. Btw, there is API in Python to get the list of indicators' names and their parameters (input arguments, settings, output arguments etc.) - so called TA-Lib's abstract API. So if you just need to list them and switch between them at runtime there is a way.
因此,如果您只需要列出它们并在运行时在它们之间切换,那么有一种方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.