Esempio n. 1
0
    
    # Start with 100 points of 1H data
    # iterate (I know!) over the range, getting history data and transform into features
    
    count = 0
    
    for row in hour_data.itertuples(index=True):
        
        #print (getattr(row, "Index"), getattr(row, 'open'))    
        
        time = getattr(row,"Index")
        #open_price = getattr(row,"open")
        
        # reomoved time here, will it work?
        features = all_data.getFeatures()

        feature_series = pd.Series(features)
        feature_series.name = time
        
        features_df = features_df.append(feature_series)
       
        '''
        if (count > 1000):   
            break
        
        count +=1
        '''
        
    print ('features_df shape:', features_df.shape)
    print (features_df.head())
Esempio n. 2
0
    print(X_train.shape)

    y_train = y_train.values.ravel()

    svclassifier = SVC(kernel='rbf')
    svclassifier.fit(X_train, y_train)

    loop = True

    while (loop):

        price = all_data.getTimePrice()
        print('current price:', price)
        print('start time is:', all_data.virtual_time)

        current_sample = all_data.getFeatures()

        print('current sample:', current_sample.shape)

        current_sample = current_sample.reshape(1, -1)

        print('after reshape:', current_sample.shape)

        y_pred = svclassifier.predict(current_sample)

        #y_pred = svclassifier.predict(X_test)

        print('current prediction:', y_pred)

        if (y_pred[0] == 2):
            print('SELL!!!!!!')