Example #1
0
def upper_bollinger_feature(eq, period=20, stds=2):
    upper_bol_vec, _ = eq.bollinger_bands(period, stds)

    upper_bol_vec = np.array(upper_bol_vec)
    upper_bol_vec = upper_bol_vec.T

    return [Indicator(upper_bol_vec)]
Example #2
0
def macd_signal(eq, slow_period, fast_period):
    macd_sig = np.array(
        Indicators.ema(
            np.array(Indicators.macd(eq.closes, slow_period, fast_period)), 9))
    macd_sig = macd_sig.T

    return [Indicator(macd_sig)]
Example #3
0
def lower_bollinger_feature(eq, period=20, stds=2):
    _, lower_bol_vec = eq.bollinger_bands(period, stds)

    lower_bol_vec = np.array(lower_bol_vec)
    lower_bol_vec = lower_bol_vec.T

    return [Indicator(lower_bol_vec)]
Example #4
0
def oil_feature():
    wti_file = os.path.join('../', 'commodities', 'OIL')
    wti = Equity(wti_file)

    wti_closes = np.array(wti.closes)
    wti_closes = wti_closes.T

    return [Indicator(wti_closes)]
Example #5
0
def snp_feature():
    snp_file = os.path.join('../', 'indexes', 'SNP')
    snp_eq = Equity(snp_file)

    snp_closes = np.array(snp_eq.closes)
    snp_closes = snp_closes.T

    return [Indicator(snp_closes)]
Example #6
0
def reit_feature():
    reit_file = os.path.join('../', 'indexes', 'RE')
    reit_eq = Equity(reit_file)

    reit_closes = np.array(reit_eq.closes)
    reit_closes = reit_closes.T

    return [Indicator(reit_closes)]
Example #7
0
def macd_raw_feature(eq, slow_period, fast_period):
    """
    Generates a feature vector of macd_raw for the last num_days
    """
    macd_raw_vec = np.array(
        Indicators.macd(eq.closes, slow_period, fast_period))
    macd_raw_vec = macd_raw_vec.T

    return [Indicator(macd_raw_vec)]
Example #8
0
def olhc_feature(eq):
    ohlc_vec = eq.ohlc()
    return [Indicator(ohlc_vec)]
Example #9
0
def prings_feature(eq):
    prings_vec = np.array(Indicators.prings_know_sure_thing(eq.closes))
    prings_vec = prings_vec.T
    return [Indicator(prings_vec)]
Example #10
0
def rsi_feature(eq, period=20, type='sma'):
    rsi_vec = np.array(Indicators.rsi(eq.closes, period, type))
    rsi_vec = rsi_vec.T
    return [Indicator(rsi_vec)]
Example #11
0
def trix_vec_feature(eq):
    trix_vec = np.array(Indicators.trix_indicator(eq.closes))
    trix_vec = trix_vec.T
    return [Indicator(trix_vec)]
Example #12
0
def kst_trix_vec_feature(eq):
    kst_trix_vec = np.array(Indicators.kst_trix_indicator(eq.closes))
    kst_trix_vec = kst_trix_vec.T

    return [Indicator(kst_trix_vec)]
Example #13
0
def bop_feature(eq):
    bop_vec = np.array(eq.balance_of_power())
    bop_vec = bop_vec.T

    return [Indicator(bop_vec)]
Example #14
0
def atr_feature(eq, period):
    atr_vec = np.array(Indicators.average_true_range(eq, period))
    atr_vec = atr_vec.T

    return [Indicator(atr_vec)]
Example #15
0
def gop_feature(eq, period):
    gop_vec = np.array(eq.gop_range_index(period))
    gop_vec = gop_vec.T

    return [Indicator(gop_vec)]
Example #16
0
def volume_feature(eq):

    vol_vec = np.array(eq.volumes)
    vol_vec = vol_vec.T

    return [Indicator(vol_vec)]
Example #17
0
def wilder_feature(eq, period):
    wilder_vec = np.array(Indicators.ema(eq.closes, period, 'wilder'))
    wilder_vec = wilder_vec.T

    return [Indicator(wilder_vec)]
Example #18
0
def ema_feature(eq, period):

    ema_vec = np.array(Indicators.ema(eq.closes, period))
    ema_vec = ema_vec.T

    return [Indicator(ema_vec)]
Example #19
0
def sma_feature(eq, period):
    sma_vec = np.array(Indicators.sma(eq.closes, period))
    sma_vec = sma_vec.T

    return [Indicator(sma_vec)]
Example #20
0
def close_feature(eq):

    close_vec = np.array(eq.closes)
    close_vec = close_vec.T

    return [Indicator(close_vec)]
Example #21
0
def accum_swing_feature(eq):
    accum_swing_vec = np.array(eq.accumulative_swing_index())
    accum_swing_vec = accum_swing_vec.T

    return [Indicator(accum_swing_vec)]
Example #22
0
    def rainbow_ma(prices, periods=(1, 3, 5, 7, 9)):

        return [
            Indicator(Indicators.sma(prices, period).T) for period in periods
        ]