Skip to content

Conversation

@gloriadallacosta
Copy link

No description provided.

Copy link
Contributor

@PanPip PanPip left a 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 @@
{
Copy link
Contributor

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.

Comment on lines +336 to +337
"metadata": {},
"execution_count": 172
Copy link
Contributor

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.

Comment on lines +638 to +639
"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')"
Copy link
Contributor

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",
Copy link
Contributor

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.

Comment on lines +848 to +850
"**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"
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants