コード例 #1
0
    input_dict = {}  # initialize
    input_dict = {
        'f1': {
            'fname': 'OBV',
            'params': [9],
            'transform': ['Scaler', 'Robust']
        },
        'f2': {
            'fname': 'OBV',
            'params': [],
            'transform': ['Normalized', 10]
        }
    }

    dataSet = featureGen.generate_features(df, input_dict)

    #dataSet = transf.normalizer(dataSet, 'Volume', 50)

    # Plot price and indicators
    startDate = "2019-01-20"
    endDate = "2019-02-12"

    plotDataSet = dataSet[startDate:endDate]

    plot_dict = {}
    plot_dict['Issue'] = issue
    plot_dict['Plot_Vars'] = list(feature_dict.keys())
    plot_dict['Volume'] = 'Yes'
    plotIt.price_Ind_Vol_Plot(plot_dict, plotDataSet)
コード例 #2
0
    dataLoadStartDate = df.Date[lastRow - 3000]
    pprint(dataLoadStartDate)

    dataSet = dSet.set_date_range(df, dataLoadStartDate, dataLoadEndDate)
    pprint(dataSet.tail(10))

    # Resolve any NA's for now
    dataSet.fillna(method='ffill', inplace=True)

    dataSet = taLibMomSt.RSI(dataSet, 10)
    #dataSet = taLibMomSt.RSI2(dataSet, 2)
    pprint(dataSet.head(5))
    pprint(dataSet.tail(5))
    dataSet = taLibMomSt.PPO(dataSet, 12, 26)
    #    dataSet = taLibMomSt.CMO(dataSet, 20)
    #    dataSet = taLibMomSt.CCI(dataSet, 20)
    #    dataSet = taLibMomSt.UltOsc(dataSet, 7, 24, 28)
    #    dataSet = taLibMomSt.rate_OfChg(dataSet, 10)

    startDate = dataLoadStartDate
    endDate = dataLoadEndDate
    plotDF = dataSet[startDate:endDate]

    # Set up dictionary and plot HigherClose
    plot_dict = {}
    plot_dict['Issue'] = issue
    plot_dict['Plot_Vars'] = list(feature_dict.keys())
    plot_dict['Volume'] = 'Yes'
    plotIt.price_Ind_Vol_Plot(plot_dict, plotDF)
コード例 #3
0
                             y_label="Frequency",
                             title="beLong distribution for " + issue)
            plt.show(block=False)

        # Stationarity tests
#        stationarity_tests(mmData, 'Close', issue)
#        cols = [k for k,v in feature_dict.items() if v == 'Keep']
#        for x in cols:
#            stationarity_tests(mmData, x, issue)

        plot_dict = {}
        plot_dict['Issue'] = issue
        plot_vars = [k for k, v in feature_dict.items() if v == 'Keep']
        plot_dict['Plot_Vars'] = plot_vars
        plot_dict['Volume'] = 'Yes'
        plotIt.price_Ind_Vol_Plot(plot_dict, mmData)

        # EV related
        evData = dataSet.loc[modelStartDate:modelEndDate].copy()

        col_vals = [k for k, v in feature_dict.items() if v == 'Drop']
        to_drop = ['Open', 'High', 'Low', 'gainAhead', 'Close', 'Volume']
        for x in to_drop:
            col_vals.append(x)
        mmData = dSet.drop_columns(mmData, col_vals)

        names = mmData.columns.values.tolist()

        #        with open('columns_to_keep.json', 'w') as outfile:
        #            json.dump(names, outfile)