Пример #1
0
def chaikin_adl(high: nda.NdType, low: nda.NdType, close: nda.NdType,
                volume: nda.NdType) -> nda.NdType:
    """
    Chaikin Accumulation Distribution Line
    """
    return nda.nd_universal_adapter(chaikin_adl_np_1d,
                                    (high, low, close, volume), ())
Пример #2
0
def ema(series: nda.NdType,
        periods: int = 20,
        warm_periods: tp.Union[int, None] = None) -> nda.NdType:
    """
    Exponential moving average
    """
    if warm_periods is None:
        warm_periods = periods
    return nda.nd_universal_adapter(ema_np_1d, (series, ), (
        periods,
        warm_periods,
    ))
Пример #3
0
def wma(series: nda.NdType,
        weights: tp.Union[tp.List[float], np.ndarray] = None) -> nda.NdType:
    """
    :param weights: weights in decreasing order. lwma(series, 3) == wma(series, [3,2,1])
    """
    global last_alert
    if (weights is None or type(weights) is int):
        if time.time() - last_alert > 60:
            last_alert = time.time()
            log_err(
                "Warning! wma(series:ndarray, periods:int) deprecated. Use lwma instead of wma."
            )
        return lwma(series, weights)
    if type(weights) is list:
        weights = np.array(weights, np.float64)
    return nda.nd_universal_adapter(wma_np_1d, (series, ), (weights, ))
Пример #4
0
def shift(series: nda.NdType, periods: int = 1) -> nda.NdType:
    return nda.nd_universal_adapter(shift_np_1d, (series,), (periods,))
Пример #5
0
def obv(close: nda.NdType, volume: nda.NdType) -> nda.NdType:
    return nda.nd_universal_adapter(obv_np_1d, (close, volume), ())
Пример #6
0
def vwma(price: nda.NdType, volume: nda.NdType, periods: int = 20):
    return nda.nd_universal_adapter(vwma_np_1d, (price, volume), (periods, ))
Пример #7
0
def lwma(series: nda.NdType, periods: int = 20):
    return nda.nd_universal_adapter(lwma_np_1d, (series, ), (periods, ))
Пример #8
0
def stochastic_k(high: nda.NdType, low: nda.NdType, close: nda.NdType, periods: int = 14):
    return nda.nd_universal_adapter(k_np_1d, (high, low, close), (periods,))
Пример #9
0
def covariance(x: nda.NdType, y: nda.NdType, periods: int = 1) -> nda.NdType:
    return nda.nd_universal_adapter(covariance_np_1d, (x, y), (periods, ))
Пример #10
0
def variance(series: nda.NdType, periods: int = 1) -> nda.NdType:
    return nda.nd_universal_adapter(variance_np_1d, (series, ), (periods, ))
Пример #11
0
def top_pivot_points(series: nda.NdType, periods: int = 5) -> nda.NdType:
    return nda.nd_universal_adapter(top_pivot_points_np_1d, (series, ),
                                    (periods, ))