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), ())
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, ))
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, ))
def shift(series: nda.NdType, periods: int = 1) -> nda.NdType: return nda.nd_universal_adapter(shift_np_1d, (series,), (periods,))
def obv(close: nda.NdType, volume: nda.NdType) -> nda.NdType: return nda.nd_universal_adapter(obv_np_1d, (close, volume), ())
def vwma(price: nda.NdType, volume: nda.NdType, periods: int = 20): return nda.nd_universal_adapter(vwma_np_1d, (price, volume), (periods, ))
def lwma(series: nda.NdType, periods: int = 20): return nda.nd_universal_adapter(lwma_np_1d, (series, ), (periods, ))
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,))
def covariance(x: nda.NdType, y: nda.NdType, periods: int = 1) -> nda.NdType: return nda.nd_universal_adapter(covariance_np_1d, (x, y), (periods, ))
def variance(series: nda.NdType, periods: int = 1) -> nda.NdType: return nda.nd_universal_adapter(variance_np_1d, (series, ), (periods, ))
def top_pivot_points(series: nda.NdType, periods: int = 5) -> nda.NdType: return nda.nd_universal_adapter(top_pivot_points_np_1d, (series, ), (periods, ))