-
Notifications
You must be signed in to change notification settings - Fork 5
My submission to the Oct21 challenge #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
My submission to the Oct21 challenge #3
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Gloria, 🙂
Thank you for working on this notebook. It feels like a bit more time should be dedicated to making the code clearer and better documented. Also would be good to see more of your comments throughout the notebook.
Will set up an interview.
- Long functions and classes could be moved to separate .py files.
- Good forecast visualisations added.
- Strategy testing logic should be adjusted to eliminate a lookahead bias.
- "acceleration seems to provide worse results than velocity" - it would be interesting to discuss this observation.
| @@ -0,0 +1,1124 @@ | |||
| { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that the whole code is in the jupyter notebook, and not in separate .py files. But I see you've split the functionality into functions and classes in various cells.
| "metadata": {}, | ||
| "execution_count": 172 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to see separate components forecast visualisations here.
| "df = pd.DataFrame(fullarray, columns = ['Date','Open','High','Low','Close','Adj Close','Volume','VWAP','Pct','Returns','pPos','pVel','pAcc','bPos','bVel','bAcc'])\n", | ||
| "df['Date'] = pd.to_datetime(df['Date'] - epoch, unit='D')" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main dataframe has a lot of columns here. It can be split into smaller ones to make it easier to follow the logic behind calculations.
| " df.loc[index, 'position'] = 1\n", | ||
| " position = 0\n", | ||
| "alloc = 100\n", | ||
| "df['net_position'] = df.position.cumsum().shift().fillna(0)\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We see explosive returns in this backtest because we're assessing the model performance on the same data it was trained on.
We should have rather used a rolling window to train, get the forecast for the next observation (or check the components on the current observation) and trade based on it.
| "**4. CONSTRUCT TRADING STRATEGY FOR THE END USER**\n", | ||
| "\n", | ||
| "Here I recap all the libraries used and functions created, so that the final user can just call a function, enter the symbol he is interested into and the start and end date of the period he is looking into" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This final code piece could be a bit tidier and better commented.
No description provided.