Skip to content

Instantly share code, notes, and snippets.

@marcosan93
Created January 14, 2022 16:52
Show Gist options
  • Select an option

  • Save marcosan93/e00d91c94c394e133472709ac6d73bf3 to your computer and use it in GitHub Desktop.

Select an option

Save marcosan93/e00d91c94c394e133472709ac6d73bf3 to your computer and use it in GitHub Desktop.
def fbpPositions(pred_df, short=True):
"""
Gets positions based on the predictions and the actual values. This
is the logic of the trading strategy.
"""
if pred_df['open'] < pred_df['yhat_lower']:
return 1
elif pred_df['open'] > pred_df['yhat_upper'] and short:
return -1
else:
return 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment