Created
January 3, 2022 18:33
-
-
Save marcosan93/28e5cf11045bbe8b720f3061ec55fa72 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Adding sentiment positions to the forecast DF | |
| positions = pred_df.merge( | |
| sent_df, | |
| right_index=True, | |
| left_index=True, | |
| how='inner' | |
| ) | |
| # Getting forecast prophet positions | |
| positions['fbp_positions'] = positions.apply( | |
| lambda x: fbpPositions(x, short=True), | |
| axis=1 | |
| ) | |
| # Getting the overall positions of prophet and sentiment | |
| positions['news_and_fbp'] = positions.apply( | |
| lambda x: overallPosition(x), | |
| axis=1 | |
| ) | |
| # Buy and hold position | |
| positions['buy_hold'] = 1 | |
| # Random positions | |
| positions['random_positions'] = random.choices( | |
| [1,0,-1], k=len(positions) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment