Skip to content

Instantly share code, notes, and snippets.

@Burntt
Last active March 24, 2022 11:01
Show Gist options
  • Save Burntt/2d77c476324b0cda46b32a82e2061e33 to your computer and use it in GitHub Desktop.
Save Burntt/2d77c476324b0cda46b32a82e2061e33 to your computer and use it in GitHub Desktop.
# Set data source
data = data_ohlcv
data_index = data.index
# Select train data
X = data.drop(['label_barrier'], axis = 1)
X.drop(X.tail(t_final).index,inplace = True)
# Select test data
y = data[['label_barrier']]
y.reindex(data_index)
y = y[:-t_final]
y = y.squeeze()
# Prediction and evalution times
t1_ = data.index
# recall that we are holding our position for 10 days
# normally t1 is important is there events such as stop losses, or take profit events
# Recall t_final from before! This is the maximum of a box!!
# prediction time is moment of observationxticklabels
prediction_times = pd.Series(t1_[:-t_final], index = X.index)
# evaluation time is moment of evaluation event
evaluation_times = pd.Series(t1_[t_final:], index = X.index)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment