Python talib 模块,WILLR 实例源码

我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用talib.WILLR

项目:dash-technical-charting    作者:plotly    | 项目源码 | 文件源码
def add_WILLR(self, timeperiod=14,
              type='line', color='secondary', **kwargs):
    """Williams %R."""

    if not (self.has_high and self.has_low and self.has_close):
        raise Exception()

    utils.kwargs_check(kwargs, VALID_TA_KWARGS)
    if 'kind' in kwargs:
        type = kwargs['kind']

    name = 'WILLR({})'.format(str(timeperiod))
    self.sec[name] = dict(type=type, color=color)
    self.ind[name] = talib.WILLR(self.df[self.hi].values,
                                 self.df[self.lo].values,
                                 self.df[self.cl].values,
                                 timeperiod)
项目:zStock    作者:superxhy    | 项目源码 | 文件源码
def WR_CN(high, low, close, timeperiod=9):
        return -tl.WILLR(high, low, close, timeperiod)

    #MAX
项目:autoxd    作者:nessessary    | 项目源码 | 文件源码
def WILLR(self):
        """?KDJ??, 0?-20??? 80?-100??"""
        closes = self.getCloses()
        highs = self.getHighs()
        lows = self.getLows()
        return talib.WILLR(highs,lows,closes)

    #----------------------------------------------------------------------
项目:autoxd    作者:nessessary    | 项目源码 | 文件源码
def WILLR(highs, lows, closes):
    """0?-100???, ?KDJ??, 0?-20??? -80?-100??
    return: wr 
    """
    highs = np.array(highs)
    lows = np.array(lows)
    closes = np.array(closes)
    return talib.WILLR(highs,lows,closes)