def METHOD_NAME(
    # TODO: use https://github.com/ramonhagenaars/nptyping
    signal: 'np.ndarray[float64]',
    period: int64 = 14,
    up_ema_last: float64 = None,
    down_ema_last: float64 = None,
) -> 'np.ndarray[float64]':
    '''
    relative strengggth.
    '''
    alpha = 1/period
    df = np.diff(signal, prepend=0)
    up = np.where(df > 0, df, 0)
    up_ema = ema(up, alpha, up_ema_last)
    down = np.where(df < 0, -df, 0)
    down_ema = ema(down, alpha, down_ema_last)
    # avoid dbz errors, this leaves the first
    # index == 0 right?
    rs = np.divide(
        up_ema,
        down_ema,
        out=np.zeros_like(signal),
        where=down_ema != 0
    )
    # map rs through sigmoid (with range [0, 100])
    rsi = 100 - 100 / (1 + rs)
    # rsi = 100 * (up_ema / (up_ema + down_ema))
    # also return the last ema state for next iteration
    return rsi, up_ema[-1], down_ema[-1]