Python talib.BETA Examples

The following are 5 code examples of talib.BETA(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module talib , or try the search function .
Example #1
Source File: beta.py    From jesse with MIT License 6 votes vote down vote up
def beta(candles: np.ndarray, period=5, sequential=False) -> Union[float, np.ndarray]:
    """
    BETA - Beta

    :param candles: np.ndarray
    :param period: int - default: 5
    :param sequential: bool - default=False

    :return: float | np.ndarray
    """
    if not sequential and len(candles) > 240:
        candles = candles[-240:]

    res = talib.BETA(candles[:, 3], candles[:, 4], timeperiod=period)

    if sequential:
        return res
    else:
        return None if np.isnan(res[-1]) else res[-1] 
Example #2
Source File: talib_indicators.py    From qtpylib with Apache License 2.0 6 votes vote down vote up
def BETA(data, **kwargs):
    _check_talib_presence()
    _, phigh, plow, _, _ = _extract_ohlc(data)
    return talib.BETA(phigh, plow, **kwargs) 
Example #3
Source File: talib_series.py    From QUANTAXIS with MIT License 5 votes vote down vote up
def BETA(SeriesA, SeriesB, timeperiod=5):
    res = talib.BETA(SeriesA.values, SeriesB.values, timeperiod)
    return pd.Series(res, index=SeriesA.index) 
Example #4
Source File: talib_series.py    From QUANTAXIS with MIT License 5 votes vote down vote up
def CORREL(SeriesA, SeriesB, timeperiod=5):
    res = talib.BETA(SeriesA.values, SeriesB.values, timeperiod)
    return pd.Series(res, index=SeriesA.index) 
Example #5
Source File: talib_wrapper.py    From tia with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def BETA(frame, col0, col1, n=5):
    return _frame_to_series(frame, [col0, col1], talib.BETA, n)