Exemplo n.º 1
0
def future_max_apply_nb(close: tp.Array2d,
                        window: int,
                        wait: int = 1) -> tp.Array2d:
    """Get the maximum of the next period."""
    out = generic_nb.rolling_max_nb(close[::-1], window, minp=window)[::-1]
    if wait > 0:
        return generic_nb.bshift_nb(out, wait)
    return out
Exemplo n.º 2
0
def future_std_apply_nb(close, window, ewm, wait=1, adjust=False, ddof=0):
    """Get the standard deviation of the next period."""
    if ewm:
        out = generic_nb.ewm_std_nb(close[::-1], window, minp=window, adjust=adjust, ddof=ddof)[::-1]
    else:
        out = generic_nb.rolling_std_nb(close[::-1], window, minp=window, ddof=ddof)[::-1]
    if wait > 0:
        return generic_nb.bshift_nb(out, wait)
    return out
Exemplo n.º 3
0
def future_mean_apply_nb(close, window, ewm, wait=1, adjust=False):
    """Get the mean of the next period."""
    if ewm:
        out = generic_nb.ewm_mean_nb(close[::-1], window, minp=window, adjust=adjust)[::-1]
    else:
        out = generic_nb.rolling_mean_nb(close[::-1], window, minp=window)[::-1]
    if wait > 0:
        return generic_nb.bshift_nb(out, wait)
    return out
Exemplo n.º 4
0
def future_mean_apply_nb(close: tp.Array2d,
                         window: int,
                         ewm: bool,
                         wait: int = 1,
                         adjust: bool = False) -> tp.Array2d:
    """Get the mean of the next period."""
    if ewm:
        out = generic_nb.ewm_mean_nb(close[::-1],
                                     window,
                                     minp=window,
                                     adjust=adjust)[::-1]
    else:
        out = generic_nb.rolling_mean_nb(close[::-1], window,
                                         minp=window)[::-1]
    if wait > 0:
        return generic_nb.bshift_nb(out, wait)
    return out
Exemplo n.º 5
0
def future_std_apply_nb(close: tp.Array2d,
                        window: int,
                        ewm: bool,
                        wait: int = 1,
                        adjust: bool = False,
                        ddof: int = 0) -> tp.Array2d:
    """Get the standard deviation of the next period."""
    if ewm:
        out = generic_nb.ewm_std_nb(close[::-1],
                                    window,
                                    minp=window,
                                    adjust=adjust,
                                    ddof=ddof)[::-1]
    else:
        out = generic_nb.rolling_std_nb(close[::-1],
                                        window,
                                        minp=window,
                                        ddof=ddof)[::-1]
    if wait > 0:
        return generic_nb.bshift_nb(out, wait)
    return out
Exemplo n.º 6
0
def fixed_labels_apply_nb(close: tp.Array2d, n: int) -> tp.Array2d:
    """Get percentage change from the current value to a future value."""
    return (generic_nb.bshift_nb(close, n) - close) / close
Exemplo n.º 7
0
def fixed_labels_apply_nb(close, n):
    """Get percentage change from current point to future point."""
    return (generic_nb.bshift_nb(close, n) - close) / close
Exemplo n.º 8
0
def future_min_apply_nb(close, window, wait=1):
    """Get the minimum of the next period."""
    out = generic_nb.rolling_min_nb(close[::-1], window, minp=window)[::-1]
    if wait > 0:
        return generic_nb.bshift_nb(out, wait)
    return out