Back to Community
Determine the Value-at-Risk by using Machine Learning

I have listen to a lot of "Chat with Traders" lately and noticed, that a many underlined the importance of good risk management. Basicly they don't hold any position above a defined maximal value (like some percantage of their booksize). But how to measure this threshold? Most of the interviewed traders are swing traders, that means they can't simply take the position size as "maximal to loose" since this can not applied to short positions.

I try to tackle this task here and will focus on the downside risk of long positions. However, the shown method can directly be applied to short positions. I am going to measure the risk for a holding period of one day.

This notebook contains four parts:

  • Get the Data (Nine stocks with 17 years of historical data)
  • Classifier Selection (Use different classifiers and compare their out-of-sample performance)
  • Classifier Optimization (Parameter tweaking using cross-validation)

Here $\alpha$ is choosen as $0.01$, but different values were tested.

We will find that K-Nearest Neighboors and Decision Trees perform best and yield almost same results. I am planning to implement one of these as a pipeline factor. With that one can determine a maximal position size for each securtity.

I hope you find this helpfull and would be happy about some feedback.


Loading notebook preview...