def prepare_data(data):
    # for market(0, 3), ema(4, 7), macd(8, 9)
    sigmoid = get_sigmoid_ration
    sigm0 = sigmoid(data[:, 0])
    sigm1 = sigmoid(data[:, 1])
    sigm2 = sigmoid(data[:, 2])
    sigm3 = sigmoid(data[:, 3])
    delta_oc = get_delta(data, 0, 3)
    diff1 = get_diff(data[:, 1])
    diff2 = get_diff(data[:, 2])
    diff3 = get_diff(data[:, 3])
    logdiff1 = get_log_diff(data[:, 1])
    logdiff2 = get_log_diff(data[:, 2])
    logdiff3 = get_log_diff(data[:, 3])
    detrend1 = get_delta(data, 3, 4)  # close - ema13
    detrend2 = get_delta(data, 3, 5)  # close - ema26
    diff_ema1 = get_diff(data[:, 4])
    diff_ema2 = get_diff(data[:, 5])
    delta_ema1 = get_delta(data, 4, 5)
    delta_ema2 = get_delta(data, 6, 7)
    #
    return np.array(
        np.column_stack(
            (sigm0, sigm1, sigm2, sigm3, delta_oc, diff1, diff2, diff3,
             logdiff1, logdiff2, logdiff3, detrend1, detrend2, diff_ema1,
             diff_ema2, delta_ema1, delta_ema2, data[:, 8], data[:, 9])))
Example #2
0
def prepare_data(data):
    # for time(0, 6), market(7, 10), ema(11, 14), macd(15, 16)
    # for atr(17), cci(18), rsi(19), usdx(20), eurx(21)
    #
    delta = get_delta(data, 7, 10)
    # diff1 = get_diff(data[:, 8])
    # diff2 = get_diff(data[:, 9])
    # diff3 = get_diff(data[:, 10])
    logdiff1 = get_log_diff(data[:, 8])
    logdiff2 = get_log_diff(data[:, 9])
    logdiff3 = get_log_diff(data[:, 10])
    detrend1 = get_delta(data, 10, 11)  # close - ema13
    detrend2 = get_delta(data, 10, 12)  # close - ema26
    #
    # ediff1 = get_diff(data[:, 11])
    # ediff2 = get_diff(data[:, 12])
    # ediff3 = get_diff(data[:, 13])
    elogdiff1 = get_log_diff(data[:, 11])
    elogdiff2 = get_log_diff(data[:, 12])
    elogdiff3 = get_log_diff(data[:, 13])
    #
    # xdiff1 = get_diff(data[:, 20])
    # xdiff2 = get_diff(data[:, 21])
    return np.array(
        np.column_stack((
            # data[:, 5:6], # hours and minutes
            # data[:, 8:11], # prices (without open)
            delta,
            # diff1, diff2, diff3,
            # logdiff1, logdiff2, logdiff3,
            detrend1,
            detrend2,
            # ediff1, ediff2, ediff3,
            # elogdiff1, elogdiff2, elogdiff3,
            # data[:, 15:17], # macd
            data[:, 17:19],
            data[:, 19] - 50,  # atr, cci, rsi
            # data[:, 20:22], # usd and eur indexes
            # xdelta,
            # xdiff1, xdiff2,
            # xlogdiff1, xlogdiff2,
        )))