예제 #1
0
    pred = 1200
    channel  = Channel(cur.loc[:end, 'aud'].values, std_ratio = 2)
    wave = Wave(cur.loc[:end, 'aud'].values)
    plt.plot(cur.loc[:end, 'aud'].values)
    plt.figure()
    plt.plot(channel.flattened)
    plt.plot(np.zeros(channel.flattened.shape[0]), color='black')
    plt.plot(np.zeros(channel.flattened.shape[0]) + channel.channel_deviation * 2, color='black')        
    plt.plot(np.zeros(channel.flattened.shape[0]) - channel.channel_deviation * 2, color='black')        
    plt.plot(wave.channel_wave)
    plt.figure()
    plt.plot(cur.loc[:pred, 'aud'].values)    
    plt.plot(cur.loc[:end, 'aud'].values)
    plt.plot(channel.c1(), color='black')
    plt.plot(channel.c3(), color='black')
    plt.plot(channel.c5(), color='black')
    plt.plot(wave.wave)
    
    
    
###############################################################################
# Better Autocorrelations
###############################################################################
if 0:
    
    def serial_corr(wave, lag=1):
        n = wave.shape[0]
        y1 = wave[lag:]
        y2 = wave[:n-lag]
        corr = np.corrcoef(y1, y2, ddof=0)[0, 1]
        return corr
예제 #2
0
        fit of wave ?
    '''

    for i in range(100, 1000, 10):
        start = 0
        end = i

        instrument = 'EUR_USD'

        inst = ratios.loc[start:end, instrument].astype(float)
        channel = Channel(inst.values)
        wave = Wave(inst.values)

        plt.figure()
        plt.plot(channel.flattened)
        plt.plot(channel.c5() - channel.line)
        plt.plot(channel.c1() - channel.line)
        plt.plot(wave.wave - wave.linregress)
        plt.show()

        plt.figure()
        plt.plot(channel.flattened)
        plt.plot(channel.c5() - channel.line)
        plt.plot(channel.c1() - channel.line)
        plt.plot(wave.wave - wave.linregress, 'o')
        plt.show()

        print(end)
        print('FIT: {}'.format(waves_fit.loc[end].values))
        print('FREQ: {}'.format(waves_freq.loc[end].values))