Williams R Ta-lib 在回溯期出现 TypeError

Williams R Ta-lib getting TypeError with look back period

我对来自 here 的 ta-lib 有疑问: 我的代码:

import pandas as pd
# import matplotlib
from pandas_datareader import data as web
import ta


df = web.DataReader('F', 'yahoo')

williams1 = ta.momentum.WilliamsRIndicator(
        high = df['High'], 
        low = df['Low'], 
        close = df['Close'], 
        fillna = False
        )

williams1.wr()

网站上提到 look back period

如何添加这个参数?我尝试添加 int =14 但出现错误:

TypeError: __init__() got an unexpected keyword argument 'int'

如果我不包含此代码,则代码有效,但我想我需要为句点添加一个数字。

您误读了签名,它是 lbp=14:

williams1 = ta.momentum.WilliamsRIndicator(
    high=df["High"],
    low=df["Low"],
    close=df["Close"],
    lbp=14,
    fillna=False,
)