Should I scale data before or after balancing dataset? I have 3 datasets which I each split into 3 separate classes [Buy/hold/sell]. I randomly up-sample each class's frequency in each dataset to 10,000 data points each. 

My question is, should I scale the training set before I do random up-sampling, or afterwards? Does it somehow skew the final training set in some way? 

I have provided a function which balances each dataset for me, note that at this point, the data has already been scaled. 

def balance_dataset(df): 
    training_set = df[:round(len(df.values) * TRAINING_LENGTH)]

    label_frequencies = training_set['Label'].value_counts(sort = True, ascending = True)

    highest_occurence = resample(training_set[training_set['Label'] == label_frequencies.index[2]], n_samples = 10000, random_state = 0, replace = True)
    middle_occurence = resample(training_set[training_set['Label'] == label_frequencies.index[1]], n_samples = 10000, random_state = 0, replace = True)
    lowest_occurrence = resample(training_set[training_set['Label'] == label_frequencies.index[0]], n_samples = 10000, random_state = 0, replace = True)

    balanced_training_set = pd.concat([highest_occurence, middle_occurence, lowest_occurrence])


    return balanced_training_set[['MACD', 'MFI', 'ROC', 'RSI', 'Ultimate Oscillator', 'Williams %R', 'Awesome Oscillator', 'KAMA', 
            'Stochastic Oscillator', 'TSI', 'Volume Accumulator', 'ADI', 'CMF', 'EoM', 'FI', 'VPT','ADX', 'ADX Negative', 'ADX Positive', 
            'EMA', 'CRA']],  balanced_training_set['Label']
Scaling, in general, depends on the min and max values in your dataset and up sampling, down sampling or even smote cannot change those values. So if you are including all the records in your final dataset then you can do it at anytime but, if you are not including all of your original records then you should do it before upsampling.